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
This commit is contained in:
Patrick Albert
1999-08-30 07:11:47 +00:00
parent c15d098cdf
commit 197dd9af26
18 changed files with 60 additions and 25 deletions

View File

@@ -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__

View File

@@ -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

View File

@@ -1,3 +1,4 @@
# pragma warning(disable:4001) /* non standard extension used: single line comment */
#include "wx/setup.h"
#include <math.h>
@@ -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++ */
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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.

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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

View File

@@ -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<<MAX_BITS)-1,
Assert (code + bl_count[MAX_BITS]-1 == (ush)(1<<MAX_BITS)-(ush)1,
"inconsistent bit counts");
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
@@ -1109,7 +1109,7 @@ local void compress_block(s, ltree, dtree)
} /* literal or match pair ? */
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
Assert((unsigned)s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
} while (lx < s->last_lit);