diff options
author | Federico Mena Quintero <federico@gnome.org> | 2017-11-28 19:24:30 -0600 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2020-01-07 14:23:05 +0000 |
commit | c8be25b84c6e3c4191b93a7843a181d8ba7b06aa (patch) | |
tree | 888bcb86e282af5c011272e5d2900070988041ab | |
parent | 6f986ba6ccb6a9bb17f18eddc99b613e12c4a31a (diff) | |
download | gdk-pixbuf-c8be25b84c6e3c4191b93a7843a181d8ba7b06aa.tar.gz |
PNM: assert and assume that the module callbacks are non-NULL
-rw-r--r-- | gdk-pixbuf/io-pnm.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c index d6f3e216c..91e7dca67 100644 --- a/gdk-pixbuf/io-pnm.c +++ b/gdk-pixbuf/io-pnm.c @@ -824,6 +824,10 @@ gdk_pixbuf__pnm_image_begin_load (GdkPixbufModuleSizeFunc size_func, { PnmLoaderContext *context; + g_assert (size_func != NULL); + g_assert (prepared_func != NULL); + g_assert (updated_func != NULL); + context = g_try_malloc (sizeof (PnmLoaderContext)); if (!context) { g_set_error_literal (error, GDK_PIXBUF_ERROR, @@ -954,7 +958,7 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, context->got_header = TRUE; } - if (context->size_func) { + { gint w = context->width; gint h = context->height; (*context->size_func) (&w, &h, context->user_data); @@ -1015,10 +1019,9 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, context->rowstride = gdk_pixbuf_get_rowstride (context->pixbuf); /* Notify the client that we are ready to go */ - if (context->prepared_func) - (* context->prepared_func) (context->pixbuf, - NULL, - context->user_data); + (* context->prepared_func) (context->pixbuf, + NULL, + context->user_data); } /* if we got here we're reading image data */ @@ -1029,7 +1032,7 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, break; } else if (retval == PNM_FATAL_ERR) { return FALSE; - } else if (retval == PNM_OK && context->updated_func) { + } else if (retval == PNM_OK) { /* send updated signal */ (* context->updated_func) (context->pixbuf, 0, |