X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/73ef393701bd6c2c689a05d5637cc701e2f5cc2f..0ba344c712c77e4a6c7b94263b6f39ab22069039:/src/common/xpmdecod.cpp diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index 73ce1f5d4b..1dc78c95d2 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -115,9 +115,7 @@ license is as follows: #include "wx/intl.h" #include -#ifdef __VISUALC__ #include -#endif #include "wx/xpmdecod.h" @@ -126,10 +124,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; + + stream.SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent); - return (memcmp(buf, "/* XPM */", 9) == 0); + return memcmp(buf, "/* XPM */", WXSIZEOF(buf)) == 0; } wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) @@ -143,7 +143,7 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) wxCharBuffer buffer(length); char *xpm_buffer = (char *)buffer.data(); - if ( stream.Read(xpm_buffer, length).LastError() == wxSTREAM_READ_ERROR ) + if ( stream.Read(xpm_buffer, length).GetLastError() == wxSTREAM_READ_ERROR ) return wxNullImage; xpm_buffer[length] = '\0';