Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: tools/tool_support.cc

Issue 1120383003: Get generate_dump compiling on Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@tools
Patch Set: fix mac; no implicit conversion to std::string for StringPiece Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/tool_support.h ('k') | tools/tools.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/tool_support.cc
diff --git a/tools/tool_support.cc b/tools/tool_support.cc
index f4960246bb8638c33a292e6cdafff89ee80a34cc..e911f6348d79ce06619a3093cd16218edd377187 100644
--- a/tools/tool_support.cc
+++ b/tools/tool_support.cc
@@ -16,6 +16,10 @@
#include <stdio.h>
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/utf_string_conversions.h"
#include "package.h"
namespace crashpad {
@@ -67,4 +71,31 @@ void ToolSupport::UsageHint(const std::string& me, const char* hint) {
}
#endif // OS_POSIX
+#if defined(OS_WIN)
+
+// static
+int ToolSupport::Wmain(int argc, wchar_t* argv[], int (*entry)(int, char* [])) {
+ scoped_ptr<char* []> argv_as_utf8(new char* [argc + 1]);
+ std::vector<std::string> storage;
+ storage.reserve(argc);
+ for (int i = 0; i < argc; ++i) {
+ storage.push_back(base::UTF16ToUTF8(argv[i]));
+ argv_as_utf8[i] = &storage[i][0];
+ }
+ argv_as_utf8[argc] = nullptr;
+ return entry(argc, argv_as_utf8.get());
+}
+
+#endif // OS_WIN
+
+// static
+base::FilePath::StringType ToolSupport::CommandLineArgumentToFilePathStringType(
+ const base::StringPiece& path) {
+#if defined(OS_POSIX)
+ return path.as_string();
+#elif defined(OS_WIN)
+ return base::UTF8ToUTF16(path);
+#endif // OS_POSIX
+}
+
} // namespace crashpad
« no previous file with comments | « tools/tool_support.h ('k') | tools/tools.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698