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

Unified Diff: base/command_line.cc

Issue 3134008: CommandLine: eliminate wstring-accepting AppendLooseValue (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: utf8 Created 10 years, 4 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 | « base/command_line.h ('k') | base/process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line.cc
diff --git a/base/command_line.cc b/base/command_line.cc
index 5767669ca5cb2b9003c6c18b19e4542fe21d1405..c5c2b3187e02861ed785873440efcb05649d55d7 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -422,11 +422,13 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string,
switches_[switch_string] = value;
}
-void CommandLine::AppendLooseValue(const std::wstring& value) {
- // TODO(evan): the quoting here is wrong, but current callers rely on it
- // being wrong. I have another branch which fixes all the callers.
+void CommandLine::AppendArg(const std::string& value) {
+ AppendArgNative(UTF8ToWide(value));
viettrungluu 2010/08/13 20:52:58 Could you add a |DCHECK(IsStringUTF8(value));| her
+}
+
+void CommandLine::AppendArgNative(const std::wstring& value) {
command_line_string_.append(L" ");
- command_line_string_.append(value);
+ command_line_string_.append(WindowsStyleQuote(value));
args_.push_back(value);
}
@@ -472,8 +474,12 @@ void CommandLine::AppendSwitchASCII(const std::string& switch_string,
AppendSwitchNative(switch_string, value_string);
}
-void CommandLine::AppendLooseValue(const std::wstring& value) {
- argv_.push_back(base::SysWideToNativeMB(value));
+void CommandLine::AppendArg(const std::string& value) {
+ AppendArgNative(value);
viettrungluu 2010/08/13 20:52:58 Ditto.
+}
+
+void CommandLine::AppendArgNative(const std::string& value) {
+ argv_.push_back(value);
}
void CommandLine::AppendArguments(const CommandLine& other,
@@ -499,6 +505,10 @@ void CommandLine::PrependWrapper(const std::string& wrapper) {
#endif
+void CommandLine::AppendArgPath(const FilePath& path) {
+ AppendArgNative(path.value());
+}
+
void CommandLine::AppendSwitchPath(const std::string& switch_string,
const FilePath& path) {
AppendSwitchNative(switch_string, path.value());
« no previous file with comments | « base/command_line.h ('k') | base/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698