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@29697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-10-07 13:36:41 +00:00
parent b4e0b521e0
commit 373a5fb355
10 changed files with 28 additions and 20 deletions

View File

@@ -491,7 +491,7 @@ inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { }
// kbd code translation // kbd code translation
WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0); WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0);
WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual); WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual);
// window creation helper class: before creating a new HWND, instantiate an // window creation helper class: before creating a new HWND, instantiate an
// object of this class on stack - this allows to process the messages sent to // object of this class on stack - this allows to process the messages sent to

View File

@@ -39,19 +39,27 @@
still force a semicolon after the macro still force a semicolon after the macro
*/ */
#ifdef __WATCOMC__
#define wxPRE_NO_WARNING_SCOPE for(int i=0;i<1;i++)
#define wxPOST_NO_WARNING_SCOPE
#else
#define wxPRE_NO_WARNING_SCOPE do
#define wxPOST_NO_WARNING_SCOPE while ( 0 )
#endif
#define wxCHECKED_DELETE(ptr) \ #define wxCHECKED_DELETE(ptr) \
do \ wxPRE_NO_WARNING_SCOPE \
{ \ { \
typedef char complete[sizeof(*ptr)]; \ typedef char complete[sizeof(*ptr)]; \
delete ptr; \ delete ptr; \
} while ( 0 ) } wxPOST_NO_WARNING_SCOPE
#define wxCHECKED_DELETE_ARRAY(ptr) \ #define wxCHECKED_DELETE_ARRAY(ptr) \
do \ wxPRE_NO_WARNING_SCOPE \
{ \ { \
typedef char complete[sizeof(*ptr)]; \ typedef char complete[sizeof(*ptr)]; \
delete [] ptr; \ delete [] ptr; \
} while ( 0 ) } wxPOST_NO_WARNING_SCOPE
/* These scoped pointers are *not* assignable and cannot be used /* These scoped pointers are *not* assignable and cannot be used
within a container. Look for wxDECLARE_SHARED_PTR for this within a container. Look for wxDECLARE_SHARED_PTR for this

View File

@@ -92,7 +92,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
M_ACCELDATA->m_ok = (hAccel != 0); M_ACCELDATA->m_ok = (hAccel != 0);
} }
extern int wxCharCodeWXToMSW(int id, bool *isVirtual); extern WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual);
// Create from an array // Create from an array
wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[])
@@ -114,13 +114,13 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
bool isVirtual; bool isVirtual;
WORD key = (WORD)wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual); WORD key = wxCharCodeWXToMSW(entries[i].GetKeyCode(), &isVirtual);
if (isVirtual) if (isVirtual)
fVirt |= FVIRTKEY; fVirt |= FVIRTKEY;
arr[i].fVirt = fVirt; arr[i].fVirt = fVirt;
arr[i].key = key; arr[i].key = key;
arr[i].cmd = entries[i].GetCommand(); arr[i].cmd = (WORD)entries[i].GetCommand();
} }
M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n); M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n);

View File

@@ -118,7 +118,7 @@ bool wxDIB::Create(int width, int height, int depth)
info->bmiHeader.biHeight = height; info->bmiHeader.biHeight = height;
info->bmiHeader.biPlanes = 1; info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = depth; info->bmiHeader.biBitCount = (WORD)depth;
info->bmiHeader.biSizeImage = GetLineSize(width, depth)*height; info->bmiHeader.biSizeImage = GetLineSize(width, depth)*height;
m_handle = ::CreateDIBSection m_handle = ::CreateDIBSection
@@ -603,7 +603,7 @@ wxPalette *wxDIB::CreatePalette() const
// initialize the palette header // initialize the palette header
pPalette->palVersion = 0x300; // magic number, not in docs but works pPalette->palVersion = 0x300; // magic number, not in docs but works
pPalette->palNumEntries = biClrUsed; pPalette->palNumEntries = (WORD)biClrUsed;
// and the colour table (it starts right after the end of the header) // and the colour table (it starts right after the end of the header)
const RGBQUAD *pRGB = (RGBQUAD *)((char *)&ds.dsBmih + ds.dsBmih.biSize); const RGBQUAD *pRGB = (RGBQUAD *)((char *)&ds.dsBmih + ds.dsBmih.biSize);

View File

@@ -578,7 +578,7 @@ void wxNativeFontInfo::SetFaceName(wxString facename)
void wxNativeFontInfo::SetFamily(wxFontFamily family) void wxNativeFontInfo::SetFamily(wxFontFamily family)
{ {
int ff_family; BYTE ff_family;
wxString facename; wxString facename;
switch ( family ) switch ( family )
@@ -647,7 +647,7 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
} }
} }
lf.lfCharSet = info.charset; lf.lfCharSet = (BYTE)info.charset;
} }
bool wxNativeFontInfo::FromString(const wxString& s) bool wxNativeFontInfo::FromString(const wxString& s)

View File

@@ -166,7 +166,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
(LPARAM)this) ; (LPARAM)this) ;
#else // __WIN32__ #else // __WIN32__
LOGFONT lf; LOGFONT lf;
lf.lfCharSet = m_charset; lf.lfCharSet = (BYTE)m_charset;
wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName)); wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName));
lf.lfPitchAndFamily = 0; lf.lfPitchAndFamily = 0;
::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc, ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,

View File

@@ -164,7 +164,7 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
LOGFONT lf; LOGFONT lf;
wxZeroMemory(lf); // all default values wxZeroMemory(lf); // all default values
lf.lfCharSet = info.charset; lf.lfCharSet = (BYTE)info.charset;
wxStrncpy(lf.lfFaceName, info.facename, WXSIZEOF(lf.lfFaceName)); wxStrncpy(lf.lfFaceName, info.facename, WXSIZEOF(lf.lfFaceName));
HFONT hfont = ::CreateFontIndirect(&lf); HFONT hfont = ::CreateFontIndirect(&lf);

View File

@@ -982,7 +982,7 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara
break; break;
case WM_EXITMENULOOP: case WM_EXITMENULOOP:
processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam); processed = HandleMenuLoop(wxEVT_MENU_CLOSE, (WXWORD)wParam);
break; break;
case WM_QUERYDRAGICON: case WM_QUERYDRAGICON:

View File

@@ -87,7 +87,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
return false; return false;
npPal->palVersion = 0x300; npPal->palVersion = 0x300;
npPal->palNumEntries = n; npPal->palNumEntries = (WORD)n;
int i; int i;
for (i = 0; i < n; i ++) for (i = 0; i < n; i ++)

View File

@@ -5045,10 +5045,10 @@ int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam)
return id; return id;
} }
int wxCharCodeWXToMSW(int id, bool *isVirtual) WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual)
{ {
*isVirtual = true; *isVirtual = true;
int keySym; WXWORD keySym;
switch (id) switch (id)
{ {
case WXK_CANCEL: keySym = VK_CANCEL; break; case WXK_CANCEL: keySym = VK_CANCEL; break;
@@ -5117,7 +5117,7 @@ int wxCharCodeWXToMSW(int id, bool *isVirtual)
default: default:
{ {
*isVirtual = false; *isVirtual = false;
keySym = id; keySym = (WORD)id;
break; break;
} }
} }
@@ -5127,7 +5127,7 @@ int wxCharCodeWXToMSW(int id, bool *isVirtual)
bool wxGetKeyState(wxKeyCode key) bool wxGetKeyState(wxKeyCode key)
{ {
bool bVirtual; bool bVirtual;
int vkey = wxCharCodeWXToMSW(key, &bVirtual); WORD vkey = wxCharCodeWXToMSW(key, &bVirtual);
SHORT state; SHORT state;
switch (key) switch (key)