fix bugs spotted by clang static analyser.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 23 Dec 2008 18:14:16 +0000 (18:14 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 23 Dec 2008 18:14:16 +0000 (18:14 +0000)
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.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@38293 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/cache/evas_cache_image.c

index 05cd340..230d0af 100644 (file)
@@ -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, evas_object_event_callback_call);
+            evas_async_events_put(current->target, EVAS_CALLBACK_IMAGE_PRELOADED, NULL,
+                                  (void (*)(void*, Evas_Callback_Type, void*))evas_object_event_callback_call);
+
+            current = NULL;
+         }
 
-       current = NULL;
        pthread_cond_signal(&cond);
      }