summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2017-11-28 19:07:50 -0600
committerEmmanuele Bassi <ebassi@gmail.com>2020-01-07 14:23:05 +0000
commitab792e3768536705f9dd379cd12faf78f770aff8 (patch)
tree190abd584dc0b530418dce20d4fa40d9cabdcdc5 /gdk-pixbuf
parent017330de95a54eb2e1cd87428c3099208f7e0262 (diff)
downloadgdk-pixbuf-ab792e3768536705f9dd379cd12faf78f770aff8.tar.gz
Never pass NULL for the size_func and updated_func of module->begin_load()
This will let us avoid NULL checks in the individual modules.
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/gdk-pixbuf-animation.c19
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c19
2 files changed, 36 insertions, 2 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c
index 66a037c20..c8f2695e3 100644
--- a/gdk-pixbuf/gdk-pixbuf-animation.c
+++ b/gdk-pixbuf/gdk-pixbuf-animation.c
@@ -106,6 +106,13 @@ gdk_pixbuf_animation_init (GdkPixbufAnimation *animation)
}
static void
+noop_size_notify (gint *width,
+ gint *height,
+ gpointer data)
+{
+}
+
+static void
prepared_notify (GdkPixbuf *pixbuf,
GdkPixbufAnimation *anim,
gpointer user_data)
@@ -118,6 +125,16 @@ prepared_notify (GdkPixbuf *pixbuf,
*((GdkPixbufAnimation **)user_data) = anim;
}
+static void
+noop_updated_notify (GdkPixbuf *pixbuf,
+ int x,
+ int y,
+ int width,
+ int height,
+ gpointer user_data)
+{
+}
+
/**
* gdk_pixbuf_animation_new_from_file:
* @filename: (type filename): Name of file to load, in the GLib file
@@ -221,7 +238,7 @@ gdk_pixbuf_animation_new_from_file (const gchar *filename,
animation = NULL;
fseek (f, 0, SEEK_SET);
- context = image_module->begin_load (NULL, prepared_notify, NULL, &animation, error);
+ context = image_module->begin_load (noop_size_notify, prepared_notify, noop_updated_notify, &animation, error);
if (!context)
goto fail_begin_load;
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 17ceb59df..ce0ed633f 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -1007,6 +1007,13 @@ _gdk_pixbuf_get_module_for_file (FILE *f, const gchar *filename, GError **error)
}
static void
+noop_size_notify (gint *width,
+ gint *height,
+ gpointer data)
+{
+}
+
+static void
prepared_notify (GdkPixbuf *pixbuf,
GdkPixbufAnimation *anim,
gpointer user_data)
@@ -1016,13 +1023,23 @@ prepared_notify (GdkPixbuf *pixbuf,
*((GdkPixbuf **)user_data) = pixbuf;
}
+static void
+noop_updated_notify (GdkPixbuf *pixbuf,
+ int x,
+ int y,
+ int width,
+ int height,
+ gpointer user_data)
+{
+}
+
static GdkPixbuf *
generic_load_incrementally (GdkPixbufModule *module, FILE *f, GError **error)
{
GdkPixbuf *pixbuf = NULL;
gpointer context;
- context = module->begin_load (NULL, prepared_notify, NULL, &pixbuf, error);
+ context = module->begin_load (noop_size_notify, prepared_notify, noop_updated_notify, &pixbuf, error);
if (!context)
goto out;