diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-02-10 19:01:02 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-02-10 19:01:02 +0000 |
commit | 82fd3665ff3750edc9b89eaa327ff80510f25485 (patch) | |
tree | 60c322dc644f437ba46a4a0499923f2cf575ec61 | |
parent | 567eb53e2cf1d7c8ac0a54f0224e4549092f8e78 (diff) | |
download | gdk-pixbuf-82fd3665ff3750edc9b89eaa327ff80510f25485.tar.gz |
Always check for NULL when using callbacks. (#330563, Benjamin Otte)
2006-02-10 Matthias Clasen <mclasen@redhat.com>
* io-jpeg.c:
* io-png.c:
* io-pnm.c:
* io-tiff.c:
* io-xbm.c:
* io-xpm.c: Always check for NULL when using callbacks.
(#330563, Benjamin Otte)
-rw-r--r-- | gdk-pixbuf/ChangeLog | 10 | ||||
-rw-r--r-- | gdk-pixbuf/io-jpeg.c | 20 | ||||
-rw-r--r-- | gdk-pixbuf/io-png.c | 2 | ||||
-rw-r--r-- | gdk-pixbuf/io-pnm.c | 9 | ||||
-rw-r--r-- | gdk-pixbuf/io-tiff.c | 4 | ||||
-rw-r--r-- | gdk-pixbuf/io-xbm.c | 5 | ||||
-rw-r--r-- | gdk-pixbuf/io-xpm.c | 10 |
7 files changed, 38 insertions, 22 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index e8695d446..7ee480fbf 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,13 @@ +2006-02-10 Matthias Clasen <mclasen@redhat.com> + + * io-jpeg.c: + * io-png.c: + * io-pnm.c: + * io-tiff.c: + * io-xbm.c: + * io-xpm.c: Always check for NULL when using callbacks. + (#330563, Benjamin Otte) + 2006-01-25 Matthias Clasen <mclasen@redhat.com> * === Released 2.8.11 === diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index 84376d51b..96b3453b0 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -595,12 +595,13 @@ gdk_pixbuf__jpeg_image_load_lines (JpegProgContext *context, context->dptr += nlines * context->pixbuf->rowstride; /* send updated signal */ - (* context->updated_func) (context->pixbuf, - 0, - cinfo->output_scanline - 1, - cinfo->image_width, - nlines, - context->user_data); + if (context->updated_func) + (* context->updated_func) (context->pixbuf, + 0, + cinfo->output_scanline - 1, + cinfo->image_width, + nlines, + context->user_data); } return TRUE; @@ -745,9 +746,10 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data, context->dptr = context->pixbuf->pixels; /* Notify the client that we are ready to go */ - (* context->prepared_func) (context->pixbuf, - NULL, - context->user_data); + if (context->prepared_func) + (* context->prepared_func) (context->pixbuf, + NULL, + context->user_data); } else if (!context->did_prescan) { int rc; diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c index 25a2bb606..f4e1ba567 100644 --- a/gdk-pixbuf/io-png.c +++ b/gdk-pixbuf/io-png.c @@ -517,7 +517,7 @@ gdk_pixbuf__png_image_load_increment(gpointer context, lc->error = NULL; return FALSE; } else { - if (lc->first_row_seen_in_chunk >= 0) { + if (lc->first_row_seen_in_chunk >= 0 && lc->update_func) { /* We saw at least one row */ gint pass_diff = lc->last_pass_seen_in_chunk - lc->first_pass_seen_in_chunk; diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c index 81e50a7f7..81225740a 100644 --- a/gdk-pixbuf/io-pnm.c +++ b/gdk-pixbuf/io-pnm.c @@ -1015,9 +1015,10 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, context->rowstride = context->pixbuf->rowstride; /* Notify the client that we are ready to go */ - (* context->prepared_func) (context->pixbuf, - NULL, - context->user_data); + if (context->prepared_func) + (* context->prepared_func) (context->pixbuf, + NULL, + context->user_data); } /* if we got here we're reading image data */ @@ -1028,7 +1029,7 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, break; } else if (retval == PNM_FATAL_ERR) { return FALSE; - } else if (retval == PNM_OK) { + } else if (retval == PNM_OK && context->updated_func) { /* send updated signal */ (* context->updated_func) (context->pixbuf, 0, diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index e874e4d91..4e8136790 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -238,7 +238,7 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error) return NULL; } - if (context) + if (context && context->prepare_func) (* context->prepare_func) (pixbuf, NULL, context->user_data); #if TIFFLIB_VERSION >= 20031226 @@ -324,7 +324,7 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error) _TIFFfree (rast); } - if (context) + if (context && context->update_func) (* context->update_func) (pixbuf, 0, 0, width, height, context->user_data); return pixbuf; diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c index 9d808703e..90d8120a1 100644 --- a/gdk-pixbuf/io-xbm.c +++ b/gdk-pixbuf/io-xbm.c @@ -309,7 +309,7 @@ gdk_pixbuf__xbm_image_load_real (FILE *f, XBMData *context, GError **error) pixels = gdk_pixbuf_get_pixels (pixbuf); row_stride = gdk_pixbuf_get_rowstride (pixbuf); - if (context) + if (context && context->prepare_func) (* context->prepare_func) (pixbuf, NULL, context->user_data); @@ -338,7 +338,8 @@ gdk_pixbuf__xbm_image_load_real (FILE *f, XBMData *context, GError **error) g_free (data); if (context) { - (* context->update_func) (pixbuf, 0, 0, w, h, context->user_data); + if (context->update_func) + (* context->update_func) (pixbuf, 0, 0, w, h, context->user_data); g_object_unref (pixbuf); pixbuf = NULL; } diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c index 7f020cd96..3357aab4b 100644 --- a/gdk-pixbuf/io-xpm.c +++ b/gdk-pixbuf/io-xpm.c @@ -738,10 +738,12 @@ gdk_pixbuf__xpm_image_stop_load (gpointer data, pixbuf = gdk_pixbuf__xpm_image_load (context->file, error); if (pixbuf != NULL) { - (* context->prepare_func) (pixbuf, - NULL, - context->user_data); - (* context->update_func) (pixbuf, 0, 0, pixbuf->width, pixbuf->height, context->user_data); + if (context->prepare_func) + (* context->prepare_func) (pixbuf, + NULL, + context->user_data); + if (context->update_func) + (* context->update_func) (pixbuf, 0, 0, pixbuf->width, pixbuf->height, context->user_data); g_object_unref (pixbuf); retval = TRUE; |