]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagjpeg.cpp
Make EquivalentEncodings 3-dimensional array const, moving 864 bytes from data segmen...
[wxWidgets.git] / src / common / imagjpeg.cpp
index 7e4dcedfba3da2ab2c512c4bb1b25db96a4bbfc4..6a475f70bf757953468346b60788f445d68af7b9 100644 (file)
@@ -163,12 +163,22 @@ CPP_METHODDEF(void) wx_error_exit (j_common_ptr cinfo)
 
   /* Always display the message. */
   /* We could postpone this until after returning, if we chose. */
-  if (cinfo->err->output_message) (*cinfo->err->output_message) (cinfo);
+  (*cinfo->err->output_message) (cinfo);
 
   /* Return control to the setjmp point */
   longjmp(myerr->setjmp_buffer, 1);
 }
 
+/*
+ * This will replace the standard output_message method when the user
+ * wants us to be silent (verbose==false). We must have such method instead of
+ * simply using NULL for cinfo->err->output_message because it's called
+ * unconditionally from within libjpeg when there's "garbage input".
+ */
+CPP_METHODDEF(void) wx_ignore_message (j_common_ptr WXUNUSED(cinfo))
+{
+}
+
 void wx_jpeg_io_src( j_decompress_ptr cinfo, wxInputStream& infile )
 {
     wx_src_ptr src;
@@ -210,7 +220,8 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
     cinfo.err = jpeg_std_error( &jerr.pub );
     jerr.pub.error_exit = wx_error_exit;
 
-    if (!verbose) cinfo.err->output_message=NULL;
+    if (!verbose)
+        cinfo.err->output_message = wx_ignore_message;
 
     /* Establish the setjmp return context for wx_error_exit to use. */
     if (setjmp(jerr.setjmp_buffer)) {
@@ -323,7 +334,8 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
     cinfo.err = jpeg_std_error(&jerr.pub);
     jerr.pub.error_exit = wx_error_exit;
 
-    if (!verbose) cinfo.err->output_message=NULL;
+    if (!verbose)
+        cinfo.err->output_message = wx_ignore_message;
 
     /* Establish the setjmp return context for wx_error_exit to use. */
     if (setjmp(jerr.setjmp_buffer))