correct wxIntPtr definition

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-06-15 14:16:59 +00:00
parent 6fb1c1cbcf
commit 47bec43d70

View File

@@ -1114,7 +1114,11 @@ typedef wxUint32 wxDword;
#if wxCHECK_WATCOM_VERSION(1,4) #if wxCHECK_WATCOM_VERSION(1,4)
#define HAVE_SSIZE_T #define HAVE_SSIZE_T
#endif #endif
#ifndef HAVE_SSIZE_T #ifdef HAVE_SSIZE_T
#ifdef __UNIX__
#include <sys/types.h>
#endif
#else // !HAVE_SSIZE_T
#if SIZEOF_SIZE_T == 4 #if SIZEOF_SIZE_T == 4
typedef wxInt32 ssize_t; typedef wxInt32 ssize_t;
#elif SIZEOF_SIZE_T == 8 #elif SIZEOF_SIZE_T == 8
@@ -1124,6 +1128,17 @@ typedef wxUint32 wxDword;
#endif #endif
#endif #endif
// we can't rely on Windows _W64 being defined as windows.h may not be included
// so define our own equivalent: this should be used with types like WXLPARAM
// or WXWPARAM which are 64 bit under Win64 to avoid warnings each time we cast
// it to a pointer or a handle (which results in hundreds of warnings as Win32
// API often passes pointers in them)
#if wxCHECK_VISUALC_VERSION(7)
#define wxW64 __w64
#else
#define wxW64
#endif
/* /*
Define signed and unsigned integral types big enough to contain all of long, Define signed and unsigned integral types big enough to contain all of long,
size_t and void *. size_t and void *.
@@ -1132,13 +1147,11 @@ typedef wxUint32 wxDword;
/* /*
Win64 case: size_t is the only integral type big enough for "void *". Win64 case: size_t is the only integral type big enough for "void *".
Notice that wxUIntPtr should be also defined as size_t when building Notice that we must use __w64 to avoid warnings about casting pointers
under Win32 with MSVC with /Wp64 option as otherwise any conversion to wxIntPtr (which we do often as this is what it is defined for) in 32
between ints and pointers results in a warning 4311 or 4312, even if it bit build with MSVC.
is safe under Win32. Using size_t (declared with __w64) allows to avoid
them.
*/ */
#define wxIntPtr ssize_t typedef wxW64 ssize_t wxIntPtr;
typedef size_t wxUIntPtr; typedef size_t wxUIntPtr;
#elif SIZEOF_LONG >= SIZEOF_VOID_P #elif SIZEOF_LONG >= SIZEOF_VOID_P
/* /*
@@ -2817,17 +2830,6 @@ typedef void * WXRECTANGLEPTR;
# define WXFAR # define WXFAR
#endif #endif
// we can't rely on Windows _W64 being defined as windows.h may not be included
// so define our own equivalent: this should be used with types like WXLPARAM
// or WXWPARAM which are 64 bit under Win64 to avoid warnings each time we cast
// it to a pointer or a handle (which results in hundreds of warnings as Win32
// API often passes pointers in them)
#if wxCHECK_VISUALC_VERSION(7)
#define wxW64 __w64
#else
#define wxW64
#endif
/* Stand-ins for Windows types to avoid #including all of windows.h */ /* Stand-ins for Windows types to avoid #including all of windows.h */
typedef void * WXHWND; typedef void * WXHWND;
typedef void * WXHANDLE; typedef void * WXHANDLE;