summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-07-27 22:49:30 (GMT)
committerEvan Martin <martine@danga.com>2012-07-27 22:49:30 (GMT)
commitb26f978ac3d7c5fd91de675bba62f31f704e0e04 (patch)
tree310986e41d086cfa3d54eafeb217edf8d9dc28bf
parentfa8b3003d350d7dc22d2b722401134eeb0dcfff5 (diff)
parent44105a941b1b973fe4554024e34e09b8aeab64b1 (diff)
downloadNinja-b26f978ac3d7c5fd91de675bba62f31f704e0e04.zip
Ninja-b26f978ac3d7c5fd91de675bba62f31f704e0e04.tar.gz
Ninja-b26f978ac3d7c5fd91de675bba62f31f704e0e04.tar.bz2
Merge pull request #378 from syntheticpp/msvc-fixes
also build with msvc
-rw-r--r--src/hash_map.h6
-rw-r--r--src/minidump-win32.cc3
-rw-r--r--src/ninja.cc6
3 files changed, 10 insertions, 5 deletions
diff --git a/src/hash_map.h b/src/hash_map.h
index 15e86da..ff2f7ba 100644
--- a/src/hash_map.h
+++ b/src/hash_map.h
@@ -55,16 +55,16 @@ using stdext::hash_compare;
struct StringPieceCmp : public hash_compare<StringPiece> {
size_t operator()(const StringPiece& key) const {
- return MurmurHash2(key.str_, key.len_);
+ return MurmurHash2(key.str(), key.len());
}
bool operator()(const StringPiece& a, const StringPiece& b) const {
- int cmp = strncmp(a.str_, b.str_, min(a.len_, b.len_));
+ int cmp = strncmp(a.str(), b.str(), min(a.len(), b.len()));
if (cmp < 0) {
return true;
} else if (cmp > 0) {
return false;
} else {
- return a.len_ < b.len_;
+ return a.len() < b.len();
}
}
};
diff --git a/src/minidump-win32.cc b/src/minidump-win32.cc
index f7067f3..c79ec0e 100644
--- a/src/minidump-win32.cc
+++ b/src/minidump-win32.cc
@@ -14,8 +14,9 @@
#ifndef NINJA_BOOTSTRAP
-#include <DbgHelp.h>
#include <windows.h>
+#include <DbgHelp.h>
+
#include "util.h"
diff --git a/src/ninja.cc b/src/ninja.cc
index c1caf37..538d0d7 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -628,9 +628,13 @@ int RunBuild(Globals* globals, int argc, char** argv) {
#ifdef _MSC_VER
+} // anonymous namespace
+
// Defined in minidump-win32.cc.
void CreateWin32MiniDump(_EXCEPTION_POINTERS* pep);
+namespace {
+
/// This handler processes fatal crashes that you can't catch
/// Test example: C++ exception in a stack-unwind-block
/// Real-world example: ninja launched a compiler to process a tricky
@@ -820,7 +824,7 @@ int main(int argc, char** argv) {
#if !defined(NINJA_BOOTSTRAP) && defined(_MSC_VER)
// Set a handler to catch crashes not caught by the __try..__except
// block (e.g. an exception in a stack-unwind-block).
- set_terminate(ninja_terminate_fct);
+ set_terminate(TerminateHandler);
__try {
// Running inside __try ... __except suppresses any Windows error
// dialogs for errors such as bad_alloc.