]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[pzstd] Compile with minGW 64
authorNick Terrell <terrelln@fb.com>
Tue, 6 Sep 2016 21:00:20 +0000 (14:00 -0700)
committerNick Terrell <terrelln@fb.com>
Tue, 6 Sep 2016 21:00:20 +0000 (14:00 -0700)
contrib/pzstd/utils/FileSystem.h

index cb682819d99efd3dd7323aa0ce0977dbc2f343aa..979c82b7a906a26e57a6e5baedf2c0225d26d759 100644 (file)
@@ -11,6 +11,7 @@
 #include "utils/Range.h"
 
 #include <sys/stat.h>
+#include <cerrno>
 #include <cstdint>
 #include <system_error>
 
 
 namespace pzstd {
 
+#if defined(_MSC_VER)
+using file_status = struct ::_stat64;
+#else
 using file_status = struct ::stat;
+#endif
 
 /// http://en.cppreference.com/w/cpp/filesystem/status
 inline file_status status(StringPiece path, std::error_code& ec) noexcept {
   file_status status;
-  if (stat(path.data(), &status)) {
+#if defined(_MSC_VER)
+  const auto error = ::_stat64(path.data(), &status);
+#else
+  const auto error = ::stat(path.data(), &status);
+#endif
+  if (error) {
     ec.assign(errno, std::generic_category());
   } else {
     ec.clear();