#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
-#include "wx/defs.h"
-
#if wxUSE_IMAGE && wxUSE_LIBJPEG
#include "wx/imagjpeg.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/app.h"
+ #include "wx/intl.h"
+#endif
+
#include "wx/bitmap.h"
#include "wx/debug.h"
-#include "wx/log.h"
-#include "wx/app.h"
// NB: Some compilers define boolean type in Windows headers
// (e.g. Watcom C++, but not Open Watcom).
#include "wx/filefn.h"
#include "wx/wfstream.h"
-#include "wx/intl.h"
#include "wx/module.h"
// For memcpy
/* 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;
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)) {
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))