]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/xpmdecod.cpp
fixedb ug with normalization of UNC paths (patch 558701)
[wxWidgets.git] / src / common / xpmdecod.cpp
index 73ce1f5d4b769336ba6abb3a98944d25bc9c88aa..264f1d1cf3d89e781521e667f71b72e9a38a5135 100644 (file)
@@ -126,10 +126,12 @@ bool wxXPMDecoder::CanRead(wxInputStream& stream)
 {
     unsigned char buf[9];
 
-    stream.Read(buf, 9);
-    stream.SeekI(-9, wxFromCurrent);
+    if ( !stream.Read(buf, WXSIZEOF(buf)) )
+        return FALSE;
 
-    return (memcmp(buf, "/* XPM */", 9) == 0);
+    stream.SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent);
+
+    return memcmp(buf, "/* XPM */", WXSIZEOF(buf)) == 0;
 }
 
 wxImage wxXPMDecoder::ReadFile(wxInputStream& stream)