]> git.saurik.com Git - wxWidgets.git/commitdiff
Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW...
authorWłodzimierz Skiba <abx@abx.art.pl>
Wed, 6 Oct 2004 20:21:57 +0000 (20:21 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Wed, 6 Oct 2004 20:21:57 +0000 (20:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetime.cpp
src/common/strconv.cpp
src/msw/accel.cpp
src/msw/bitmap.cpp
src/msw/dc.cpp
src/msw/dialup.cpp
src/msw/dib.cpp
src/msw/font.cpp
src/msw/gsocket.cpp
src/msw/window.cpp

index c8f8b2aea594b0d27ea827801f36b7f6596b510d..e2194fb5743d971f078198279bb2a0eb61da6922 100644 (file)
@@ -536,10 +536,10 @@ wxDateTime::Tm::Tm(const struct tm& tm, const TimeZone& tz)
               : m_tz(tz)
 {
     msec = 0;
-    sec = tm.tm_sec;
-    min = tm.tm_min;
-    hour = tm.tm_hour;
-    mday = tm.tm_mday;
+    sec = (wxDateTime::wxDateTime_t)tm.tm_sec;
+    min = (wxDateTime::wxDateTime_t)tm.tm_min;
+    hour = (wxDateTime::wxDateTime_t)tm.tm_hour;
+    mday = (wxDateTime::wxDateTime_t)tm.tm_mday;
     mon = (wxDateTime::Month)tm.tm_mon;
     year = 1900 + tm.tm_year;
     wday = tm.tm_wday;
@@ -597,7 +597,7 @@ void wxDateTime::Tm::AddDays(int dayDiff)
         dayDiff += GetNumOfDaysInMonth(year, mon);
     }
 
-    mday += dayDiff;
+    mday = (wxDateTime::wxDateTime_t)( mday + dayDiff );
     while ( mday > GetNumOfDaysInMonth(year, mon) )
     {
         mday -= GetNumOfDaysInMonth(year, mon);
@@ -1873,7 +1873,7 @@ bool wxDateTime::SetToWeekDay(WeekDay weekday,
 static inline
 wxDateTime::wxDateTime_t GetDayOfYearFromTm(const wxDateTime::Tm& tm)
 {
-    return gs_cumulatedDays[wxDateTime::IsLeapYear(tm.year)][tm.mon] + tm.mday;
+    return (wxDateTime::wxDateTime_t)(gs_cumulatedDays[wxDateTime::IsLeapYear(tm.year)][tm.mon] + tm.mday);
 }
 
 wxDateTime::wxDateTime_t wxDateTime::GetDayOfYear(const TimeZone& tz) const
@@ -1941,7 +1941,7 @@ wxDateTime::GetWeekOfYear(wxDateTime::WeekFlags flags, const TimeZone& tz) const
         }
     }
 
-    return week;
+    return (wxDateTime::wxDateTime_t)week;
 }
 
 wxDateTime::wxDateTime_t wxDateTime::GetWeekOfMonth(wxDateTime::WeekFlags flags,
@@ -2467,11 +2467,11 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date)
         return (wxChar *)NULL;
     }
 
-    wxDateTime_t day = *p++ - _T('0');
+    wxDateTime_t day = (wxDateTime_t)(*p++ - _T('0'));
     if ( wxIsdigit(*p) )
     {
         day *= 10;
-        day += *p++ - _T('0');
+        day = (wxDateTime_t)(day + (*p++ - _T('0')));
     }
 
     if ( *p++ != _T(' ') )
@@ -3392,19 +3392,23 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
     {
         wxString date = wxGetTranslation(literalDates[n].str);
         size_t len = date.length();
-        if ( wxStrlen(p) >= len && (wxString(p, len).CmpNoCase(date) == 0) )
+        if ( wxStrlen(p) >= len )
         {
-            // nothing can follow this, so stop here
-            p += len;
-
-            int dayDiffFromToday = literalDates[n].dayDiffFromToday;
-            *this = Today();
-            if ( dayDiffFromToday )
+            wxString str(p, len);
+            if ( str.CmpNoCase(date) == 0 )
             {
-                *this += wxDateSpan::Days(dayDiffFromToday);
-            }
+                // nothing can follow this, so stop here
+                p += len;
+
+                int dayDiffFromToday = literalDates[n].dayDiffFromToday;
+                *this = Today();
+                if ( dayDiffFromToday )
+                {
+                    *this += wxDateSpan::Days(dayDiffFromToday);
+                }
 
-            return p;
+                return p;
+            }
         }
     }
 
index 395c2535ee4d25a922cd34a6edd423f13abe22a6..667874bdef8db342ce46944c06718b8cbd25979a 100644 (file)
@@ -1190,8 +1190,8 @@ public:
         // it doesn't work with CJK encodings (which we test for rather roughly
         // here...) nor with UTF-7/8 nor, of course, with Windows versions not
         // supporting it
-        BOOL usedDef wxDUMMY_INITIALIZE(false),
-             *pUsedDef;
+        BOOL usedDef wxDUMMY_INITIALIZE(false);
+        BOOL *pUsedDef;
         int flags;
         if ( CanUseNoBestFit() && m_CodePage < 50000 )
         {
@@ -1769,7 +1769,7 @@ size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const
         {
             if (psz[c] > 0xFF)
                 return (size_t)-1;
-            buf[c] = psz[c];
+            buf[c] = (char)psz[c];
         }
     }
     else
index a918d7fff3a770dea885ecc1a7a20aad8a1fc001..cad9c19c303fa9fce28914540d21626ede79facd 100644 (file)
@@ -114,7 +114,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
 
         bool isVirtual;
 
-        WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
+        WORD key = (WORD)wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
         if (isVirtual)
             fVirt |= FVIRTKEY;
 
index b80b7989d97afe296f5ef25b48f36d6ab379d1c1..16e23a409d65d294e32017c7f847838774e42f64 100644 (file)
@@ -426,7 +426,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
                 for ( int bits = 0; bits < 8; bits++)
                 {
                     reversed <<= 1;
-                    reversed |= (val & 0x01);
+                    reversed |= (unsigned char)(val & 0x01);
                     val >>= 1;
                 }
                 *dst++ = reversed;
@@ -1031,7 +1031,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
 #ifndef __WXMICROWIN__
     // handle alpha channel, if any
     if (HasAlpha())
-       ret.UseAlpha();
+    ret.UseAlpha();
 
     // copy bitmap data
     MemoryHDC dcSrc,
index 51b2ebb921a87ab47af6bba007935d18e79c3612..c6f000a7963437eac8594c2deb605d0754ef1e72 100644 (file)
@@ -2461,6 +2461,7 @@ static bool AlphaBlt(HDC hdcDst,
 #else // !wxHAVE_RAW_BITMAP
     // no wxAlphaBlend() neither, fall back to using simple BitBlt() (we lose
     // alpha but at least something will be shown like this)
+    wxUnusedVar(bmp);
     return false;
 #endif // wxHAVE_RAW_BITMAP
 }
index ac394e26abbed071e420a633916c6fd4e774e436..97eaaef176d97dd1793d2e50767e1cb915294e30 100644 (file)
@@ -460,7 +460,7 @@ wxString wxDialUpManagerMSW::GetErrorString(DWORD error)
 
         case 0:
             // we want the error message to start from a lower case letter
-            buffer[0] = wxTolower(buffer[0]);
+            buffer[0] = (wxChar)wxTolower(buffer[0]);
 
             return wxString(buffer);
     }
index 285fd9142e72074743bc68fa28ce79bb68ea347c..0589ec323ec4d7a1907a9e635f8c9c87c9d30815 100644 (file)
@@ -69,7 +69,7 @@ static inline WORD GetNumberOfColours(WORD bitsPerPixel)
 {
     // only 1, 4 and 8bpp bitmaps use palettes (well, they could be used with
     // 24bpp ones too but we don't support this as I think it's quite uncommon)
-    return bitsPerPixel <= 8 ? 1 << bitsPerPixel : 0;
+    return (WORD)(bitsPerPixel <= 8 ? 1 << bitsPerPixel : 0);
 }
 
 // wrapper around ::GetObject() for DIB sections
@@ -674,9 +674,9 @@ bool wxDIB::Create(const wxImage& image)
                 // RGB order is reversed, and we need to premultiply
                 // all channels by alpha value for use with ::AlphaBlend.
                 const unsigned char a = *alpha++;
-                *dst++ = (src[2] * a + 127) / 255;
-                *dst++ = (src[1] * a + 127) / 255;
-                *dst++ = (src[0] * a + 127) / 255;
+                *dst++ = (unsigned char)((src[2] * a + 127) / 255);
+                *dst++ = (unsigned char)((src[1] * a + 127) / 255);
+                *dst++ = (unsigned char)((src[0] * a + 127) / 255);
                 *dst++ = a;
                 src += 3;
             }
index d87bdd0821ea09a08a8174d90c3c935cc1dd7522..d79b4b74a691bc9b81cffdec94b9e81b999cf1ea 100644 (file)
@@ -165,10 +165,10 @@ public:
         return m_nativeFontInfoOk ? m_nativeFontInfo.GetPixelSize()
                                   : m_pixelSize;
     }
-    
+
     bool IsUsingSizeInPixels() const
     {
-        return m_nativeFontInfoOk ? TRUE : m_sizeUsingPixels;
+        return m_nativeFontInfoOk ? true : m_sizeUsingPixels;
     }
 
     int GetFamily() const
@@ -1041,8 +1041,8 @@ bool wxFont::IsFixedWidth() const
     {
         // the two low-order bits specify the pitch of the font, the rest is
         // family
-        BYTE pitch = M_FONTDATA->GetNativeFontInfo().
-                        lf.lfPitchAndFamily & PITCH_MASK;
+        BYTE pitch =
+            (BYTE)(M_FONTDATA->GetNativeFontInfo().lf.lfPitchAndFamily & PITCH_MASK);
 
         return pitch == FIXED_PITCH;
     }
index 620ad39cbfc9542d4d89ccadcdbda6579e8ed38c..fbe81c4a01a5c512d83af7f1f054e7d0c70af71d 100644 (file)
@@ -1528,24 +1528,15 @@ GSocketError _GAddress_Init_UNIX(GAddress *address)
   return GSOCK_INVADDR;
 }
 
-GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path)
+GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *WXUNUSED(path))
 {
-#if defined(__BORLANDC__)
-  /* prevents unused variable message in Borland */
-  (void)path;
-#endif
   assert (address != NULL);
   address->m_error = GSOCK_INVADDR;
   return GSOCK_INVADDR;
 }
 
-GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf)
+GSocketError GAddress_UNIX_GetPath(GAddress *address, char *WXUNUSED(path), size_t WXUNUSED(sbuf))
 {
-#if defined(__BORLANDC__)
-  /* prevents unused variable message in Borland */
-  (void)path;
-  (void)sbuf;
-#endif
   assert (address != NULL);
   address->m_error = GSOCK_INVADDR;
   return GSOCK_INVADDR;
index 1daf19b5e9355e4a3a1bcaaed6a57da938daaeee..7daffb9b2a23be52787819e70ebd618a39cfddb9 100644 (file)
@@ -4134,7 +4134,8 @@ bool wxWindowMSW::HandleMaximize()
 
 bool wxWindowMSW::HandleMove(int x, int y)
 {
-    wxMoveEvent event(wxPoint(x, y), m_windowId);
+    wxPoint point(x,y);
+    wxMoveEvent event(point, m_windowId);
     event.SetEventObject(this);
 
     return GetEventHandler()->ProcessEvent(event);
@@ -4708,7 +4709,7 @@ int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam)
                         // FIXME-UNICODE: this comparison doesn't risk to work
                         // for non ASCII accelerator characters I'm afraid, but
                         // what can we do?
-                        if ( wxToupper(*p) == (wchar_t)chAccel )
+                        if ( (wchar_t)wxToupper(*p) == (wchar_t)chAccel )
                         {
                             return i;
                         }