X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39d16996b7616bf8090b140db74fd0b52d50d169..f1e269209afbcbec4e46ab5df4ba43d902a6bf2f:/src/common/xpmdecod.cpp diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index 264f1d1cf3..c6e10441c9 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -90,7 +90,7 @@ license is as follows: * in this Software without prior written authorization from GROUPE BULL. */ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "xpmdecod.h" #endif @@ -115,9 +115,7 @@ license is as follows: #include "wx/intl.h" #include -#ifdef __VISUALC__ #include -#endif #include "wx/xpmdecod.h" @@ -145,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'; @@ -490,6 +488,7 @@ static rgbRecord theRGBRecords[] = {"seagreen", myRGB(82, 149, 132)}, {"seashell", myRGB(255, 245, 238)}, {"sienna", myRGB(150, 82, 45)}, + {"silver", myRGB(192, 192, 192)}, {"skyblue", myRGB(114, 159, 255)}, {"slateblue", myRGB(126, 136, 171)}, {"slategray", myRGB(112, 128, 144)}, @@ -510,7 +509,7 @@ static rgbRecord theRGBRecords[] = {"yellowgreen", myRGB(50, 216, 56)}, {NULL, myRGB(0, 0, 0)} }; -static int numTheRGBRecords = 234; +static int numTheRGBRecords = 235; static unsigned char ParseHexadecimal(char digit1, char digit2) { @@ -659,7 +658,7 @@ struct wxXPMColourMapData { unsigned char R,G,B; }; -WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap) +WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap); wxImage wxXPMDecoder::ReadData(const char **xpm_data) { @@ -759,6 +758,12 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data) if ( entry == end ) { wxLogError(_("XPM: Malformed pixel data!")); + + // better return right now as otherwise we risk to flood the + // user with error messages as something seems to be seriously + // wrong with the file and so we could give this message for + // each remaining pixel if we don't bail out + return wxNullImage; } else {