X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7c429142df39ccb1e8a4f68c4e2bb0ab7c2083a..d2b354f9c9f1473b2d6ff0ab643ebf57dcbfb656:/src/common/imagjpeg.cpp?ds=inline diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 23c5e7aa36..b0a4e997e4 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -28,13 +28,14 @@ #include "wx/log.h" #include "wx/app.h" -// NB: Some compilers define boolean type in Windows headers (e.g. Watcom C++). +// NB: Some compilers define boolean type in Windows headers +// (e.g. Watcom C++, but not Open Watcom). // This causes a conflict with jmorecfg.h header from libjpeg, so we have // to make sure libjpeg won't try to define boolean itself. This is done by // defining HAVE_BOOLEAN. -#if defined(__WXMSW__) && (defined(__MWERKS__) || defined(__WATCOMC__)) +#if defined(__WXMSW__) && (defined(__MWERKS__) || defined(__DIGITALMARS__) || (defined(__WATCOMC__) && __WATCOMC__ < 1200)) #define HAVE_BOOLEAN - #include + #include "wx/msw/wrapwin.h" #endif extern "C" @@ -378,9 +379,10 @@ bool wxJPEGHandler::DoCanRead( wxInputStream& stream ) { unsigned char hdr[2]; - stream.Read(hdr, 2); - stream.SeekI(-2, wxFromCurrent); - return (hdr[0] == 0xFF && hdr[1] == 0xD8); + if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) + return FALSE; + + return hdr[0] == 0xFF && hdr[1] == 0xD8; } #endif // wxUSE_STREAMS