Fix a couple of Windows 2Gig file size issues.
[platform/upstream/flac.git] / src / share / grabbag / file.c
index d073c4b..04e3aad 100644 (file)
@@ -1,5 +1,5 @@
 /* grabbag - Convenience lib for various routines common to several tools
- * Copyright (C) 2002,2003,2004,2005,2006,2007  Josh Coalson
+ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -61,11 +61,17 @@ void grabbag__file_copy_metadata(const char *srcpath, const char *destpath)
        }
 }
 
-off_t grabbag__file_get_filesize(const char *srcpath)
+FLAC__off_t grabbag__file_get_filesize(const char *srcpath)
 {
+#if defined _MSC_VER || defined __MINGW32__
+       struct _stat64 srcstat;
+
+       if(0 == _stat64(srcpath, &srcstat))
+#else
        struct stat srcstat;
 
        if(0 == stat(srcpath, &srcstat))
+#endif
                return srcstat.st_size;
        else
                return -1;