diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index 8382624ffb26de86d3200b3888c2f639b1481d5f..dd913bdbdb5a8fd740edaadb4d0fc09b47bc2fcf 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 c1a4f054709ab463dcc176bbfcc4bae104ed57f2..5dae2dde1da40d84a657d52d3cd3a1f56e6ffa56 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);