template<typename T>
inline bool ReadHeader(FILE* fp, T& header)
{
- unsigned int readLength = sizeof(T);
+ const unsigned int readLength = sizeof(T);
// Load the information directly into our structure
- if (fread((void*)&header, 1, readLength, fp) != readLength)
+ if ( fread( &header, 1, readLength, fp ) != readLength )
{
return false;
}
width = infoHeader.width;
height = abs(infoHeader.height);
+ if( infoHeader.width == 0 )
+ {
+ return false;
+ }
+
return true;
}
{
pixels = bitmap.GetPackedPixelsProfile()->ReserveBuffer(pixelFormat, infoHeader.width, infoHeader.height);
}
+ else
+ {
+ pixelBufferW = infoHeader.width;
+ pixelBufferH = infoHeader.height;
+ newPixelFormat = pixelFormat;
+ }
break;
}
}
case BMP_RGB4:
{
- decodeResult = DecodeRGB4(fp, pixels, infoHeader.width, infoHeader.height, 14 + infoHeader.infoHeaderSize, topDown);
+ decodeResult = DecodeRGB4(fp, pixels, infoHeader.width, abs(infoHeader.height), 14 + infoHeader.infoHeaderSize, topDown);
break;
}
case BMP_RLE4: