else if ( (format == wxBMP_8BPP_GREY) || (format == wxBMP_8BPP_RED) ||
(format == wxBMP_1BPP_BW) )
{
- int i;
rgbquad = new wxUint8 [palette_size*4];
- for (i = 0; i < palette_size; i++)
+ for ( int i = 0; i < palette_size; i++ )
{
- // if 1BPP_BW then just 0 and 255 then exit
- if (( i > 0) && (format == wxBMP_1BPP_BW)) i = 255;
- rgbquad[i*4] = rgbquad[i*4+1] = rgbquad[i*4+2] = (wxUint8)i;
+ // if 1BPP_BW then the value should be either 0 or 255
+ wxUint8 c = (i > 0) && (format == wxBMP_1BPP_BW) ? 255 : i;
+
+ rgbquad[i*4] =
+ rgbquad[i*4+1] =
+ rgbquad[i*4+2] = c;
rgbquad[i*4+3] = 0;
}
}
offset = offset + wxINT32_SWAP_ON_BE(dbuf[2]);
stream.Read(dbuf, 4 * 2);
- int width = (int)wxINT32_SWAP_ON_BE(dbuf[0]);
- int height = (int)wxINT32_SWAP_ON_BE(dbuf[1]);
+ int width = wxINT32_SWAP_ON_BE((int)dbuf[0]);
+ int height = wxINT32_SWAP_ON_BE((int)dbuf[1]);
if ( !IsBmp)height = height / 2; // for icons divide by 2
if ( width > 32767 )
int planes = (int)wxUINT16_SWAP_ON_BE( aWord );
*/
stream.Read(&aWord, 2);
- int bpp = (int)wxUINT16_SWAP_ON_BE(aWord);
+ int bpp = wxUINT16_SWAP_ON_BE((int)aWord);
if ( bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32 )
{
if (verbose)
}
stream.Read(dbuf, 4 * 4);
- int comp = (int)wxINT32_SWAP_ON_BE(dbuf[0]);
+ int comp = wxINT32_SWAP_ON_BE((int)dbuf[0]);
if ( comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 &&
comp != BI_BITFIELDS )
{
}
stream.Read(dbuf, 4 * 2);
- int ncolors = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
+ int ncolors = wxINT32_SWAP_ON_BE( (int)dbuf[0] );
if (ncolors == 0)
ncolors = 1 << bpp;
/* some more sanity checks */
ICONDIR IconDir;
IconDir.idReserved = 0;
- IconDir.idType = (WORD)wxUINT16_SWAP_ON_BE(type);
- IconDir.idCount = (WORD)wxUINT16_SWAP_ON_BE(images);
+ IconDir.idType = wxUINT16_SWAP_ON_BE((wxUint16)type);
+ IconDir.idCount = wxUINT16_SWAP_ON_BE((wxUint16)images);
stream.Write(&IconDir.idReserved, sizeof(IconDir.idReserved));
stream.Write(&IconDir.idType, sizeof(IconDir.idType));
stream.Write(&IconDir.idCount, sizeof(IconDir.idCount));
offset = offset + sizeof(ICONDIRENTRY);
- icondirentry.bWidth = (BYTE)image->GetWidth();
- icondirentry.bHeight = (BYTE)(2 * image->GetHeight());
+ icondirentry.bWidth = (wxUint8)image->GetWidth();
+ icondirentry.bHeight = (wxUint8)(2 * image->GetHeight());
icondirentry.bColorCount = 0;
icondirentry.bReserved = 0;
icondirentry.wPlanes = wxUINT16_SWAP_ON_BE(1);