From: Václav Slavík Date: Thu, 1 Jul 2010 14:30:29 +0000 (+0000) Subject: Don't assume size_t is either int- or long-sized. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/227c030f98ed8b99b3824e7efb01b2c8519ce901 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 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index 0a76ab191f..33a0c79c0c 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -929,10 +929,6 @@ typedef wxUint16 wxWord; #error "SIZEOF_WCHAR_T must be defined, but isn't" #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 */ #define wxINT8_MIN CHAR_MIN #define wxINT8_MAX CHAR_MAX diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index ae70e64b17..cc14ce2ddb 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -173,16 +173,19 @@ public: Arg_Double = 0x0040, Arg_LongDouble = 0x0080, -#ifdef wxSIZE_T_IS_UINT +#if defined(wxSIZE_T_IS_UINT) Arg_Size_t = Arg_Int, -#endif -#ifdef wxSIZE_T_IS_ULONG +#elif defined(wxSIZE_T_IS_ULONG) 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 - Arg_IntPtr = 0x0100, // %n -- store # of chars written - Arg_ShortIntPtr = 0x0200, - Arg_LongIntPtr = 0x0400, + Arg_IntPtr = 0x0200, // %n -- store # of chars written + Arg_ShortIntPtr = 0x0400, + Arg_LongIntPtr = 0x0800, Arg_Unknown = 0x8000 // unrecognized specifier (likely error) };