[gthumb/gthumb-3-6] jpeg: set the error only once



commit 50a6924eda223ac9589cf9e1a52b3238647f844c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Sep 20 11:52:57 2018 +0200

    jpeg: set the error only once

 extensions/cairo_io/cairo-image-surface-jpeg.c | 28 ++++++++++----------------
 1 file changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/extensions/cairo_io/cairo-image-surface-jpeg.c b/extensions/cairo_io/cairo-image-surface-jpeg.c
index f61d5e0f..b626ad79 100644
--- a/extensions/cairo_io/cairo-image-surface-jpeg.c
+++ b/extensions/cairo_io/cairo-image-surface-jpeg.c
@@ -48,34 +48,28 @@ static void
 fatal_error_handler (j_common_ptr cinfo)
 {
        struct error_handler_data *errmgr;
-        char buffer[JMSG_LENGTH_MAX];
 
        errmgr = (struct error_handler_data *) cinfo->err;
+       if ((errmgr->error != NULL) && (*errmgr->error == NULL)) {
+               char buffer[JMSG_LENGTH_MAX];
 
-        /* Create the message */
-        (* cinfo->err->format_message) (cinfo, buffer);
+               /* Create the message */
+               (* cinfo->err->format_message) (cinfo, buffer);
 
-        /* broken check for *error == NULL for robustness against
-         * crappy JPEG library
-         */
-        if (errmgr->error && *errmgr->error == NULL) {
-                g_set_error (errmgr->error,
-                             GDK_PIXBUF_ERROR,
-                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+               g_set_error (errmgr->error,
+                            GDK_PIXBUF_ERROR,
+                            GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                             _("Error interpreting JPEG image file: %s"),
-                             buffer);
-        }
-
-       siglongjmp (errmgr->setjmp_buffer, 1);
-
-        g_assert_not_reached ();
+                            buffer);
+               siglongjmp (errmgr->setjmp_buffer, 1);
+       }
 }
 
 
 static void
 output_message_handler (j_common_ptr cinfo)
 {
-       /* This method keeps libjpeg from dumping crap to stderr */
+       /* This method keeps libjpeg from dumping text to stderr */
        /* do nothing */
 }
 


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