From: Patrick Albert Date: Mon, 30 Aug 1999 07:11:47 +0000 (+0000) Subject: Removing most of level 4 warnings, particulary in 16 bits mode X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/197dd9af26230291b156c504506fed47a4d7420b Removing most of level 4 warnings, particulary in 16 bits mode git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index bb9ac4effa..48d5bbd3ce 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -91,14 +91,18 @@ // suppress some Visual C++ warnings #ifdef __VISUALC__ +# pragma warning(disable:4201) // nonstandard extension used: nameless struct/union # pragma warning(disable:4244) // conversion from double to float # pragma warning(disable:4100) // unreferenced formal parameter # pragma warning(disable:4511) // copy ctor couldn't be generated # pragma warning(disable:4512) // operator=() couldn't be generated -#ifndef WIN32 +# pragma warning(disable:4699) // Using precompiled header # pragma warning(disable:4134) // conversion between pointers to members of same class +#ifndef WIN32 # pragma warning(disable:4135) // conversion between different integral types # pragma warning(disable:4769) // assignment of near pointer to long integer +// This one is really annoying, since it occurs for each cast to (HANDLE)... +# pragma warning(disable:4305) // truncation of long to near ptr #endif #endif // __VISUALC__ diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index e198301331..1d4ce59b19 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -197,7 +197,7 @@ public: WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } - wxWindow *FindItem(int id) const; + wxWindow *FindItem(long id) const; wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; // Make a Windows extended style from the given wxWindows window style diff --git a/src/common/extended.c b/src/common/extended.c index 42225997a2..6de1ae2aa8 100644 --- a/src/common/extended.c +++ b/src/common/extended.c @@ -1,3 +1,4 @@ +# pragma warning(disable:4001) /* non standard extension used: single line comment */ #include "wx/setup.h" #include @@ -82,9 +83,10 @@ void ConvertToIeeeExtended(double num, unsigned char *bytes) } } - /* disable the warning about 'possible loss of data' */ + /* disable the warning about 'possible loss of data' & 'conversion between diff types' */ #ifdef _MSC_VER #pragma warning(disable: 4244) + #pragma warning(disable: 4135) #endif /* Visual C++ */ bytes[0] = (expon >> 8) & 0xff; @@ -100,6 +102,7 @@ void ConvertToIeeeExtended(double num, unsigned char *bytes) #ifdef _MSC_VER #pragma warning(default: 4244) + #pragma warning(default: 4135) #endif /* Visual C++ */ } diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 47f9a2afba..c51def975a 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -2495,7 +2495,7 @@ bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *t if (!table) table = wxDefaultResourceTable; - table->identifiers.Put(name, (wxObject *)value); + table->identifiers.Put(name, (wxObject *)(long)value); return TRUE; } diff --git a/src/common/unzip.c b/src/common/unzip.c index 08dd404643..5d27912453 100644 --- a/src/common/unzip.c +++ b/src/common/unzip.c @@ -4,6 +4,7 @@ Read unzip.h for more info */ +# pragma warning(disable:4001) /* non standard extension used: single line comment */ #include "wx/setup.h" #if wxUSE_ZLIB && wxUSE_ZIPSTREAM diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index 963c661c43..808ed0f727 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -146,7 +146,11 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpCheck); // then draw a check mark into it - RECT rect = { 0, 0, nCheckWidth, nCheckHeight }; + RECT rect ; + rect.left = 0 ; + rect.top = 0 ; + rect.right = nCheckWidth ; + rect.bottom = nCheckHeight ; #ifdef __WIN32__ #ifndef __SC__ @@ -240,7 +244,11 @@ void wxCheckListBoxItem::Check(bool check) // FIXME this doesn't work if the listbox is scrolled! size_t nHeight = m_pParent->GetItemHeight(); size_t y = m_nIndex * nHeight; - RECT rcUpdate = { 0, y, GetDefaultMarginWidth(), y + nHeight}; + RECT rcUpdate ; + rcUpdate.left = 0 ; + rcUpdate.top = y ; + rcUpdate.right = GetDefaultMarginWidth() ; + rcUpdate.bottom = y + nHeight ; #endif // Win32/16 InvalidateRect(hwndListbox, &rcUpdate, FALSE); diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index cff1fb1a1a..9f652d12ec 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -561,7 +561,7 @@ DWORD /* lData2 */) connection->m_hConv = 0; connection->m_topicName = topic_buf; DDECurrentlyConnecting = connection; - return (DDERETURN)TRUE; + return (DDERETURN)(DWORD)TRUE; } } else return (DDERETURN)0; @@ -574,7 +574,7 @@ DWORD /* lData2 */) { DDECurrentlyConnecting->m_hConv = (WXHCONV) hConv; DDECurrentlyConnecting = NULL; - return (DDERETURN)TRUE; + return (DDERETURN)(DWORD)TRUE; } else return 0; break; @@ -586,7 +586,7 @@ DWORD /* lData2 */) if (connection && connection->OnDisconnect()) { DDEDeleteConnection(hConv); // Delete mapping: hConv => connection - return (DDERETURN)TRUE; + return (DDERETURN)(DWORD)TRUE; } else return (DDERETURN)0; break; @@ -601,7 +601,7 @@ DWORD /* lData2 */) DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0); DdeFreeDataHandle(hData); if (connection->OnExecute(connection->m_topicName, connection->m_bufPtr, (int)len, (wxIPCFormat) wFmt)) - return (DDERETURN)DDE_FACK; + return (DDERETURN)(DWORD)DDE_FACK; else return (DDERETURN)DDE_FNOTPROCESSED; } else return (DDERETURN)DDE_FNOTPROCESSED; @@ -644,7 +644,7 @@ DWORD /* lData2 */) DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0); DdeFreeDataHandle(hData); connection->OnPoke(connection->m_topicName, wxString(item_name), connection->m_bufPtr, (int)len, (wxIPCFormat) wFmt); - return (DDERETURN)DDE_FACK; + return (DDERETURN)(DWORD)DDE_FACK; } else return (DDERETURN)DDE_FNOTPROCESSED; break; } @@ -659,7 +659,7 @@ DWORD /* lData2 */) DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); - return (DDERETURN)connection->OnStartAdvise(connection->m_topicName, wxString(item_name)); + return (DDERETURN)(DWORD)connection->OnStartAdvise(connection->m_topicName, wxString(item_name)); } else return (DDERETURN)0; break; } @@ -673,7 +673,7 @@ DWORD /* lData2 */) wxChar item_name[200]; DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); - return (DDERETURN)connection->OnStopAdvise(connection->m_topicName, wxString(item_name)); + return (DDERETURN)(DWORD)connection->OnStopAdvise(connection->m_topicName, wxString(item_name)); } else return (DDERETURN)0; break; } @@ -706,7 +706,7 @@ DWORD /* lData2 */) DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0); DdeFreeDataHandle(hData); if (connection->OnAdvise(connection->m_topicName, wxString(item_name), connection->m_bufPtr, (int)len, (wxIPCFormat) wFmt)) - return (DDERETURN)DDE_FACK; + return (DDERETURN)(DWORD)DDE_FACK; else return (DDERETURN)DDE_FNOTPROCESSED; } else return (DDERETURN)DDE_FNOTPROCESSED; diff --git a/src/msw/gaugemsw.cpp b/src/msw/gaugemsw.cpp index 1af85748f9..1d46d463d3 100644 --- a/src/msw/gaugemsw.cpp +++ b/src/msw/gaugemsw.cpp @@ -754,7 +754,8 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance) /* Get a DC to determine whether device is mono or not, and set * default foreground/background colors as appropriate. */ - if ((hdc = CreateIC(_T("DISPLAY"), NULL, NULL, 0L))) + hdc = CreateIC(_T("DISPLAY"), NULL, NULL, 0L) ; + if (hdc) { /* check for mono-display */ if ((GetDeviceCaps(hdc, BITSPIXEL) == 1) && @@ -1127,7 +1128,8 @@ zyzgForceRepaint3D: case WM_SETFONT: /* if NULL hFont, use system font */ - if (!(hFont = (HFONT)wParam)) + hFont = (HFONT)wParam ; + if (!hFont) hFont = (HFONT) GetStockObject(SYSTEM_FONT); pgauge->hFont = hFont; diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 48d5ba171a..bd865c7542 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -253,7 +253,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, (WPARAM)font.GetResourceHandle(), 0L); } - m_subControls.Append((wxObject *)(WXWORD)newId); + m_subControls.Append((wxObject *)(WXDWORD)(WXWORD)newId); } // Create a dummy radio control to end the group. diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index 200e920bd8..cc8808dd41 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -182,7 +182,11 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap) } } - RECT rect = { x, y, x + w, y + h }; + RECT rect ; + rect.left = x ; + rect.top = y ; + rect.right = x + w ; + rect.bottom = y + h ; InvalidateRect((HWND)GetParent()->GetHWND(), &rect, TRUE); } diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index ca76d82573..9561c8e776 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -41,6 +41,7 @@ // ---------------------------------------------------------------------------- // a simple wrapper around TOOLINFO Win32 structure +#pragma warning( disable : 4097 ) class wxToolInfo : public TOOLINFO { public: @@ -58,6 +59,7 @@ public: uId = (UINT)win->GetHWND(); } }; +#pragma warning( default : 4097 ) // ---------------------------------------------------------------------------- // private functions diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 913713c566..d9affa465f 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -66,6 +66,7 @@ // ---------------------------------------------------------------------------- // a convenient wrapper around TV_ITEM struct which adds a ctor +#pragma warning( disable : 4097 ) struct wxTreeViewItem : public TV_ITEM { wxTreeViewItem(const wxTreeItemId& item, // the item handle @@ -78,6 +79,7 @@ struct wxTreeViewItem : public TV_ITEM hItem = (HTREEITEM) (WXHTREEITEM) item; } }; +#pragma warning( default : 4097 ) // a class which encapsulates the tree traversal logic: it vists all (unless // OnVisit() returns FALSE) items under the given one diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 161cdf5374..380abf22fe 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -162,7 +162,7 @@ END_EVENT_TABLE() // --------------------------------------------------------------------------- // Find an item given the MS Windows id -wxWindow *wxWindow::FindItem(int id) const +wxWindow *wxWindow::FindItem(long id) const { wxWindowList::Node *current = GetChildren().GetFirst(); while (current) diff --git a/src/png/pngrtran.c b/src/png/pngrtran.c index ce486bd06d..489554c7e4 100644 --- a/src/png/pngrtran.c +++ b/src/png/pngrtran.c @@ -16,6 +16,15 @@ #define PNG_INTERNAL #include "png.h" +#if defined(_MSC_VER) && !defined(__MWERKS__) +#define __VISUALC__ _MSC_VER +#endif +#ifdef __VISUALC__ +#ifndef WIN32 +#pragma warning(disable:4135) +#endif +#endif + /* Set the action on getting a CRC error for an ancillary or critical chunk. */ void png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) diff --git a/src/xpm/misc.c b/src/xpm/misc.c index c0089ab011..3ef812a1ce 100644 --- a/src/xpm/misc.c +++ b/src/xpm/misc.c @@ -131,7 +131,7 @@ XpmFreeExtensions(XpmExtension *extensions, int nextensions) char **sptr; if (extensions) { - for (i = 0, ext = extensions; i < nextensions; i++, ext++) { + for (i = 0, ext = extensions; i < (unsigned int)nextensions; i++, ext++) { if (ext->name) XpmFree(ext->name); nlines = ext->nlines; diff --git a/src/xpm/scan.c b/src/xpm/scan.c index fb16180fd8..b08783c952 100644 --- a/src/xpm/scan.c +++ b/src/xpm/scan.c @@ -398,7 +398,7 @@ ScanOtherColors(Display *display, XpmColor *colors, int ncolors, Pixel *pixels, return (XpmNoMemory); for (i = 0, i2 = (mask ? i + 1 : i), color = colors, xcolor = xcolors; - i < ncolors; i++, i2++, color++, xcolor++, pixels++) { + i < (unsigned int)ncolors; i++, i2++, color++, xcolor++, pixels++) { if (!(s = color->string = (char *) XpmMalloc(cpp + 1))) { XpmFree(xcolors); @@ -441,7 +441,7 @@ ScanOtherColors(Display *display, XpmColor *colors, int ncolors, Pixel *pixels, } /* end 3.2 bc */ - for (i = 0, color = colors, xcolor = xcolors; i < ncolors; + for (i = 0, color = colors, xcolor = xcolors; i < (unsigned int)ncolors; i++, color++, xcolor++) { /* look for related info from the attributes if any */ diff --git a/src/xpm/xpm34p.h b/src/xpm/xpm34p.h index 31a7008484..964c294b51 100644 --- a/src/xpm/xpm34p.h +++ b/src/xpm/xpm34p.h @@ -288,7 +288,7 @@ FUNC(xpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s)); FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data)); #define HashAtomData(i) ((void *)i) -#define HashColorIndex(slot) ((unsigned int)((*slot)->data)) +#define HashColorIndex(slot) ((unsigned int)(unsigned long)((*slot)->data)) #define USE_HASHTABLE (cpp > 2 && ncolors > 4) #ifdef NEED_STRDUP diff --git a/src/zlib/trees.c b/src/zlib/trees.c index 24c68cb580..524c675870 100644 --- a/src/zlib/trees.c +++ b/src/zlib/trees.c @@ -588,7 +588,7 @@ local void gen_codes (tree, max_code, bl_count) /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ - Assert (code + bl_count[MAX_BITS]-1 == (1<pending < s->lit_bufsize + 2*lx, "pendingBuf overflow"); + Assert((unsigned)s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow"); } while (lx < s->last_lit);