From ca065c500436679fc4c15d2170716df24dcfd1ab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Dec 2019 02:19:54 +0100 Subject: [PATCH] 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. --- src/common/imagbmp.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 634e7816af..c478f0ccff 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -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; } }