summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-01-19 16:26:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-19 18:18:29 +0900
commita2ef5f7cc5cb827fa68fae66706c31c65d5e0ef5 (patch)
tree0bfb064371939139b568802d8c4135c584cf347d /src/modules
parent7832bab2533afa07afc434074243933c5f37d020 (diff)
Evas GL: Also fix surface cap cache
This follows the fix in eina_file_mkstemp. Not sure how it could even work before. @fix
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c32
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_shader.c6
2 files changed, 23 insertions, 15 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index f851d560cc..e5414b4f3f 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -816,43 +816,51 @@ _surface_cap_cache_save()
816{ 816{
817 /* check eet */ 817 /* check eet */
818 Eet_File *et = NULL; //check eet file 818 Eet_File *et = NULL; //check eet file
819 int tmpfd; 819 int tmpfd = -1;
820 int res = 0;
821 char cap_dir_path[PATH_MAX]; 820 char cap_dir_path[PATH_MAX];
822 char cap_file_path[PATH_MAX]; 821 char cap_file_path[PATH_MAX];
823 char tmp_file[PATH_MAX]; 822 char tmp_file_name[PATH_MAX];
823 Eina_Tmpstr *tmp_file_path = NULL;
824 824
825 /* use eet */ 825 /* use eet */
826 if (!eet_init()) return 0; 826 if (!eet_init()) return 0;
827 827
828 if (!evas_gl_common_file_cache_dir_check(cap_dir_path, sizeof(cap_dir_path))) 828 if (!evas_gl_common_file_cache_dir_check(cap_dir_path, sizeof(cap_dir_path)))
829 { 829 {
830 res = evas_gl_common_file_cache_mkpath(cap_dir_path); 830 if (!evas_gl_common_file_cache_mkpath(cap_dir_path))
831 if (!res) return 0; /* we can't make directory */ 831 return 0; /* we can't make directory */
832 } 832 }
833 833
834 evas_gl_common_file_cache_file_check(cap_dir_path, "surface_cap", cap_file_path, 834 evas_gl_common_file_cache_file_check(cap_dir_path, "surface_cap", cap_file_path,
835 sizeof(cap_dir_path)); 835 sizeof(cap_dir_path));
836 836
837 /* use mkstemp for writing */ 837 /* use mkstemp for writing */
838 snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX.cache", cap_file_path); 838 snprintf(tmp_file_name, sizeof(tmp_file_name), "%s.XXXXXX.cache", cap_file_path);
839 tmpfd = eina_file_mkstemp(tmp_file, NULL); 839 tmpfd = eina_file_mkstemp(tmp_file_name, &tmp_file_path);
840 if (tmpfd < 0) goto error; 840 if (tmpfd < 0) goto error;
841 close(tmpfd);
842 841
843 et = eet_open(tmp_file, EET_FILE_MODE_WRITE); 842 et = eet_open(tmp_file_path, EET_FILE_MODE_WRITE);
844 if (!et) goto error; 843 if (!et) goto error;
845 844
846 if (!_surface_cap_save(et)) goto error; 845 if (!_surface_cap_save(et)) goto error;
847 846
848 if (eet_close(et) != EET_ERROR_NONE) goto error; 847 if (eet_close(et) != EET_ERROR_NONE) goto destroyed;
849 if (rename(tmp_file,cap_file_path) < 0) goto error; 848 if (rename(tmp_file_path, cap_file_path) < 0) goto destroyed;
849 eina_tmpstr_del(tmp_file_path);
850 close(tmpfd);
850 eet_shutdown(); 851 eet_shutdown();
852
851 return 1; 853 return 1;
852 854
855destroyed:
856 et = NULL;
857
853error: 858error:
859 if (tmpfd >= 0) close(tmpfd);
854 if (et) eet_close(et); 860 if (et) eet_close(et);
855 if (evas_gl_common_file_cache_file_exists(tmp_file)) unlink(tmp_file); 861 if (evas_gl_common_file_cache_file_exists(tmp_file_path))
862 unlink(tmp_file_path);
863 eina_tmpstr_del(tmp_file_path);
856 eet_shutdown(); 864 eet_shutdown();
857 return 0; 865 return 0;
858} 866}
diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c
index 2b7fa42681..6156503bfd 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_shader.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c
@@ -243,7 +243,7 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared)
243 char bin_dir_path[PATH_MAX]; 243 char bin_dir_path[PATH_MAX];
244 char bin_file_path[PATH_MAX]; 244 char bin_file_path[PATH_MAX];
245 char tmp_file_name[PATH_MAX]; 245 char tmp_file_name[PATH_MAX];
246 int tmpfd = -1, res = 0, copy; 246 int tmpfd = -1, copy;
247 Eina_Tmpstr *tmp_file_path = NULL; 247 Eina_Tmpstr *tmp_file_path = NULL;
248 Eet_File *ef = NULL; 248 Eet_File *ef = NULL;
249 Evas_GL_Program *p; 249 Evas_GL_Program *p;
@@ -255,8 +255,8 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared)
255 255
256 if (!evas_gl_common_file_cache_dir_check(bin_dir_path, sizeof(bin_dir_path))) 256 if (!evas_gl_common_file_cache_dir_check(bin_dir_path, sizeof(bin_dir_path)))
257 { 257 {
258 res = evas_gl_common_file_cache_mkpath(bin_dir_path); 258 if (!evas_gl_common_file_cache_mkpath(bin_dir_path))
259 if (!res) return 0; /* we can't make directory */ 259 return 0; /* we can't make directory */
260 } 260 }
261 261
262 copy = evas_gl_common_file_cache_file_check(bin_dir_path, "binary_shader", bin_file_path, 262 copy = evas_gl_common_file_cache_file_check(bin_dir_path, "binary_shader", bin_file_path,