summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2017-11-28 19:19:16 -0600
committerEmmanuele Bassi <ebassi@gmail.com>2020-01-07 14:23:05 +0000
commit0723e2727576219d074b9bbd05dba65565c3001e (patch)
tree5622964b52291c131357a445406ec7d0ba356196 /gdk-pixbuf
parentcfb2f43e9f8e89004fd9cb5a581357ce3eb79a7b (diff)
downloadgdk-pixbuf-0723e2727576219d074b9bbd05dba65565c3001e.tar.gz
BMP: assert and assume that the module callbacks are non-NULL
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/io-bmp.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c
index 4c3ad626a..a68794b76 100644
--- a/gdk-pixbuf/io-bmp.c
+++ b/gdk-pixbuf/io-bmp.c
@@ -440,7 +440,7 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
int rowstride;
gboolean has_alpha;
- if (State->size_func) {
+ {
gint width = State->Header.width;
gint height = State->Header.height;
@@ -500,9 +500,8 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
return FALSE;
}
- if (State->prepared_func != NULL)
- /* Notify the client that we are ready to go */
- (*State->prepared_func) (State->pixbuf, NULL, State->user_data);
+ /* Notify the client that we are ready to go */
+ (*State->prepared_func) (State->pixbuf, NULL, State->user_data);
/* make all pixels initially transparent */
if (State->Compressed == BI_RLE4 || State->Compressed == BI_RLE8) {
@@ -728,6 +727,10 @@ gdk_pixbuf__bmp_image_begin_load(GdkPixbufModuleSizeFunc size_func,
{
struct bmp_progressive_state *context;
+ g_assert (size_func != NULL);
+ g_assert (prepared_func != NULL);
+ g_assert (updated_func != NULL);
+
context = g_new0(struct bmp_progressive_state, 1);
context->size_func = size_func;
context->prepared_func = prepared_func;
@@ -1059,17 +1062,15 @@ static void OneLine(struct bmp_progressive_state *context)
context->Lines++;
- if (context->updated_func != NULL) {
- (*context->updated_func) (context->pixbuf,
- 0,
- (context->Header.Negative ?
- (context->Lines - 1) :
- (context->Header.height - context->Lines)),
- context->Header.width,
- 1,
- context->user_data);
+ (*context->updated_func) (context->pixbuf,
+ 0,
+ (context->Header.Negative ?
+ (context->Lines - 1) :
+ (context->Header.height - context->Lines)),
+ context->Header.width,
+ 1,
+ context->user_data);
- }
}
#define NEUTRAL 0
@@ -1222,18 +1223,15 @@ DoCompressed(struct bmp_progressive_state *context, GError **error)
break;
}
}
- if (context->updated_func != NULL) {
- if (context->compr.y > y)
- {
- gint new_y = MIN (context->compr.y, context->Header.height);
- (*context->updated_func) (context->pixbuf,
- 0,
- context->Header.height - new_y,
- context->Header.width,
- new_y - y,
- context->user_data);
- }
+ if (context->compr.y > y) {
+ gint new_y = MIN (context->compr.y, context->Header.height);
+ (*context->updated_func) (context->pixbuf,
+ 0,
+ context->Header.height - new_y,
+ context->Header.width,
+ new_y - y,
+ context->user_data);
}
context->BufferDone = 0;