[gdk-pixbuf] BMP: 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] BMP: assert and assume that the module callbacks are non-NULL
- Date: Tue, 7 Jan 2020 14:30:48 +0000 (UTC)
commit 0723e2727576219d074b9bbd05dba65565c3001e
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Nov 28 19:19:16 2017 -0600
BMP: assert and assume that the module callbacks are non-NULL
gdk-pixbuf/io-bmp.c | 48 +++++++++++++++++++++++-------------------------
1 file 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]