From 9ef56fd56f414bc6aa231b8d65cfa4ddec4cdedb Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Tue, 19 Jun 2012 13:15:41 -0700 Subject: [PATCH 1/3] fix win32 compile, fix BuildLogTest.WriteRead on 2nd run --- configure.py | 4 ++-- src/build_log_test.cc | 1 + src/win32port.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index 5329708cd8..feb8a98ccc 100755 --- a/configure.py +++ b/configure.py @@ -150,8 +150,8 @@ def binary(name): def shell_escape(str): """Escape str such that it's interpreted as a single argument by the shell.""" # This isn't complete, but it's just enough to make NINJA_PYTHON work. - # TODO: do the appropriate thing for Windows-style cmd here, perhaps by - # just returning the input string. + if platform == 'windows': + return str if '"' in str: return "'%s'" % str.replace("'", "\\'") return str diff --git a/src/build_log_test.cc b/src/build_log_test.cc index 9fb42c9e97..8e73e6b061 100644 --- a/src/build_log_test.cc +++ b/src/build_log_test.cc @@ -64,6 +64,7 @@ TEST_F(BuildLogTest, WriteRead) { ASSERT_TRUE(*e1 == *e2); ASSERT_EQ(15, e1->start_time); ASSERT_EQ("out", e1->output); + log2.Close(); } TEST_F(BuildLogTest, FirstWriteAddsSignature) { diff --git a/src/win32port.h b/src/win32port.h index 8b42b38945..3799af11dc 100644 --- a/src/win32port.h +++ b/src/win32port.h @@ -16,6 +16,8 @@ #define NINJA_WIN32PORT_H_ #pragma once +typedef signed short int16_t; +typedef unsigned short uint16_t; /// A 64-bit integer type typedef signed long long int64_t; typedef unsigned long long uint64_t; From dd91094196ba8a824cd2f12ceec7e12452c4d32c Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Tue, 19 Jun 2012 14:32:04 -0700 Subject: [PATCH 2/3] don't leak file handle on fail-to-upgrade case --- src/build_log.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/build_log.cc b/src/build_log.cc index 02a9fb599a..5eddf8f87a 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -235,6 +235,7 @@ bool BuildLog::Load(const string& path, string* err) { if (log_version < kOldestSupportedVersion) { *err = "unable to extract version from build log, perhaps due to " "being too old; you must clobber your build output and rebuild"; + fclose(file); return false; } } From 98d1b7b718de76831ddf4da283e6c0510266322b Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Tue, 19 Jun 2012 14:32:39 -0700 Subject: [PATCH 3/3] remove unnecessary manual Close() --- src/build_log_test.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/build_log_test.cc b/src/build_log_test.cc index 8e73e6b061..9fb42c9e97 100644 --- a/src/build_log_test.cc +++ b/src/build_log_test.cc @@ -64,7 +64,6 @@ TEST_F(BuildLogTest, WriteRead) { ASSERT_TRUE(*e1 == *e2); ASSERT_EQ(15, e1->start_time); ASSERT_EQ("out", e1->output); - log2.Close(); } TEST_F(BuildLogTest, FirstWriteAddsSignature) {