[gdk-pixbuf] TGA: assert and assume that the module callbacks are non-NULL
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] TGA: assert and assume that the module callbacks are non-NULL
- Date: Tue, 7 Jan 2020 14:30:38 +0000 (UTC)
commit 2cb97be60792fc50dc636575fce1a7ae46865f79
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Nov 28 19:15:05 2017 -0600
TGA: assert and assume that the module callbacks are non-NULL
gdk-pixbuf/io-tga.c | 18 +++++++++---------
1 file 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]