diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-02-10 19:02:38 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-02-10 19:02:38 +0000 |
commit | d47f64aca9b64eb0002fb2d758e6628544ffa2c4 (patch) | |
tree | b54dfffaf8ffcee043cbcf5adf561430183c3cb1 /gdk-pixbuf | |
parent | adce3190f19ddd1cc6b0afc83dbc2a9f13e74d75 (diff) | |
download | gdk-pixbuf-d47f64aca9b64eb0002fb2d758e6628544ffa2c4.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)
Diffstat (limited to 'gdk-pixbuf')
-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 08f86164f..e75a29083 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-18 Matthias Clasen <mclasen@redhat.com> * io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't cast 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 deab99ae1..f662c07da 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; |