path: root/compat/mingw.h
diff options
authorJohannes Schindelin <>2009-03-05 16:05:12 (GMT)
committerJunio C Hamano <>2009-03-05 23:08:53 (GMT)
commit1d4e4cd4a108dc105f6c8e739c69b9261d4e92a5 (patch)
tree7f71e1f085188deaa6c65edd6d46b3743454fe1d /compat/mingw.h
parentfad5c96756fe9524fcb4e6ab7468368c2fb20fa0 (diff)
MinGW: 64-bit file offsets
The type 'off_t' should be used everywhere so that the bit-depth of that type can be adjusted in the standard C library, and you just need to recompile your program to benefit from the extended precision. Only that it was not done that way in the MS runtime library. This patch reroutes off_t to off64_t and provides the other necessary changes so that finally, clones larger than 2 gigabyte work on Windows (provided you are on a file system that allows files larger than 2gb). Initial patch by Sickboy <>. Signed-off-by: Johannes Schindelin <> Acked-by: Johannes Sixt <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'compat/mingw.h')
1 files changed, 4 insertions, 1 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index a255898..cb9c4d4 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -163,11 +163,14 @@ int mingw_rename(const char*, const char*);
/* Use mingw_lstat() instead of lstat()/stat() and
* mingw_fstat() instead of fstat() on Windows.
+#define off_t off64_t
+#define stat _stati64
+#define lseek _lseeki64
int mingw_lstat(const char *file_name, struct stat *buf);
int mingw_fstat(int fd, struct stat *buf);
#define fstat mingw_fstat
#define lstat mingw_lstat
-#define stat(x,y) mingw_lstat(x,y)
+#define stat64(x,y) mingw_lstat(x,y)
int mingw_utime(const char *file_name, const struct utimbuf *times);
#define utime mingw_utime