Warning fixes related to various cases of typecasting.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-10-17 21:39:05 +00:00
parent 804cd2075d
commit 7ac31c429f
7 changed files with 20 additions and 18 deletions

View File

@@ -906,8 +906,8 @@ int wxGIFDecoder::ReadGIF()
if ((buf[8] & 0x80) == 0x80)
{
ncolors = 2 << (buf[8] & 0x07);
off_t pos = m_f->TellI();
off_t numBytes = 3 * ncolors;
wxFileOffset pos = m_f->TellI();
wxFileOffset numBytes = 3 * ncolors;
m_f->SeekI(numBytes, wxFromCurrent);
if (m_f->TellI() != (pos + numBytes))
{

View File

@@ -363,7 +363,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
if (image->HasOption(wxIMAGE_OPTION_RESOLUTION))
{
cinfo.X_density =
cinfo.Y_density = image->GetOptionInt(wxIMAGE_OPTION_RESOLUTION);
cinfo.Y_density = (UINT16)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTION);
}
// sets the resolution unit field in the output file
@@ -371,7 +371,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
// wxIMAGE_RESOLUTION_CM for centimeters
if (image->HasOption(wxIMAGE_OPTION_RESOLUTIONUNIT))
{
cinfo.density_unit = image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT);
cinfo.density_unit = (UINT8)image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT);
}
jpeg_start_compress(&cinfo, TRUE);

View File

@@ -318,7 +318,7 @@ int SavePCX(wxImage *image, wxOutputStream& stream)
unsigned char *src; // pointer into wxImage data
unsigned int width, height; // size of the image
unsigned int bytesperline; // bytes per line (each plane)
int nplanes = 3; // number of planes
unsigned char nplanes = 3; // number of planes
int format = wxPCX_24BIT; // image format (8 bit, 24 bit)
wxImageHistogram histogram; // image histogram
unsigned long key; // key in the hashtable

View File

@@ -398,7 +398,7 @@ bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
{
unsigned char hdr[2];
if ( !stream.Read(&hdr, WXSIZEOF(hdr)) )
if ( !stream.Read(&hdr[0], WXSIZEOF(hdr)) )
return false;
return (hdr[0] == 'I' && hdr[1] == 'I') ||

View File

@@ -77,7 +77,9 @@
typedef unsigned short UINT16;
typedef signed short INT16;
#ifndef __WATCOMC__
typedef signed int INT32;
#endif
typedef unsigned char JSAMPLE;
typedef JSAMPLE *JSAMPROW;
@@ -1569,7 +1571,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest,
// We need to shift the palette entries up
// to make room for the Windows system colours.
for (i = 0; i < w * h; i++)
data8bit[i] = data8bit[i] + paletteShift;
data8bit[i] = (unsigned char)(data8bit[i] + paletteShift);
}
#endif
*eightBitData = data8bit;

View File

@@ -60,9 +60,9 @@ static bool DoRegionUnion(wxRegion& region,
{
unsigned char hiR, hiG, hiB;
hiR = wxMin(0xFF, loR + tolerance);
hiG = wxMin(0xFF, loG + tolerance);
hiB = wxMin(0xFF, loB + tolerance);
hiR = (unsigned char)wxMin(0xFF, loR + tolerance);
hiG = (unsigned char)wxMin(0xFF, loG + tolerance);
hiB = (unsigned char)wxMin(0xFF, loB + tolerance);
// Loop through the image row by row, pixel by pixel, building up
// rectangles to add to the region.

View File

@@ -515,18 +515,18 @@ static unsigned char ParseHexadecimal(char digit1, char digit2)
unsigned char i1, i2;
if (digit1 >= 'a')
i1 = digit1 - 'a' + 0x0A;
i1 = (unsigned char)(digit1 - 'a' + 0x0A);
else if (digit1 >= 'A')
i1 = digit1 - 'A' + 0x0A;
i1 = (unsigned char)(digit1 - 'A' + 0x0A);
else
i1 = digit1 - '0';
i1 = (unsigned char)(digit1 - '0');
if (digit2 >= 'a')
i2 = digit2 - 'a' + 0x0A;
i2 = (unsigned char)(digit2 - 'a' + 0x0A);
else if (digit2 >= 'A')
i2 = digit2 - 'A' + 0x0A;
i2 = (unsigned char)(digit2 - 'A' + 0x0A);
else
i2 = digit2 - '0';
return (0x10 * i1 + i2);
i2 = (unsigned char)(digit2 - '0');
return (unsigned char)(0x10 * i1 + i2);
}
static bool GetRGBFromName(const char *inname, bool *isNone,
@@ -568,7 +568,7 @@ static bool GetRGBFromName(const char *inname, bool *isNone,
p = name;
while (*p)
{
*p = tolower(*p);
*p = (char)tolower(*p);
p++;
}