From 8632e81a2d05d4dae66a505fa8347b4a5f0de0c3 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 5 Mar 2010 23:55:58 +0000
Subject: [PATCH] Revert flength() to returning a 32-bit value unless
 XPDEV_LARGE_FILE_SUPPORT is defined.

---
 src/xpdev/dirwrap.c | 10 +---------
 src/xpdev/dirwrap.h |  2 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index 8382624ffb..dd913bdbdb 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -390,7 +390,7 @@ int DLLCALL setfdate(const char* filename, time_t t)
 /* Returns the length of the file in 'filename'                             */
 /* or -1 if the file doesn't exist											*/
 /****************************************************************************/
-int64_t DLLCALL flength(const char *filename)
+filelen_t DLLCALL flength(const char *filename)
 {
 #if defined(__BORLANDC__) && !defined(__unix__)	/* stat() doesn't work right */
 
@@ -409,20 +409,12 @@ int64_t DLLCALL flength(const char *filename)
 
 #else 
 
-#ifdef _WIN32
-	struct _stati64 st;
-#else
 	struct stat st;
-#endif
 
 	if(access(filename,0)==-1)
 		return(-1);
 
-#ifdef _WIN32
-	if(_stati64(filename, &st)!=0)
-#else
 	if(stat(filename, &st)!=0)
-#endif
 		return(-1);
 
 	return(st.st_size);
diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h
index c1a4f05470..5dae2dde1d 100644
--- a/src/xpdev/dirwrap.h
+++ b/src/xpdev/dirwrap.h
@@ -218,7 +218,7 @@ extern "C" {
 /* General file system wrappers for all platforms and compilers */
 DLLEXPORT BOOL		DLLCALL fexist(const char *filespec);
 DLLEXPORT BOOL		DLLCALL fexistcase(char *filespec);	/* fixes upr/lwr case fname */
-DLLEXPORT int64_t	DLLCALL flength(const char *filename);
+DLLEXPORT filelen_t	DLLCALL flength(const char *filename);
 DLLEXPORT time_t	DLLCALL fdate(const char *filename);
 DLLEXPORT int		DLLCALL setfdate(const char* filename, time_t t);
 DLLEXPORT BOOL		DLLCALL	isdir(const char *filename);
-- 
GitLab