Files
MSYS2-packages/ninja/0007-Fix-some-Windows-troubles.patch
2018-10-31 10:10:11 +03:00

47 lines
1.4 KiB
Diff

From f117cc16f6ecf991d16737472f75f9328aa423f0 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sat, 1 Jul 2017 03:49:59 -0400
Subject: [PATCH 7/9] Fix some Windows troubles.
Add parentheses so that constant does not overflow; include inttypes.h
when using MinGW to get the proper macros.
---
src/disk_interface.cc | 2 +-
src/win32port.h | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/disk_interface.cc b/src/disk_interface.cc
index f83151c..4b4c4c7 100644
--- a/src/disk_interface.cc
+++ b/src/disk_interface.cc
@@ -65,7 +65,7 @@ TimeStamp TimeStampFromFileTime(const FILETIME& filetime) {
uint64_t mtime = ((uint64_t)filetime.dwHighDateTime << 32) |
((uint64_t)filetime.dwLowDateTime);
// 1600 epoch -> 2000 epoch (subtract 400 years).
- return (TimeStamp)mtime - 12622770400LL * 1000000000LL / 100;
+ return (TimeStamp)mtime - 12622770400LL * (1000000000LL / 100);
}
TimeStamp StatSingleFile(const string& path, string* err) {
diff --git a/src/win32port.h b/src/win32port.h
index 5464797..e542536 100644
--- a/src/win32port.h
+++ b/src/win32port.h
@@ -15,6 +15,13 @@
#ifndef NINJA_WIN32PORT_H_
#define NINJA_WIN32PORT_H_
+#if defined(__MINGW32__) || defined(__MINGW64__)
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+#include <inttypes.h>
+#endif
+
typedef signed short int16_t;
typedef unsigned short uint16_t;
/// A 64-bit integer type
--
2.14.1