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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « tools/tool_support.h ('k') | tools/tools.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "tools/tool_support.h" 15 #include "tools/tool_support.h"
16 16
17 #include <stdio.h> 17 #include <stdio.h>
18 18
19 #include <vector>
20
21 #include "base/memory/scoped_ptr.h"
22 #include "base/strings/utf_string_conversions.h"
19 #include "package.h" 23 #include "package.h"
20 24
21 namespace crashpad { 25 namespace crashpad {
22 26
23 // static 27 // static
24 void ToolSupport::Version(const base::FilePath& me) { 28 void ToolSupport::Version(const base::FilePath& me) {
25 fprintf(stderr, 29 fprintf(stderr,
26 "%s" PRFilePath " (%s) %s\n%s\n", 30 "%s" PRFilePath " (%s) %s\n%s\n",
27 me.value().c_str(), 31 me.value().c_str(),
28 PACKAGE_NAME, 32 PACKAGE_NAME,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void ToolSupport::UsageTail(const std::string& me) { 64 void ToolSupport::UsageTail(const std::string& me) {
61 UsageTail(base::FilePath(me)); 65 UsageTail(base::FilePath(me));
62 } 66 }
63 67
64 // static 68 // static
65 void ToolSupport::UsageHint(const std::string& me, const char* hint) { 69 void ToolSupport::UsageHint(const std::string& me, const char* hint) {
66 UsageHint(base::FilePath(me), hint); 70 UsageHint(base::FilePath(me), hint);
67 } 71 }
68 #endif // OS_POSIX 72 #endif // OS_POSIX
69 73
74 #if defined(OS_WIN)
75
76 // static
77 int ToolSupport::Wmain(int argc, wchar_t* argv[], int (*entry)(int, char* [])) {
78 scoped_ptr<char* []> argv_as_utf8(new char* [argc + 1]);
79 std::vector<std::string> storage;
80 storage.reserve(argc);
81 for (int i = 0; i < argc; ++i) {
82 storage.push_back(base::UTF16ToUTF8(argv[i]));
83 argv_as_utf8[i] = &storage[i][0];
84 }
85 argv_as_utf8[argc] = nullptr;
86 return entry(argc, argv_as_utf8.get());
87 }
88
89 #endif // OS_WIN
90
91 // static
92 base::FilePath::StringType ToolSupport::CommandLineArgumentToFilePathStringType(
93 const base::StringPiece& path) {
94 #if defined(OS_POSIX)
95 return path.as_string();
96 #elif defined(OS_WIN)
97 return base::UTF8ToUTF16(path);
98 #endif // OS_POSIX
99 }
100
70 } // namespace crashpad 101 } // namespace crashpad
OLDNEW
« 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