Fix Unix build by avoiding the use of BITMAPINFOHEADER struct

The code from the previous commit used sizeof(BITMAPINFOHEADER), but
this struct is only defined under MSW, so this broke the build under the
other platforms.

Luckily, we don't actually need the struct itself, but just its size, so
simply hardcode it here as it's fixed (part of the BMP format) and not
going to change.

See #18634.
This commit is contained in:
Vadim Zeitlin
2019-12-28 02:19:54 +01:00
parent cccda9ef6b
commit ca065c5004

View File

@@ -1159,9 +1159,13 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
// We've read BITMAPINFOHEADER data but for BITMAPV4HEADER or BITMAPV5HEADER
// we have to forward stream position to after the actual bitmap header.
if ( hdrSize > sizeof(BITMAPINFOHEADER) )
//
// Note: hardcode its size as struct BITMAPINFOHEADER is not defined on
// non-MSW platforms.
const size_t sizeBITMAPINFOHEADER = 40;
if ( hdrSize > sizeBITMAPINFOHEADER )
{
if ( stream.SeekI(hdrSize - sizeof(BITMAPINFOHEADER), wxFromCurrent) == wxInvalidOffset )
if ( stream.SeekI(hdrSize - sizeBITMAPINFOHEADER, wxFromCurrent) == wxInvalidOffset )
return false;
}
}