summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2017-11-29 07:04:16 -0600
committerEmmanuele Bassi <ebassi@gmail.com>2020-01-07 14:23:05 +0000
commit31ac03720ff35e91ebd36db02a0e970bfde5a800 (patch)
tree6239d62066c1f5e1b69c30f7dec605c5a4115f8e /gdk-pixbuf
parent70f230b1ea57aaf1bce4d8c2d502fe46b4912a2a (diff)
downloadgdk-pixbuf-31ac03720ff35e91ebd36db02a0e970bfde5a800.tar.gz
QTIF: assert and assume that the module callbacks are non-NULL
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/io-qtif.c58
1 files changed, 22 insertions, 36 deletions
diff --git a/gdk-pixbuf/io-qtif.c b/gdk-pixbuf/io-qtif.c
index 79fd4ffa9..aaa483611 100644
--- a/gdk-pixbuf/io-qtif.c
+++ b/gdk-pixbuf/io-qtif.c
@@ -256,6 +256,10 @@ static gpointer gdk_pixbuf__qtif_image_begin_load (GdkPixbufModuleSizeFunc size_
{
QTIFContext *context;
+ g_assert (size_func != NULL);
+ g_assert (prepare_func != NULL);
+ g_assert (update_func != NULL);
+
/* Create context struct. */
context = g_new0(QTIFContext, 1);
if(context == NULL)
@@ -329,24 +333,15 @@ static gboolean gdk_pixbuf__qtif_image_create_loader (QTIFContext *context, GErr
/* Connect signals. */
context->cb_prepare_count = 0;
context->cb_update_count = 0;
- if(context->size_func != NULL)
- {
- g_signal_connect(context->loader, "size-prepared",
- G_CALLBACK(gdk_pixbuf__qtif_cb_size_prepared),
- context);
- }
- if(context->prepare_func != NULL)
- {
- g_signal_connect(context->loader, "area-prepared",
- G_CALLBACK(gdk_pixbuf__qtif_cb_area_prepared),
- context);
- }
- if(context->update_func != NULL)
- {
- g_signal_connect(context->loader, "area-updated",
- G_CALLBACK(gdk_pixbuf__qtif_cb_area_updated),
- context);
- }
+ g_signal_connect(context->loader, "size-prepared",
+ G_CALLBACK(gdk_pixbuf__qtif_cb_size_prepared),
+ context);
+ g_signal_connect(context->loader, "area-prepared",
+ G_CALLBACK(gdk_pixbuf__qtif_cb_area_prepared),
+ context);
+ g_signal_connect(context->loader, "area-updated",
+ G_CALLBACK(gdk_pixbuf__qtif_cb_area_updated),
+ context);
return TRUE;
}
@@ -384,12 +379,12 @@ static gboolean gdk_pixbuf__qtif_image_free_loader (QTIFContext *context, GError
if(pixbuf != NULL)
{
/* Callback functions should be called for at least once. */
- if((context->prepare_func != NULL) && (context->cb_prepare_count == 0))
+ if(context->cb_prepare_count == 0)
{
(context->prepare_func)(pixbuf, NULL, context->user_data);
}
- if((context->update_func != NULL) && (context->cb_update_count == 0))
+ if(context->cb_update_count == 0)
{
gint width;
gint height;
@@ -542,22 +537,16 @@ static void gdk_pixbuf__qtif_cb_size_prepared(GdkPixbufLoader *loader,
gpointer user_data)
{
QTIFContext *context = (QTIFContext *)user_data;
- if((context != NULL) && (context->size_func != NULL))
- {
- (context->size_func)(&width, &height, context->user_data);
- context->cb_prepare_count++;
- }
+ (context->size_func)(&width, &height, context->user_data);
+ context->cb_prepare_count++;
}
static void gdk_pixbuf__qtif_cb_area_prepared(GdkPixbufLoader *loader, gpointer user_data)
{
QTIFContext *context = (QTIFContext *)user_data;
- if((loader != NULL) && (context != NULL) && (context->prepare_func != NULL))
- {
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
- (context->prepare_func)(pixbuf, NULL, context->user_data);
- context->cb_update_count++;
- }
+ GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
+ (context->prepare_func)(pixbuf, NULL, context->user_data);
+ context->cb_update_count++;
}
static void gdk_pixbuf__qtif_cb_area_updated(GdkPixbufLoader *loader,
@@ -568,11 +557,8 @@ static void gdk_pixbuf__qtif_cb_area_updated(GdkPixbufLoader *loader,
gpointer user_data)
{
QTIFContext *context = (QTIFContext *)user_data;
- if((loader != NULL) && (context != NULL) && (context->update_func != NULL))
- {
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
- (context->update_func)(pixbuf, x, y, width, height, context->user_data);
- }
+ GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
+ (context->update_func)(pixbuf, x, y, width, height, context->user_data);
}