jaehyun pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7500ef6f8c8b22a139670fe65d16a42c4785e0e2
commit 7500ef6f8c8b22a139670fe65d16a42c4785e0e2 Author: Vincent Torri <vincent dot torri at gmail dot com> Date: Thu Dec 10 20:09:00 2015 +0900 edje_cc: Use ecore_file_file_get() and ecore_file_dir_get() for EDC parsing Replace current EDC parsing code in edje_cc on Windows with the code using ecore_file_file_get() and ecore_file_dir_get(). Signed-off-by: Jaehyun Cho <jae_hyun....@samsung.com> --- src/bin/edje/edje_cc_parse.c | 27 +++++++++++---------------- src/bin/edje/edje_cc_sources.c | 37 ++----------------------------------- 2 files changed, 13 insertions(+), 51 deletions(-) diff --git a/src/bin/edje/edje_cc_parse.c b/src/bin/edje/edje_cc_parse.c index 4fa97eb..4466c87 100644 --- a/src/bin/edje/edje_cc_parse.c +++ b/src/bin/edje/edje_cc_parse.c @@ -914,23 +914,13 @@ void compile(void) { char buf[4096], buf2[4096]; - char inc[4096]; Eina_Tmpstr *tmpn; int fd; off_t size; - char *data, *p; + char *data; Eina_List *l; Edje_Style *stl; - strncpy(inc, file_in, 4000); - inc[4001] = 0; - p = strrchr(inc, '/'); -#ifdef _WIN32 - char *p_backslash = strrchr(inc, '\\'); - if (p_backslash > p) p = p_backslash; -#endif - if (!p) strcpy(inc, "./"); - else *p = 0; fd = eina_file_mkstemp("edje_cc.edc-tmp-XXXXXX", &tmpn); if (fd < 0) { @@ -986,25 +976,30 @@ compile(void) eina_prefix_lib_get(pfx)); if (ecore_file_exists(buf2)) { + char *inc; + + inc = ecore_file_dir_get(file_in); if (depfile) snprintf(buf, sizeof(buf), "%s -MMD %s -MT %s %s -I%s %s -o %s" " -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d", buf2, depfile, file_out, file_in, - inc, def, clean_file, + inc ? inc : "./", def, clean_file, EINA_VERSION_MAJOR, EINA_VERSION_MINOR); else if (annotate) snprintf(buf, sizeof(buf), "%s -annotate -a %s %s -I%s %s -o %s" " -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d", buf2, watchfile ? watchfile : "/dev/null", file_in, - inc, def, clean_file, + inc ? inc : "./", def, clean_file, EINA_VERSION_MAJOR, EINA_VERSION_MINOR); else snprintf(buf, sizeof(buf), "%s -a %s %s -I%s %s -o %s" " -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d", buf2, watchfile ? watchfile : "/dev/null", file_in, - inc, def, clean_file, + inc ? inc : "./", def, clean_file, EINA_VERSION_MAJOR, EINA_VERSION_MINOR); ret = system(buf); + if (inc) + free(inc); } else { @@ -1029,9 +1024,9 @@ compile(void) } DBG("Opening \"%s\" for input", file_in); - /* lseek can return -1 on error. trap that return and exit so that + /* lseek can return -1 on error. trap that return and exit so that * we do not pass malloc a -1 - * + * * NB: Fixes Coverity CID 1040029 */ size = lseek(fd, 0, SEEK_END); if (size < 0) diff --git a/src/bin/edje/edje_cc_sources.c b/src/bin/edje/edje_cc_sources.c index 381ba20..3f119bb 100644 --- a/src/bin/edje/edje_cc_sources.c +++ b/src/bin/edje/edje_cc_sources.c @@ -154,25 +154,7 @@ source_fetch_file(const char *fil, const char *filname) */ if (!dir) { - char *slash; - if (strrchr(fil, '/')) - { - dir = mem_strdup(fil); - slash = strrchr(dir, '/'); - } - else - { - slash = NULL; - } -#ifdef _WIN32 - if (strrchr(fil, '\\')) - { - if (!dir) dir = mem_strdup(fil); - char *backslash = strrchr(dir, '\\'); - if (backslash > slash) slash = backslash; - } -#endif - if (slash) *slash = '\0'; + dir = ecore_file_dir_get(fil); if (dir) dir_len = strlen(dir); } @@ -219,22 +201,7 @@ source_fetch_file(const char *fil, const char *filname) void source_fetch(void) { - char buf[PATH_MAX] = {0}, *ptr; - - ptr = strrchr(file_in, '/'); - if (ptr) - { - snprintf(buf, sizeof (buf), "%s", ptr + 1); - } -#ifdef _WIN32 - char *ptr_backslash = strrchr(file_in, '\\'); - if (ptr_backslash) - { - if (ptr_backslash > ptr) - snprintf(buf, sizeof (buf), "%s", ptr_backslash + 1); - } -#endif - source_fetch_file(file_in, buf[0] ? buf : file_in); + source_fetch_file(file_in, ecore_file_file_get(file_in)); } int --