]> git.saurik.com Git - wxWidgets.git/commitdiff
Warning fixes related to various cases of typecasting.
authorWłodzimierz Skiba <abx@abx.art.pl>
Sun, 17 Oct 2004 21:39:05 +0000 (21:39 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Sun, 17 Oct 2004 21:39:05 +0000 (21:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/gifdecod.cpp
src/common/imagjpeg.cpp
src/common/imagpcx.cpp
src/common/imagtiff.cpp
src/common/quantize.cpp
src/common/rgncmn.cpp
src/common/xpmdecod.cpp

index 189b52430513e79594855a98b3e9a5d9ef10d2bd..732557ca3b2d7fa1c623fa8f95a92ae27dcee8d4 100644 (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))
                 {
index 0f3e5756fa2e1df80a9ea65387a29d4976885c1e..d7cd54a73c863488a946f48b10c11d27b79d06cc 100644 (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);
index 14a3b0cff6424030c6efb168e58dacb55cf41b06..03364b381e99bccf447ee41f7eadc01bc8bd0ec3 100644 (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
index 6a4e3d3bce04425caa6abbd3a6e325a296354264..ef9589c911dbe43e8ab19e3fdb4bda7349d62987 100644 (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') ||
index b89425443b09312c0db78989249839a05b4b178e..37674b2c4b40a8e078d5cab68d55bc7c9cbd64ad 100644 (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;
index 2368fbc13376581da968c9e7a21156a6a19abe34..801aaa9e3f9286da27f65cfabaea6ae9776a25cc 100644 (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.
index e1b62cf09d63c21de40bed0f01b84057a3616567..69a91e7c600c7ea3d6ac9c890c34875e085ed79d 100644 (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++;
     }