aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-05 22:42:10 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-09-22 20:00:38 +0300
commit79334e7f20f2bf9e0de095835b48868f1238f584 (patch)
treefb1182bb184b9cf9baa0701c54438e540e87fa28 /src/xz/file_io.h
parentMSVC: xz: Use GetTickCount64() to implement mytime_now(). (diff)
downloadxz-79334e7f20f2bf9e0de095835b48868f1238f584.tar.xz
MSVC: xz: Make file_io.c and file_io.h compatible with MSVC.
Thanks to Kelvin Lee for the original patches and testing the modifications I made.
Diffstat (limited to '')
-rw-r--r--src/xz/file_io.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/xz/file_io.h b/src/xz/file_io.h
index 6992efa4..906fd960 100644
--- a/src/xz/file_io.h
+++ b/src/xz/file_io.h
@@ -18,6 +18,16 @@
# define IO_BUFFER_SIZE (BUFSIZ & ~7U)
#endif
+#ifdef _MSC_VER
+ // The first one renames both "struct stat" -> "struct _stat64"
+ // and stat() -> _stat64(). The documentation mentions only
+ // "struct __stat64", not "struct _stat64", but the latter
+ // works too.
+# define stat _stat64
+# define fstat _fstat64
+# define off_t __int64
+#endif
+
/// is_sparse() accesses the buffer as uint64_t for maximum speed.
/// The u32 and u64 members must only be access through this union