]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagpng.cpp
Allow building wxProtocol without wxUSE_SOCKETS
[wxWidgets.git] / src / common / imagpng.cpp
index 9320f2f371911893fcffd07b9416f0501038c7f4..b1fea3c1fef766158cb0cdeb0d153db1d0dbb2d8 100644 (file)
@@ -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