This patch extends PC/config.h and configure.in as appropriate for
64-bit readiness (the config values are needed for patches that I will
be submitting later today. The changes are as follows:
- add SIZEOF_OFF_T #define's to PC/config.h (it was already in configure.in)
- add SIZEOF_TIME_T #define to PC/config.h and configure
Needed for some buffer overflow checking because sizeof(time_t) is
different on Win64.
- add SIZEOF_FPOS_T #define
Needed for the Win64 large file support implementation.
- add SIZEOF_HKEY in PC/config.h only
Needed for proper Win32 vs. Win64 handling in PC/winreg.c
- #define HAVE_LARGEFILE_SUPPORT for Win64
- typedef long intptr_t; for all Windows except Win64 (which defines it
itself)
This is a new ANSI (I think) type that is useful (and used by me) for
proper handling in msvcrtmodule.c and posixmodule.c
- indent the nested #ifdef's and #defines in PC/config.h
This is *so* much more readable. There cannot be a compiler
compatibilty issue here can there? Perl uses indented #defines and it
compiles with everything.
diff --git a/PC/config.h b/PC/config.h
index 6a1e4c1..dfe5118 100644
--- a/PC/config.h
+++ b/PC/config.h
@@ -241,23 +241,45 @@
/* End of compilers - finish up */
+/* define the ANSI intptr_t type for portable use of a pointer sized
+ integer */
+#include <basetsd.h>
+#if defined(MS_WINDOWS) && !defined(MS_WIN64)
+typedef long intptr_t;
+#endif
+
#if defined(MS_WIN64)
/* maintain "win32" sys.platform for backward compatibility of Python code,
the Win64 API should be close enough to the Win32 API to make this
preferable */
-#define PLATFORM "win32"
-#define SIZEOF_VOID_P 8
+# define PLATFORM "win32"
+# define SIZEOF_VOID_P 8
+# define SIZEOF_TIME_T 8
+# define SIZEOF_OFF_T 4
+# define SIZEOF_FPOS_T 8
+# define SIZEOF_HKEY 8
+/* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
+ sizeof(off_t) > sizeof(long), and sizeof(LONG_LONG) >= sizeof(off_t).
+ On Win64 the second condition is not true, but if fpos_t replaces off_t
+ then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
+ should define this. */
+# define HAVE_LARGEFILE_SUPPORT
#elif defined(MS_WIN32)
-#define PLATFORM "win32"
-#ifdef _M_ALPHA
-#define SIZEOF_VOID_P 8
-#else
-#define SIZEOF_VOID_P 4
-#endif
+# define PLATFORM "win32"
+# ifdef _M_ALPHA
+# define SIZEOF_VOID_P 8
+# define SIZEOF_TIME_T 8
+# else
+# define SIZEOF_VOID_P 4
+# define SIZEOF_TIME_T 4
+# define SIZEOF_OFF_T 4
+# define SIZEOF_FPOS_T 8
+# define SIZEOF_HKEY 4
+# endif
#elif defined(MS_WIN16)
-#define PLATFORM "win16"
+# define PLATFORM "win16"
#else
-#define PLATFORM "dos"
+# define PLATFORM "dos"
#endif