X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bdffd806c3441e1d640c445ff785f5f1ea10298d..a9cb577a6f19ea0d3bf0d59c988df9e002b29110:/src/common/imagpng.cpp diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 9320f2f371..b1fea3c1fe 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -418,9 +418,10 @@ bool wxPNGHandler::DoCanRead( wxInputStream& stream ) { unsigned char hdr[4]; - stream.Read(hdr, 4); - stream.SeekI(-4, wxFromCurrent); - return (hdr[0] == 0x89 && hdr[1] == 'P' && hdr[2] == 'N' && hdr[3] == 'G'); + if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) + return FALSE; + + return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0; } #endif // wxUSE_STREAMS