From: Włodzimierz Skiba Date: Sun, 17 Oct 2004 21:39:05 +0000 (+0000) Subject: Warning fixes related to various cases of typecasting. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7ac31c429f668e236f4d9686c47b5172f625781c 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 --- diff --git a/src/common/gifdecod.cpp b/src/common/gifdecod.cpp index 189b524305..732557ca3b 100644 --- a/src/common/gifdecod.cpp +++ b/src/common/gifdecod.cpp @@ -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)) { diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 0f3e5756fa..d7cd54a73c 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -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); diff --git a/src/common/imagpcx.cpp b/src/common/imagpcx.cpp index 14a3b0cff6..03364b381e 100644 --- a/src/common/imagpcx.cpp +++ b/src/common/imagpcx.cpp @@ -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 diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 6a4e3d3bce..ef9589c911 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -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') || diff --git a/src/common/quantize.cpp b/src/common/quantize.cpp index b89425443b..37674b2c4b 100644 --- a/src/common/quantize.cpp +++ b/src/common/quantize.cpp @@ -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; diff --git a/src/common/rgncmn.cpp b/src/common/rgncmn.cpp index 2368fbc133..801aaa9e3f 100644 --- a/src/common/rgncmn.cpp +++ b/src/common/rgncmn.cpp @@ -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. diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index e1b62cf09d..69a91e7c60 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -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++; }