Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit f117cc1

Browse files
committed
Fix some Windows troubles.
Add parentheses so that constant does not overflow; include inttypes.h when using MinGW to get the proper macros.
1 parent d2bf82f commit f117cc1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/disk_interface.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TimeStamp TimeStampFromFileTime(const FILETIME& filetime) {
6565
uint64_t mtime = ((uint64_t)filetime.dwHighDateTime << 32) |
6666
((uint64_t)filetime.dwLowDateTime);
6767
// 1600 epoch -> 2000 epoch (subtract 400 years).
68-
return (TimeStamp)mtime - 12622770400LL * 1000000000LL / 100;
68+
return (TimeStamp)mtime - 12622770400LL * (1000000000LL / 100);
6969
}
7070

7171
TimeStamp StatSingleFile(const string& path, string* err) {

src/win32port.h

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
#ifndef NINJA_WIN32PORT_H_
1616
#define NINJA_WIN32PORT_H_
1717

18+
#if defined(__MINGW32__) || defined(__MINGW64__)
19+
#ifndef __STDC_FORMAT_MACROS
20+
#define __STDC_FORMAT_MACROS
21+
#endif
22+
#include <inttypes.h>
23+
#endif
24+
1825
typedef signed short int16_t;
1926
typedef unsigned short uint16_t;
2027
/// A 64-bit integer type

0 commit comments

Comments
 (0)