2009-07-27  Ozkan Sezer  <sezeroz@gmail.com>

	stdio/
	* _fstat64i32.c, _fwstat64i32.c: Added fixme notes to the broken
	_USE_32BIT_TIME_T condition. Or'ed the condition with _INTEGRAL_MAX_BITS
	< 64 because the 64 bit time_t is not available in such a case.
	* _findfirst64i32.c (_findfirst64i32): only compile if _INTEGRAL_MAX_BITS
	>= 64 because the 64 bit time_t is not available otherwise.
	(_wfindfirst64i32): Likewise.
	* _findnext64i32.c (_findnext64i32): Likewise.
	(_wfindnext64i32): Likewise.
	* _fstat64i32.c (_fstat64i32): Likewise.
	(_stat64i32): Likewise.
	* _fwstat64i32.c (_wstat64i32): Likewise.

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@1045 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/ChangeLog b/mingw-w64-crt/ChangeLog
index 05a3938..92b8f1c 100644
--- a/mingw-w64-crt/ChangeLog
+++ b/mingw-w64-crt/ChangeLog
@@ -1,5 +1,20 @@
 2009-07-27  Ozkan Sezer  <sezeroz@gmail.com>
 
+	stdio/
+	* _fstat64i32.c, _fwstat64i32.c: Added fixme notes to the broken
+	_USE_32BIT_TIME_T condition. Or'ed the condition with _INTEGRAL_MAX_BITS
+	< 64 because the 64 bit time_t is not available in such a case.
+	* _findfirst64i32.c (_findfirst64i32): only compile if _INTEGRAL_MAX_BITS
+	>= 64 because the 64 bit time_t is not available otherwise.
+	(_wfindfirst64i32): Likewise.
+	* _findnext64i32.c (_findnext64i32): Likewise.
+	(_wfindnext64i32): Likewise.
+	* _fstat64i32.c (_fstat64i32): Likewise.
+	(_stat64i32): Likewise.
+	* _fwstat64i32.c (_wstat64i32): Likewise.
+
+2009-07-27  Ozkan Sezer  <sezeroz@gmail.com>
+
 	* stdio/_findnext64i32.c: Define __CRT__NO_INLINE before the includes to
 	prevent declaration mismatches.
 	* _findnext64i32.c: Likewise.
diff --git a/mingw-w64-crt/stdio/_findfirst64i32.c b/mingw-w64-crt/stdio/_findfirst64i32.c
index d9e01aa..51029d9 100644
--- a/mingw-w64-crt/stdio/_findfirst64i32.c
+++ b/mingw-w64-crt/stdio/_findfirst64i32.c
@@ -2,6 +2,7 @@
 #include <io.h>
 #include <string.h>
 
+#if _INTEGRAL_MAX_BITS >= 64
 intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData)
 {
   struct __finddata64_t fd;
@@ -27,3 +28,5 @@
   memcpy(_FindData->name,fd.name,260*sizeof(wchar_t));
   return ret;
 }
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
+
diff --git a/mingw-w64-crt/stdio/_findnext64i32.c b/mingw-w64-crt/stdio/_findnext64i32.c
index 2c0011a..032dc85 100644
--- a/mingw-w64-crt/stdio/_findnext64i32.c
+++ b/mingw-w64-crt/stdio/_findnext64i32.c
@@ -2,6 +2,7 @@
 #include <io.h>
 #include <string.h>
 
+#if _INTEGRAL_MAX_BITS >= 64
 int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData)
 {
   struct __finddata64_t fd;
@@ -27,3 +28,5 @@
   memcpy(_FindData->name,fd.name,260*sizeof(wchar_t));
   return ret;
 }
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
+
diff --git a/mingw-w64-crt/stdio/_fstat64i32.c b/mingw-w64-crt/stdio/_fstat64i32.c
index 5bb252b..b3232f3 100644
--- a/mingw-w64-crt/stdio/_fstat64i32.c
+++ b/mingw-w64-crt/stdio/_fstat64i32.c
@@ -1,6 +1,7 @@
 #define __CRT__NO_INLINE
 #include <sys/stat.h>
 
+#if _INTEGRAL_MAX_BITS >= 64
 int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat)
 {
   struct _stat64 st;
@@ -36,8 +37,13 @@
   _Stat->st_ctime=st.st_ctime;
   return ret;
 }
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
 
-#ifdef _USE_32BIT_TIME_T
+/* FIXME: Relying on _USE_32BIT_TIME_T, which is a user-macro,
+during CRT compilation is plainly broken.  Need an appropriate
+implementation to provide users the ability of compiling the
+CRT only with 32-bit time_t behavior. */
+#if _INTEGRAL_MAX_BITS < 64  || defined(_USE_32BIT_TIME_T)
 int __cdecl fstat(int _Desc,struct stat *_Stat)
 {
   return _fstat32(_Desc,(struct _stat32 *)_Stat);
@@ -58,3 +64,4 @@
   return _stat64i32(_Filename,(struct _stat64i32 *)_Stat);
 }
 #endif
+
diff --git a/mingw-w64-crt/stdio/_fwstat64i32.c b/mingw-w64-crt/stdio/_fwstat64i32.c
index 105eb26..87ad320 100644
--- a/mingw-w64-crt/stdio/_fwstat64i32.c
+++ b/mingw-w64-crt/stdio/_fwstat64i32.c
@@ -1,6 +1,7 @@
 #define __CRT__NO_INLINE
 #include <sys/stat.h>
 
+#if _INTEGRAL_MAX_BITS >= 64
 int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat)
 {
   struct _stat64 st;
@@ -18,8 +19,13 @@
   _Stat->st_ctime=st.st_ctime;
   return ret;
 }
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
 
-#ifdef _USE_32BIT_TIME_T
+/* FIXME: Relying on _USE_32BIT_TIME_T, which is a user-macro,
+during CRT compilation is plainly broken.  Need an appropriate
+implementation to provide users the ability of compiling the
+CRT only with 32-bit time_t behavior. */
+#if _INTEGRAL_MAX_BITS < 64 || defined(_USE_32BIT_TIME_T)
 int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat)
 {
   return _wstat32(_Filename,(struct _stat32 *)_Stat);
@@ -30,3 +36,4 @@
   return _wstat64i32(_Filename,(struct _stat64i32 *)_Stat);
 }
 #endif
+