X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f4fc7967b595ea8257696baff78e1866511223d..c97e7fa8dbda704c9c9cdb61c22ebdf9b692e114:/src/common/imagbmp.cpp diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 5819bd7ec6..9f92b3c8fc 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -18,6 +18,10 @@ #pragma hdrstop #endif +#include "wx/defs.h" + +#if wxUSE_IMAGE + #include "wx/imagbmp.h" #include "wx/bitmap.h" #include "wx/debug.h" @@ -383,7 +387,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose if (bpp == 1) { int bit = 0; - for (bit = 0; bit < 8; bit++) + for (bit = 0; bit < 8 && column < width; bit++) { index = ((aByte & (0x80 >> bit)) ? 1 : 0); ptr[poffset] = cmap[index].r; @@ -405,7 +409,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose else { int nibble = 0; - for (nibble = 0; nibble < 2; nibble++) + for (nibble = 0; nibble < 2 && column < width; nibble++) { index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4)); if (index >= 16) @@ -461,7 +465,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose } else { - for (int l = 0; l < first; l++) + for (int l = 0; l < first && column < width; l++) { ptr[poffset ] = cmap[aByte].r; ptr[poffset + 1] = cmap[aByte].g; @@ -546,4 +550,4 @@ bool wxBMPHandler::DoCanRead( wxInputStream& stream ) #endif // wxUSE_STREAMS - +#endif // wxUSE_IMAGE