diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2017-08-04 15:52:11 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2017-08-17 15:15:10 +0800 |
commit | 7eeab9fa52c6eb1c9c6eaf2c7aa7bb787e21e901 (patch) | |
tree | 8791ba0d1213532736b2088c8b71093ffe12626a | |
parent | c1a8ca5c6536246cb094a1d1eda149a3740e5521 (diff) | |
download | gdk-pixbuf-7eeab9fa52c6eb1c9c6eaf2c7aa7bb787e21e901.tar.gz |
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
-rw-r--r-- | 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 21bffbb1d..9e7137ab3 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)) |