diff options
author | Federico Mena Quintero <federico@gnome.org> | 2017-11-28 19:26:10 -0600 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2020-01-07 14:23:05 +0000 |
commit | 344a74e012ebdae5842b99dabd7c20174c08077d (patch) | |
tree | 7994924ab74dc2a357c8f9139f4e195feac0580c /gdk-pixbuf | |
parent | c8be25b84c6e3c4191b93a7843a181d8ba7b06aa (diff) | |
download | gdk-pixbuf-344a74e012ebdae5842b99dabd7c20174c08077d.tar.gz |
PNG: assert and assume that the module callbacks are non-NULL
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r-- | gdk-pixbuf/io-png.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c index e39b1ecb7..4e99536bf 100644 --- a/gdk-pixbuf/io-png.c +++ b/gdk-pixbuf/io-png.c @@ -449,6 +449,10 @@ gdk_pixbuf__png_image_begin_load (GdkPixbufModuleSizeFunc size_func, { LoadContext* lc; + g_assert (size_func != NULL); + g_assert (prepare_func != NULL); + g_assert (update_func != NULL); + lc = g_new0(LoadContext, 1); lc->fatal_error_occurred = FALSE; @@ -597,9 +601,8 @@ gdk_pixbuf__png_image_load_increment(gpointer context, lc->error = NULL; return FALSE; } else { - if (lc->first_row_seen_in_chunk >= 0 && lc->update_func) { + if (lc->first_row_seen_in_chunk >= 0) { gint width = gdk_pixbuf_get_width (lc->pixbuf); - /* We saw at least one row */ gint pass_diff = lc->last_pass_seen_in_chunk - lc->first_pass_seen_in_chunk; @@ -687,7 +690,7 @@ png_info_callback (png_structp png_read_ptr, if (color_type & PNG_COLOR_MASK_ALPHA) have_alpha = TRUE; - if (lc->size_func) { + { gint w = width; gint h = height; (* lc->size_func) (&w, &h, lc->notify_user_data); @@ -758,8 +761,7 @@ png_info_callback (png_structp png_read_ptr, /* Notify the client that we are ready to go */ - if (lc->prepare_func) - (* lc->prepare_func) (lc->pixbuf, NULL, lc->notify_user_data); + (* lc->prepare_func) (lc->pixbuf, NULL, lc->notify_user_data); return; } |