From 6b6def418b8ec84a8a0bb91aa0818382b55f9602 Mon Sep 17 00:00:00 2001 From: cedric Date: Wed, 7 Oct 2009 10:55:48 +0000 Subject: [PATCH] * edje: Remove some potential bug detected by llvm and gcc. See: http://local.profusion.mobi:8081/~lfelipe/output-efl/ git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@42930 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/edje_cc_out.c | 2 +- src/bin/edje_cc_sources.c | 10 +++++++++- src/lib/edje_text.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/bin/edje_cc_out.c b/src/bin/edje_cc_out.c index efc1307..2d61736 100644 --- a/src/bin/edje_cc_out.c +++ b/src/bin/edje_cc_out.c @@ -525,7 +525,7 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw const char *file = NULL; evas_object_image_file_get(im, &file, NULL); - if ((file) && (stat(file, &st) != 0)) + if (!file || (stat(file, &st) != 0)) st.st_size = 0; *input_bytes += st.st_size; *input_raw_bytes += im_w * im_h * 4; diff --git a/src/bin/edje_cc_sources.c b/src/bin/edje_cc_sources.c index 55986a5..2bc255d 100644 --- a/src/bin/edje_cc_sources.c +++ b/src/bin/edje_cc_sources.c @@ -48,6 +48,7 @@ source_fetch_file(const char *fil, const char *filname) FILE *f; char buf[16 * 1024], *dir = NULL; long sz; + size_t tmp; ssize_t dir_len = 0; SrcFile *sf; @@ -65,7 +66,14 @@ source_fetch_file(const char *fil, const char *filname) sf = mem_alloc(SZ(SrcFile)); sf->name = mem_strdup(filname); sf->file = mem_alloc(sz + 1); - fread(sf->file, sz, 1, f); + tmp = fread(sf->file, sz, 1, f); + if (tmp != sz) + { + fprintf(stderr, "%s: Warning filename length doesn't match !\n", + progname); + exit(-1); + } + sf->file[sz] = '\0'; fseek(f, 0, SEEK_SET); srcfiles.list = eina_list_append(srcfiles.list, sf); diff --git a/src/lib/edje_text.c b/src/lib/edje_text.c index fe1ceb7..003a45a 100644 --- a/src/lib/edje_text.c +++ b/src/lib/edje_text.c @@ -243,7 +243,7 @@ _edje_text_font_get(const char *base, const char *new, char **free_later) if (base && (!new)) return base; - else if ((!base) && new) + else if (!base) return new; base_style = strstr(base, ":style="); -- 2.7.4