From 586979c07ba688b2346eef81f9c2404b43f5a902 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Tue, 23 Dec 2008 18:14:16 +0000 Subject: [PATCH] fix bugs spotted by clang static analyser. We had some problems with preload and after running LLVM's CLang Static Analyser we found out that current->target could be NULL after loop. Also fixed some GCC and CLang warnings, kudos to these wonderful tools that "Saved The Day". PS: we should put some CLang Static Analyser results so others can help fix other parts of E. SVN revision: 38293 --- legacy/evas/src/lib/cache/evas_cache_image.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/legacy/evas/src/lib/cache/evas_cache_image.c b/legacy/evas/src/lib/cache/evas_cache_image.c index 05cd3407df..230d0afb2f 100644 --- a/legacy/evas/src/lib/cache/evas_cache_image.c +++ b/legacy/evas/src/lib/cache/evas_cache_image.c @@ -870,6 +870,7 @@ evas_cache_image_load_data(Image_Entry *im) assert(im); assert(im->cache); + cache = im->cache; if (im->flags.loaded) return ; @@ -879,8 +880,6 @@ evas_cache_image_load_data(Image_Entry *im) if (im->flags.loaded) return ; #endif - cache = im->cache; - error = cache->func.load(im); if (cache->func.debug) @@ -908,7 +907,8 @@ evas_cache_image_preload_data(Image_Entry *im, const void *target) if (im->flags.loaded) { - evas_async_events_put(target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL, evas_object_event_callback_call); + evas_async_events_put(target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL, + (void (*)(void*, Evas_Callback_Type, void*))evas_object_event_callback_call); return ; } @@ -930,6 +930,7 @@ evas_cache_image_preload_cancel(Image_Entry *im) assert(im); assert(im->cache); + cache = im->cache; _evas_cache_image_entry_preload_remove(cache, im); #else @@ -1023,7 +1024,7 @@ evas_cache_private_set(Evas_Cache_Image *cache, const void *data) { assert(cache); - cache->data = data; + cache->data = (void *)data; } EAPI DATA32 * @@ -1078,11 +1079,13 @@ _evas_cache_background_load(void *data) } current->flags.preload = 0; + + evas_async_events_put(current->target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL, + (void (*)(void*, Evas_Callback_Type, void*))evas_object_event_callback_call); + + current = NULL; } - evas_async_events_put(current->target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL, evas_object_event_callback_call); - - current = NULL; pthread_cond_signal(&cond); }