OW warning fix. Our compile time asserts warns when used within function and dedicated #pragma seems not influence it so they are moved from functions into global space as near as possible.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,10 @@
|
||||
#undef Yield
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -243,8 +247,7 @@ private:
|
||||
// include windows.h from this public header and we also have to use the
|
||||
// union to force the correct (i.e. maximal) alignment
|
||||
//
|
||||
// if CRITICAL_SECTION size changes in Windows, you'll get an assert from
|
||||
// thread.cpp and will need to increase the buffer size
|
||||
// if CRITICAL_SECTION size changes in Windows, you'll get an assert below
|
||||
//
|
||||
// finally, we need this typedef instead of declaring m_buffer directly
|
||||
// because otherwise the assert mentioned above wouldn't compile with some
|
||||
@@ -254,6 +257,10 @@ private:
|
||||
#else // __WIN32__
|
||||
typedef char wxCritSectBuffer[24];
|
||||
#endif
|
||||
|
||||
wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(wxCritSectBuffer),
|
||||
wxCriticalSectionBufferTooSmall );
|
||||
|
||||
union
|
||||
{
|
||||
unsigned long m_dummy1;
|
||||
|
@@ -1181,15 +1181,17 @@ bool wxFileName::IsCaseSensitive( wxPathFormat format )
|
||||
return GetFormat(format) == wxPATH_UNIX;
|
||||
}
|
||||
|
||||
// If asserts, wxPathFormat has been changed.
|
||||
wxCOMPILE_TIME_ASSERT(wxPATH_MAX == 5, wxPathFormatChanged);
|
||||
|
||||
/* static */
|
||||
wxString wxFileName::GetForbiddenChars(wxPathFormat format)
|
||||
{
|
||||
// Inits to forbidden characters that are common to (almost) all platforms.
|
||||
wxString strForbiddenChars = wxT("*?");
|
||||
|
||||
// If asserts, wxPathFormat has been changed. In case of a new path format
|
||||
// In case of a new path format
|
||||
// addition, the following code might have to be updated.
|
||||
wxCOMPILE_TIME_ASSERT(wxPATH_MAX == 5, wxPathFormatChanged);
|
||||
switch ( GetFormat(format) )
|
||||
{
|
||||
default :
|
||||
|
@@ -275,9 +275,6 @@ wxCursor::wxCursor(const wxString& filename,
|
||||
}
|
||||
}
|
||||
|
||||
// Cursors by stock number
|
||||
wxCursor::wxCursor(int idCursor)
|
||||
{
|
||||
// all wxWidgets standard cursors
|
||||
static const struct StdCursor
|
||||
{
|
||||
@@ -323,6 +320,9 @@ wxCursor::wxCursor(int idCursor)
|
||||
wxCOMPILE_TIME_ASSERT( WXSIZEOF(stdCursors) == wxCURSOR_MAX,
|
||||
CursorsIdArrayMismatch );
|
||||
|
||||
// Cursors by stock number
|
||||
wxCursor::wxCursor(int idCursor)
|
||||
{
|
||||
wxCHECK_RET( idCursor > 0 && (size_t)idCursor < WXSIZEOF(stdCursors),
|
||||
_T("invalid cursor id in wxCursor() ctor") );
|
||||
|
||||
|
@@ -113,16 +113,16 @@ public:
|
||||
m_pItem = &item;
|
||||
}
|
||||
|
||||
// memcpy() in Init() can't work if the struct sizes are different
|
||||
wxCOMPILE_TIME_ASSERT( sizeof(LV_ITEM_OTHER) == sizeof(LV_ITEM_NATIVE),
|
||||
CodeCantWorkIfDiffSizes);
|
||||
|
||||
// init with conversion
|
||||
void Init(LV_ITEM_OTHER& item)
|
||||
{
|
||||
// avoid unnecessary dynamic memory allocation, jjust make m_pItem
|
||||
// point to our own m_item
|
||||
|
||||
// memcpy() can't work if the struct sizes are different
|
||||
wxCOMPILE_TIME_ASSERT( sizeof(LV_ITEM_OTHER) == sizeof(LV_ITEM_NATIVE),
|
||||
CodeCantWorkIfDiffSizes);
|
||||
|
||||
memcpy(&m_item, &item, sizeof(LV_ITEM_NATIVE));
|
||||
|
||||
// convert text from ANSI to Unicod if necessary
|
||||
|
@@ -144,9 +144,6 @@ static bool gs_waitingForThread = false;
|
||||
|
||||
wxCriticalSection::wxCriticalSection()
|
||||
{
|
||||
wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(wxCritSectBuffer),
|
||||
wxCriticalSectionBufferTooSmall );
|
||||
|
||||
::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user