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@29736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -40,26 +40,27 @@
|
||||
*/
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
#define wxPRE_NO_WARNING_SCOPE for(int i=0;i<1;i++)
|
||||
#define wxPOST_NO_WARNING_SCOPE
|
||||
#define wxFOR_ONCE(name) for(int name=0; name<1; name++)
|
||||
#define wxPRE_NO_WARNING_SCOPE(name) wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name))
|
||||
#define wxPOST_NO_WARNING_SCOPE(name)
|
||||
#else
|
||||
#define wxPRE_NO_WARNING_SCOPE do
|
||||
#define wxPOST_NO_WARNING_SCOPE while ( 0 )
|
||||
#define wxPRE_NO_WARNING_SCOPE(name) do
|
||||
#define wxPOST_NO_WARNING_SCOPE(name) while ( 0 )
|
||||
#endif
|
||||
|
||||
#define wxCHECKED_DELETE(ptr) \
|
||||
wxPRE_NO_WARNING_SCOPE \
|
||||
wxPRE_NO_WARNING_SCOPE(scope_var1) \
|
||||
{ \
|
||||
typedef char complete[sizeof(*ptr)]; \
|
||||
delete ptr; \
|
||||
} wxPOST_NO_WARNING_SCOPE
|
||||
} wxPOST_NO_WARNING_SCOPE(scope_var1)
|
||||
|
||||
#define wxCHECKED_DELETE_ARRAY(ptr) \
|
||||
wxPRE_NO_WARNING_SCOPE \
|
||||
wxPRE_NO_WARNING_SCOPE(scope_var2) \
|
||||
{ \
|
||||
typedef char complete[sizeof(*ptr)]; \
|
||||
delete [] ptr; \
|
||||
} wxPOST_NO_WARNING_SCOPE
|
||||
} wxPOST_NO_WARNING_SCOPE(scope_var2)
|
||||
|
||||
/* These scoped pointers are *not* assignable and cannot be used
|
||||
within a container. Look for wxDECLARE_SHARED_PTR for this
|
||||
|
@@ -383,7 +383,7 @@ void wxPrintData::ConvertToNative()
|
||||
|
||||
//// Orientation
|
||||
|
||||
devMode->dmOrientation = m_printOrientation;
|
||||
devMode->dmOrientation = (short)m_printOrientation;
|
||||
|
||||
//// Collation
|
||||
|
||||
@@ -392,7 +392,7 @@ void wxPrintData::ConvertToNative()
|
||||
|
||||
//// Number of copies
|
||||
|
||||
devMode->dmCopies = m_printNoCopies;
|
||||
devMode->dmCopies = (short)m_printNoCopies;
|
||||
devMode->dmFields |= DM_COPIES;
|
||||
|
||||
//// Printer name
|
||||
@@ -418,8 +418,8 @@ void wxPrintData::ConvertToNative()
|
||||
if (m_paperId == wxPAPER_NONE)
|
||||
{
|
||||
// DEVMODE is in tenths of a milimeter
|
||||
devMode->dmPaperWidth = m_paperSize.x * 10;
|
||||
devMode->dmPaperLength = m_paperSize.y * 10;
|
||||
devMode->dmPaperWidth = (short)(m_paperSize.x * 10);
|
||||
devMode->dmPaperLength = (short)(m_paperSize.y * 10);
|
||||
devMode->dmPaperSize = DMPAPER_USER;
|
||||
devMode->dmFields |= DM_PAPERWIDTH;
|
||||
devMode->dmFields |= DM_PAPERLENGTH;
|
||||
@@ -431,7 +431,7 @@ void wxPrintData::ConvertToNative()
|
||||
wxPrintPaperType* paper = wxThePrintPaperDatabase->FindPaperType(m_paperId);
|
||||
if (paper)
|
||||
{
|
||||
devMode->dmPaperSize = paper->GetPlatformId();
|
||||
devMode->dmPaperSize = (short)paper->GetPlatformId();
|
||||
devMode->dmFields |= DM_PAPERSIZE;
|
||||
}
|
||||
}
|
||||
@@ -439,43 +439,43 @@ void wxPrintData::ConvertToNative()
|
||||
|
||||
//// Duplex
|
||||
|
||||
int duplex;
|
||||
short duplex;
|
||||
switch (m_duplexMode)
|
||||
{
|
||||
case wxDUPLEX_HORIZONTAL: {
|
||||
duplex = DMDUP_HORIZONTAL; break;
|
||||
}
|
||||
case wxDUPLEX_VERTICAL: {
|
||||
duplex = DMDUP_VERTICAL; break;
|
||||
}
|
||||
case wxDUPLEX_HORIZONTAL:
|
||||
duplex = DMDUP_HORIZONTAL;
|
||||
break;
|
||||
case wxDUPLEX_VERTICAL:
|
||||
duplex = DMDUP_VERTICAL;
|
||||
break;
|
||||
default:
|
||||
case wxDUPLEX_SIMPLEX: {
|
||||
duplex = DMDUP_SIMPLEX; break;
|
||||
}
|
||||
// in fact case wxDUPLEX_SIMPLEX:
|
||||
duplex = DMDUP_SIMPLEX;
|
||||
break;
|
||||
}
|
||||
devMode->dmDuplex = duplex;
|
||||
devMode->dmFields |= DM_DUPLEX;
|
||||
|
||||
//// Quality
|
||||
|
||||
int quality;
|
||||
short quality;
|
||||
switch (m_printQuality)
|
||||
{
|
||||
case wxPRINT_QUALITY_MEDIUM: {
|
||||
quality = DMRES_MEDIUM; break;
|
||||
}
|
||||
case wxPRINT_QUALITY_LOW: {
|
||||
quality = DMRES_LOW; break;
|
||||
}
|
||||
case wxPRINT_QUALITY_DRAFT: {
|
||||
quality = DMRES_DRAFT; break;
|
||||
}
|
||||
case wxPRINT_QUALITY_HIGH: {
|
||||
quality = DMRES_HIGH; break;
|
||||
}
|
||||
default: {
|
||||
quality = m_printQuality; break;
|
||||
}
|
||||
case wxPRINT_QUALITY_MEDIUM:
|
||||
quality = DMRES_MEDIUM;
|
||||
break;
|
||||
case wxPRINT_QUALITY_LOW:
|
||||
quality = DMRES_LOW;
|
||||
break;
|
||||
case wxPRINT_QUALITY_DRAFT:
|
||||
quality = DMRES_DRAFT;
|
||||
break;
|
||||
case wxPRINT_QUALITY_HIGH:
|
||||
quality = DMRES_HIGH;
|
||||
break;
|
||||
default:
|
||||
quality = (short)m_printQuality;
|
||||
break;
|
||||
}
|
||||
devMode->dmPrintQuality = quality;
|
||||
devMode->dmFields |= DM_PRINTQUALITY;
|
||||
@@ -499,7 +499,7 @@ void wxPrintData::ConvertToNative()
|
||||
case wxPRINTBIN_FORMSOURCE: devMode->dmDefaultSource = DMBIN_FORMSOURCE; break;
|
||||
|
||||
default:
|
||||
devMode->dmDefaultSource = DMBIN_USER + m_bin - wxPRINTBIN_USER;
|
||||
devMode->dmDefaultSource = (short)(DMBIN_USER + m_bin - wxPRINTBIN_USER);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -255,7 +255,7 @@ void wxColourDatabase::Initialize()
|
||||
static const struct wxColourDesc
|
||||
{
|
||||
const wxChar *name;
|
||||
int r,g,b;
|
||||
unsigned char r,g,b;
|
||||
}
|
||||
wxColourTable[] =
|
||||
{
|
||||
|
@@ -178,7 +178,7 @@ void wxFindReplaceDialogImpl::InitString(const wxString& str,
|
||||
|
||||
*ppStr = new wxChar[len];
|
||||
wxStrcpy(*ppStr, str);
|
||||
*pLen = len;
|
||||
*pLen = (WORD)len;
|
||||
}
|
||||
|
||||
void wxFindReplaceDialogImpl::InitFindWhat(const wxString& str)
|
||||
|
@@ -615,7 +615,7 @@ void wxNativeFontInfo::SetFamily(wxFontFamily family)
|
||||
facename = _T("MS Sans Serif");
|
||||
}
|
||||
|
||||
lf.lfPitchAndFamily = DEFAULT_PITCH | ff_family;
|
||||
lf.lfPitchAndFamily = (BYTE)(DEFAULT_PITCH) | ff_family;
|
||||
|
||||
if ( !wxStrlen(lf.lfFaceName) )
|
||||
{
|
||||
|
@@ -817,7 +817,8 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
||||
|
||||
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true);
|
||||
|
||||
wxSizeEvent event(wxSize(width, height), m_windowId);
|
||||
wxSize size(width, height);
|
||||
wxSizeEvent event(size, m_windowId);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
@@ -200,7 +200,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action,
|
||||
excep.pfnDeferredFillIn = NULL;
|
||||
|
||||
hr = ((IDispatch*)m_dispatchPtr)->Invoke(dispIds[0], IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
action, &dispparams, vReturnPtr, &excep, &uiArgErr);
|
||||
(WORD)action, &dispparams, vReturnPtr, &excep, &uiArgErr);
|
||||
|
||||
for (i = 0; i < namedArgStringCount; i++)
|
||||
{
|
||||
@@ -617,7 +617,7 @@ bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant)
|
||||
wxDateTime date( variant.GetDateTime() );
|
||||
oleVariant.vt = VT_DATE;
|
||||
|
||||
if (!OleDateFromTm(date.GetYear(), date.GetMonth(), date.GetDay(),
|
||||
if (!OleDateFromTm((WORD)date.GetYear(), date.GetMonth(), date.GetDay(),
|
||||
date.GetHour(), date.GetMinute(), date.GetSecond(), oleVariant.date))
|
||||
return false;
|
||||
}
|
||||
@@ -702,7 +702,12 @@ bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
|
||||
if (!TmFromOleDate(oleVariant.date, tmTemp))
|
||||
return false;
|
||||
|
||||
wxDateTime date(tmTemp.tm_yday, (wxDateTime::Month) tmTemp.tm_mon, tmTemp.tm_year, tmTemp.tm_hour, tmTemp.tm_min, tmTemp.tm_sec);
|
||||
wxDateTime date((wxDateTime::wxDateTime_t) tmTemp.tm_yday,
|
||||
(wxDateTime::Month) tmTemp.tm_mon,
|
||||
tmTemp.tm_year,
|
||||
(wxDateTime::wxDateTime_t) tmTemp.tm_hour,
|
||||
(wxDateTime::wxDateTime_t) tmTemp.tm_min,
|
||||
(wxDateTime::wxDateTime_t) tmTemp.tm_sec);
|
||||
|
||||
variant = date;
|
||||
#endif
|
||||
@@ -1108,7 +1113,7 @@ static void ReleaseVariant(VARIANTARG *pvarg)
|
||||
VARIANTARG _huge *pvargArray;
|
||||
long lLBound, lUBound, l;
|
||||
|
||||
vt = pvarg->vt & 0xfff; // mask off flags
|
||||
vt = (VARTYPE)(pvarg->vt & 0xfff); // mask off flags
|
||||
|
||||
// check if an array. If so, free its contents, then the array itself.
|
||||
if (V_ISARRAY(pvarg))
|
||||
|
@@ -871,7 +871,7 @@ bool wxToolBar::Realize()
|
||||
TBBUTTONINFO tbbi;
|
||||
tbbi.cbSize = sizeof(tbbi);
|
||||
tbbi.dwMask = TBIF_SIZE;
|
||||
tbbi.cx = size.x;
|
||||
tbbi.cx = (WORD)size.x;
|
||||
if ( !::SendMessage(GetHwnd(), TB_SETBUTTONINFO,
|
||||
tool->GetId(), (LPARAM)&tbbi) )
|
||||
{
|
||||
|
@@ -991,8 +991,8 @@ bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event)
|
||||
size_t lenOld = GetValue().length();
|
||||
|
||||
wxUint32 code = event.GetRawKeyCode();
|
||||
::keybd_event(code, 0, 0 /* key press */, 0);
|
||||
::keybd_event(code, 0, KEYEVENTF_KEYUP, 0);
|
||||
::keybd_event((BYTE)code, 0, 0 /* key press */, 0);
|
||||
::keybd_event((BYTE)code, 0, KEYEVENTF_KEYUP, 0);
|
||||
|
||||
// assume that any alphanumeric key changes the total number of characters
|
||||
// in the control - this should work in 99% of cases
|
||||
@@ -2122,9 +2122,12 @@ bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
case WM_SETCURSOR:
|
||||
// ok, so it is hardcoded - do we really nee to
|
||||
// customize it?
|
||||
::SetCursor(GetHcursorOf(wxCursor(wxCURSOR_HAND)));
|
||||
{
|
||||
wxCursor cur(wxCURSOR_HAND);
|
||||
::SetCursor(GetHcursorOf(cur));
|
||||
*result = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
case WM_LBUTTONDOWN:
|
||||
@@ -2403,7 +2406,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
||||
|
||||
const wxArrayInt& tabs = style.GetTabs();
|
||||
|
||||
pf.cTabCount = wxMin(tabs.GetCount(), MAX_TAB_STOPS);
|
||||
pf.cTabCount = (SHORT)wxMin(tabs.GetCount(), MAX_TAB_STOPS);
|
||||
size_t i;
|
||||
for (i = 0; i < (size_t) pf.cTabCount; i++)
|
||||
{
|
||||
|
@@ -150,7 +150,7 @@ wxTimerProc(HWND WXUNUSED(hwnd),
|
||||
UINT idTimer,
|
||||
DWORD WXUNUSED(dwTime))
|
||||
{
|
||||
wxTimerMap::iterator node = g_timerMap.find(idTimer);
|
||||
wxTimerMap::iterator node = g_timerMap.find((unsigned long)idTimer);
|
||||
|
||||
wxCHECK_RET( node != g_timerMap.end(), wxT("bogus timer id in wxTimerProc") );
|
||||
|
||||
|
Reference in New Issue
Block a user