Don't assume size_t is either int- or long-sized.

On 64bit Windows systems, sizeof(int)==sizeof(long)=4, but size_t is 8
bytes large.

Fixes #12179.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-07-01 14:30:29 +00:00
parent 0d3d9817c0
commit 227c030f98
2 changed files with 9 additions and 10 deletions

View File

@@ -929,10 +929,6 @@ typedef wxUint16 wxWord;
#error "SIZEOF_WCHAR_T must be defined, but isn't" #error "SIZEOF_WCHAR_T must be defined, but isn't"
#endif #endif
#if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
#error "wxSIZE_T_IS_UINT or wxSIZE_T_IS_ULONG must be defined"
#endif
/* also define C99-like sized MIN/MAX constants */ /* also define C99-like sized MIN/MAX constants */
#define wxINT8_MIN CHAR_MIN #define wxINT8_MIN CHAR_MIN
#define wxINT8_MAX CHAR_MAX #define wxINT8_MAX CHAR_MAX

View File

@@ -173,16 +173,19 @@ public:
Arg_Double = 0x0040, Arg_Double = 0x0040,
Arg_LongDouble = 0x0080, Arg_LongDouble = 0x0080,
#ifdef wxSIZE_T_IS_UINT #if defined(wxSIZE_T_IS_UINT)
Arg_Size_t = Arg_Int, Arg_Size_t = Arg_Int,
#endif #elif defined(wxSIZE_T_IS_ULONG)
#ifdef wxSIZE_T_IS_ULONG
Arg_Size_t = Arg_LongInt, Arg_Size_t = Arg_LongInt,
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
Arg_Size_t = Arg_LongLongInt,
#else
Arg_Size_t = 0x0100,
#endif #endif
Arg_IntPtr = 0x0100, // %n -- store # of chars written Arg_IntPtr = 0x0200, // %n -- store # of chars written
Arg_ShortIntPtr = 0x0200, Arg_ShortIntPtr = 0x0400,
Arg_LongIntPtr = 0x0400, Arg_LongIntPtr = 0x0800,
Arg_Unknown = 0x8000 // unrecognized specifier (likely error) Arg_Unknown = 0x8000 // unrecognized specifier (likely error)
}; };