Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW and DMC.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-10-06 20:21:57 +00:00
parent c0c997853f
commit 907173e51d
10 changed files with 44 additions and 47 deletions

View File

@@ -536,10 +536,10 @@ wxDateTime::Tm::Tm(const struct tm& tm, const TimeZone& tz)
: m_tz(tz) : m_tz(tz)
{ {
msec = 0; msec = 0;
sec = tm.tm_sec; sec = (wxDateTime::wxDateTime_t)tm.tm_sec;
min = tm.tm_min; min = (wxDateTime::wxDateTime_t)tm.tm_min;
hour = tm.tm_hour; hour = (wxDateTime::wxDateTime_t)tm.tm_hour;
mday = tm.tm_mday; mday = (wxDateTime::wxDateTime_t)tm.tm_mday;
mon = (wxDateTime::Month)tm.tm_mon; mon = (wxDateTime::Month)tm.tm_mon;
year = 1900 + tm.tm_year; year = 1900 + tm.tm_year;
wday = tm.tm_wday; wday = tm.tm_wday;
@@ -597,7 +597,7 @@ void wxDateTime::Tm::AddDays(int dayDiff)
dayDiff += GetNumOfDaysInMonth(year, mon); dayDiff += GetNumOfDaysInMonth(year, mon);
} }
mday += dayDiff; mday = (wxDateTime::wxDateTime_t)( mday + dayDiff );
while ( mday > GetNumOfDaysInMonth(year, mon) ) while ( mday > GetNumOfDaysInMonth(year, mon) )
{ {
mday -= GetNumOfDaysInMonth(year, mon); mday -= GetNumOfDaysInMonth(year, mon);
@@ -1873,7 +1873,7 @@ bool wxDateTime::SetToWeekDay(WeekDay weekday,
static inline static inline
wxDateTime::wxDateTime_t GetDayOfYearFromTm(const wxDateTime::Tm& tm) 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 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, wxDateTime::wxDateTime_t wxDateTime::GetWeekOfMonth(wxDateTime::WeekFlags flags,
@@ -2467,11 +2467,11 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date)
return (wxChar *)NULL; return (wxChar *)NULL;
} }
wxDateTime_t day = *p++ - _T('0'); wxDateTime_t day = (wxDateTime_t)(*p++ - _T('0'));
if ( wxIsdigit(*p) ) if ( wxIsdigit(*p) )
{ {
day *= 10; day *= 10;
day += *p++ - _T('0'); day = (wxDateTime_t)(day + (*p++ - _T('0')));
} }
if ( *p++ != _T(' ') ) if ( *p++ != _T(' ') )
@@ -3392,7 +3392,10 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
{ {
wxString date = wxGetTranslation(literalDates[n].str); wxString date = wxGetTranslation(literalDates[n].str);
size_t len = date.length(); size_t len = date.length();
if ( wxStrlen(p) >= len && (wxString(p, len).CmpNoCase(date) == 0) ) if ( wxStrlen(p) >= len )
{
wxString str(p, len);
if ( str.CmpNoCase(date) == 0 )
{ {
// nothing can follow this, so stop here // nothing can follow this, so stop here
p += len; p += len;
@@ -3407,6 +3410,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
return p; return p;
} }
} }
}
// We try to guess what we have here: for each new (numeric) token, we // We try to guess what we have here: for each new (numeric) token, we
// determine if it can be a month, day or a year. Of course, there is an // determine if it can be a month, day or a year. Of course, there is an

View File

@@ -1190,8 +1190,8 @@ public:
// it doesn't work with CJK encodings (which we test for rather roughly // 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 // here...) nor with UTF-7/8 nor, of course, with Windows versions not
// supporting it // supporting it
BOOL usedDef wxDUMMY_INITIALIZE(false), BOOL usedDef wxDUMMY_INITIALIZE(false);
*pUsedDef; BOOL *pUsedDef;
int flags; int flags;
if ( CanUseNoBestFit() && m_CodePage < 50000 ) 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) if (psz[c] > 0xFF)
return (size_t)-1; return (size_t)-1;
buf[c] = psz[c]; buf[c] = (char)psz[c];
} }
} }
else else

View File

@@ -114,7 +114,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
bool isVirtual; bool isVirtual;
WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual); WORD key = (WORD)wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
if (isVirtual) if (isVirtual)
fVirt |= FVIRTKEY; fVirt |= FVIRTKEY;

View File

@@ -426,7 +426,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
for ( int bits = 0; bits < 8; bits++) for ( int bits = 0; bits < 8; bits++)
{ {
reversed <<= 1; reversed <<= 1;
reversed |= (val & 0x01); reversed |= (unsigned char)(val & 0x01);
val >>= 1; val >>= 1;
} }
*dst++ = reversed; *dst++ = reversed;

View File

@@ -2461,6 +2461,7 @@ static bool AlphaBlt(HDC hdcDst,
#else // !wxHAVE_RAW_BITMAP #else // !wxHAVE_RAW_BITMAP
// no wxAlphaBlend() neither, fall back to using simple BitBlt() (we lose // no wxAlphaBlend() neither, fall back to using simple BitBlt() (we lose
// alpha but at least something will be shown like this) // alpha but at least something will be shown like this)
wxUnusedVar(bmp);
return false; return false;
#endif // wxHAVE_RAW_BITMAP #endif // wxHAVE_RAW_BITMAP
} }

View File

@@ -460,7 +460,7 @@ wxString wxDialUpManagerMSW::GetErrorString(DWORD error)
case 0: case 0:
// we want the error message to start from a lower case letter // 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); return wxString(buffer);
} }

View 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 // 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) // 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 // 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 // RGB order is reversed, and we need to premultiply
// all channels by alpha value for use with ::AlphaBlend. // all channels by alpha value for use with ::AlphaBlend.
const unsigned char a = *alpha++; const unsigned char a = *alpha++;
*dst++ = (src[2] * a + 127) / 255; *dst++ = (unsigned char)((src[2] * a + 127) / 255);
*dst++ = (src[1] * a + 127) / 255; *dst++ = (unsigned char)((src[1] * a + 127) / 255);
*dst++ = (src[0] * a + 127) / 255; *dst++ = (unsigned char)((src[0] * a + 127) / 255);
*dst++ = a; *dst++ = a;
src += 3; src += 3;
} }

View File

@@ -168,7 +168,7 @@ public:
bool IsUsingSizeInPixels() const bool IsUsingSizeInPixels() const
{ {
return m_nativeFontInfoOk ? TRUE : m_sizeUsingPixels; return m_nativeFontInfoOk ? true : m_sizeUsingPixels;
} }
int GetFamily() const 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 // the two low-order bits specify the pitch of the font, the rest is
// family // family
BYTE pitch = M_FONTDATA->GetNativeFontInfo(). BYTE pitch =
lf.lfPitchAndFamily & PITCH_MASK; (BYTE)(M_FONTDATA->GetNativeFontInfo().lf.lfPitchAndFamily & PITCH_MASK);
return pitch == FIXED_PITCH; return pitch == FIXED_PITCH;
} }

View File

@@ -1528,24 +1528,15 @@ GSocketError _GAddress_Init_UNIX(GAddress *address)
return GSOCK_INVADDR; 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); assert (address != NULL);
address->m_error = GSOCK_INVADDR; address->m_error = GSOCK_INVADDR;
return 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); assert (address != NULL);
address->m_error = GSOCK_INVADDR; address->m_error = GSOCK_INVADDR;
return GSOCK_INVADDR; return GSOCK_INVADDR;

View File

@@ -4134,7 +4134,8 @@ bool wxWindowMSW::HandleMaximize()
bool wxWindowMSW::HandleMove(int x, int y) 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); event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
@@ -4708,7 +4709,7 @@ int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam)
// FIXME-UNICODE: this comparison doesn't risk to work // FIXME-UNICODE: this comparison doesn't risk to work
// for non ASCII accelerator characters I'm afraid, but // for non ASCII accelerator characters I'm afraid, but
// what can we do? // what can we do?
if ( wxToupper(*p) == (wchar_t)chAccel ) if ( (wchar_t)wxToupper(*p) == (wchar_t)chAccel )
{ {
return i; return i;
} }