Posted to tcl by patthoyts at Tue Mar 31 22:24:09 GMT 2009view pretty

Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.289
diff -u -r1.289 tcl.h
--- generic/tcl.h	19 Mar 2009 23:31:36 -0000	1.289
+++ generic/tcl.h	20 Mar 2009 21:45:23 -0000
@@ -381,11 +381,7 @@
 typedef struct stati64 Tcl_StatBuf;
 #         define TCL_LL_MODIFIER	"L"
 #      else /* __BORLANDC__ */
-#         if _MSC_VER < 1400 || !defined(_M_IX86)
-typedef struct _stati64	Tcl_StatBuf;
-#         else
-typedef struct _stat64	Tcl_StatBuf;
-#         endif /* _MSC_VER < 1400 */
+typedef struct Tcl_StatBuf_ Tcl_StatBuf;
 #         define TCL_LL_MODIFIER	"I64"
 #      endif /* __BORLANDC__ */
 #   else /* __WIN32__ */
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.422
diff -u -r1.422 tclInt.h
--- generic/tclInt.h	21 Mar 2009 12:24:49 -0000	1.422
+++ generic/tclInt.h	24 Mar 2009 21:48:01 -0000
@@ -2415,6 +2415,31 @@
 } Tcl_PathPart;
 
 /*
+ * To avoid a large collection of ifdefery for the various versions of
+ * MSVC on IX86/AMD64 to choose the right _stat64/_stati64/__stat64 and
+ * so on, instead we can just declare what we need. We want the st_size
+ * member to be wide and the time members to be time_t. This is a 64bit
+ * value on Win64 and a 32bit value on Win32.
+ */
+
+#ifdef _MSC_VER
+#include <sys/types.h>
+struct Tcl_StatBuf_ {
+    _dev_t st_dev;
+    _ino_t st_ino;
+    unsigned short st_mode;
+    short st_nlink;
+    short st_uid;
+    short st_gid;
+    _dev_t st_rdev;
+    Tcl_WideInt st_size;
+    time_t st_atime;
+    time_t st_mtime;
+    time_t st_ctime;
+};
+#endif
+
+/*
  *----------------------------------------------------------------
  * Data structures related to obsolete filesystem hooks
  *----------------------------------------------------------------