summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2017-11-28 19:15:05 -0600
committerEmmanuele Bassi <ebassi@gmail.com>2020-01-07 14:23:05 +0000
commit2cb97be60792fc50dc636575fce1a7ae46865f79 (patch)
tree37b5c0d2f1a69bca34213f917335a63c7174001b /gdk-pixbuf
parentdcdd5010a29180f9bf7737046db5eef28b422ea0 (diff)
downloadgdk-pixbuf-2cb97be60792fc50dc636575fce1a7ae46865f79.tar.gz
TGA: assert and assume that the module callbacks are non-NULL
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/io-tga.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index f5ba958fa..52eb0d66b 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -234,9 +234,6 @@ tga_emit_update (TGAContext *ctx)
gint width = gdk_pixbuf_get_width (ctx->pbuf);
gint height = gdk_pixbuf_get_height (ctx->pbuf);
- if (!ctx->updated_func)
- return;
-
/* We only notify row-by-row for now.
* I was too lazy to handle line-breaks.
*/
@@ -357,13 +354,13 @@ static gboolean fill_in_context(TGAContext *ctx, GError **err)
w = LE16(ctx->hdr->width);
h = LE16(ctx->hdr->height);
- if (ctx->size_func) {
+ {
gint wi = w;
gint hi = h;
-
+
(*ctx->size_func) (&wi, &hi, ctx->user_data);
-
- if (wi == 0 || hi == 0)
+
+ if (wi == 0 || hi == 0)
return FALSE;
}
@@ -629,8 +626,7 @@ tga_load_header (TGAContext *ctx,
if (!fill_in_context(ctx, err))
return FALSE;
- if (ctx->prepared_func)
- (*ctx->prepared_func) (ctx->pbuf, NULL, ctx->user_data);
+ (*ctx->prepared_func) (ctx->pbuf, NULL, ctx->user_data);
ctx->process = tga_read_info;
return TRUE;
@@ -643,6 +639,10 @@ static gpointer gdk_pixbuf__tga_begin_load(GdkPixbufModuleSizeFunc size_func,
{
TGAContext *ctx;
+ g_assert (size_func != NULL);
+ g_assert (prepared_func != NULL);
+ g_assert (updated_func != NULL);
+
ctx = g_try_malloc(sizeof(TGAContext));
if (!ctx) {
g_set_error_literal(err, GDK_PIXBUF_ERROR,