]> git.saurik.com Git - wxWidgets.git/commitdiff
correct wxIntPtr definition
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 15 Jun 2008 14:16:59 +0000 (14:16 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 15 Jun 2008 14:16:59 +0000 (14:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/defs.h

index c9754282f775a560d4db1543a3ab7686607a74b9..d00af1463b2437b2788b5ac49b5dc7789a90e861 100644 (file)
@@ -1114,7 +1114,11 @@ typedef wxUint32 wxDword;
 #if wxCHECK_WATCOM_VERSION(1,4)
     #define HAVE_SSIZE_T
 #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
         typedef wxInt32 ssize_t;
     #elif SIZEOF_SIZE_T == 8
@@ -1124,6 +1128,17 @@ typedef wxUint32 wxDword;
     #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,
    size_t and void *.
@@ -1132,13 +1147,11 @@ typedef wxUint32 wxDword;
     /*
        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
-       under Win32 with MSVC with /Wp64 option as otherwise any conversion
-       between ints and pointers results in a warning 4311 or 4312, even if it
-       is safe under Win32. Using size_t (declared with __w64) allows to avoid
-       them.
+       Notice that we must use __w64 to avoid warnings about casting pointers
+       to wxIntPtr (which we do often as this is what it is defined for) in 32
+       bit build with MSVC.
      */
-    #define wxIntPtr ssize_t
+    typedef wxW64 ssize_t wxIntPtr;
     typedef size_t wxUIntPtr;
 #elif SIZEOF_LONG >= SIZEOF_VOID_P
     /*
@@ -2817,17 +2830,6 @@ typedef void *          WXRECTANGLEPTR;
 #    define WXFAR
 #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 */
 typedef void *          WXHWND;
 typedef void *          WXHANDLE;