X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7c429142df39ccb1e8a4f68c4e2bb0ab7c2083a..008a56c968ed7e0694e32e93c2dbf95dde2ba5c8:/src/common/imagjpeg.cpp?ds=sidebyside diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 23c5e7aa36..c2525bae43 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -378,9 +378,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