[gdk-pixbuf] ICO: assert and assume that the module callbacks are non-NULL



commit 70f230b1ea57aaf1bce4d8c2d502fe46b4912a2a
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 29 06:59:00 2017 -0600

    ICO: assert and assume that the module callbacks are non-NULL

 gdk-pixbuf/io-ico.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 8dca76ae4..5d4fa6592 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -510,7 +510,7 @@ static void DecodeHeader(guchar *Data, gint Bytes,
 
 
        if (State->pixbuf == NULL) {
-               if (State->size_func) {
+               {
                        gint width = State->Header.width;
                        gint height = State->Header.height;
 
@@ -540,12 +540,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
                        gdk_pixbuf_set_option (State->pixbuf, "y_hot", hot);
                }
 
-               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);
        }
 
 }
@@ -565,6 +563,10 @@ gdk_pixbuf__ico_image_begin_load(GdkPixbufModuleSizeFunc size_func,
 {
        struct ico_progressive_state *context;
 
+       g_assert (size_func != NULL);
+       g_assert (prepared_func != NULL);
+       g_assert (updated_func != NULL);
+
        context = g_new0(struct ico_progressive_state, 1);
        context->size_func = size_func;
        context->prepared_func = prepared_func;
@@ -887,7 +889,7 @@ static void OneLine(struct ico_progressive_state *context)
                        context->LineWidth = (context->LineWidth / 4) * 4 + 4;
        }
 
-       if (context->updated_func != NULL) {
+       {
                int y;
 
                y = context->Lines % context->Header.height;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]