[gdk-pixbuf] tests: Fix build on pre-C99



commit 7eeab9fa52c6eb1c9c6eaf2c7aa7bb787e21e901
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Aug 4 15:52:11 2017 +0800

    tests: Fix build on pre-C99
    
    Ensure variables are declared at the top of the block.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785767

 tests/pixbuf-short-gif-write.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/tests/pixbuf-short-gif-write.c b/tests/pixbuf-short-gif-write.c
index 21bffbb..9e7137a 100644
--- a/tests/pixbuf-short-gif-write.c
+++ b/tests/pixbuf-short-gif-write.c
@@ -35,11 +35,13 @@ loader_write_from_channel (GdkPixbufLoader *loader,
 static void
 test_short_gif_write (void)
 {
+    GdkPixbufLoader *loader;
     GIOChannel* channel = g_io_channel_new_file (g_test_get_filename (G_TEST_DIST, "test-animation.gif", 
NULL), "r", NULL);
+
     g_assert (channel != NULL);
     g_io_channel_set_encoding (channel, NULL, NULL);
 
-    GdkPixbufLoader *loader = gdk_pixbuf_loader_new_with_type ("gif", NULL);
+    loader = gdk_pixbuf_loader_new_with_type ("gif", NULL);
     g_assert (loader != NULL);
 
     loader_write_from_channel (loader, channel, 10);
@@ -58,17 +60,20 @@ test_load_first_frame (void)
     gboolean has_frame = FALSE;
     GError *error = NULL;
     GdkPixbuf *pixbuf;
+    GdkPixbufLoader *loader;
 
     channel = g_io_channel_new_file (g_test_get_filename (G_TEST_DIST, "1_partyanimsm2.gif", NULL), "r", 
NULL);
     g_assert (channel != NULL);
     g_io_channel_set_encoding (channel, NULL, NULL);
 
-    GdkPixbufLoader *loader = gdk_pixbuf_loader_new_with_type ("gif", NULL);
+    loader = gdk_pixbuf_loader_new_with_type ("gif", NULL);
     g_assert (loader != NULL);
 
     while (!has_frame) {
+        GdkPixbufAnimation *animation;
+
         loader_write_from_channel (loader, channel, 4096);
-        GdkPixbufAnimation *animation = gdk_pixbuf_loader_get_animation (loader);
+        animation = gdk_pixbuf_loader_get_animation (loader);
         if (animation) {
             GdkPixbufAnimationIter *iter = gdk_pixbuf_animation_get_iter (animation, NULL);
             if (!gdk_pixbuf_animation_iter_on_currently_loading_frame (iter))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]