| Index: base/command_line.cc
|
| diff --git a/base/command_line.cc b/base/command_line.cc
|
| index 1f5edce0fff584716c5d495909707becd6889c85..fb7c81376ba4bfce5936b4298989b2144862c0fb 100644
|
| --- a/base/command_line.cc
|
| +++ b/base/command_line.cc
|
| @@ -70,7 +70,7 @@ bool IsSwitch(const CommandLine::StringType& string,
|
| }
|
|
|
| // Append switches and arguments, keeping switches before arguments.
|
| -void AppendSwitchesAndArguments(CommandLine& command_line,
|
| +void AppendSwitchesAndArguments(CommandLine* command_line,
|
| const CommandLine::StringVector& argv) {
|
| bool parse_switches = true;
|
| for (size_t i = 1; i < argv.size(); ++i) {
|
| @@ -82,13 +82,13 @@ void AppendSwitchesAndArguments(CommandLine& command_line,
|
| parse_switches &= (arg != kSwitchTerminator);
|
| if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) {
|
| #if defined(OS_WIN)
|
| - command_line.AppendSwitchNative(UTF16ToASCII(switch_string),
|
| - switch_value);
|
| + command_line->AppendSwitchNative(UTF16ToASCII(switch_string),
|
| + switch_value);
|
| #elif defined(OS_POSIX)
|
| - command_line.AppendSwitchNative(switch_string, switch_value);
|
| + command_line->AppendSwitchNative(switch_string, switch_value);
|
| #endif
|
| } else {
|
| - command_line.AppendArgNative(arg);
|
| + command_line->AppendArgNative(arg);
|
| }
|
| }
|
| }
|
| @@ -96,7 +96,7 @@ void AppendSwitchesAndArguments(CommandLine& command_line,
|
| // Lowercase switches for backwards compatiblity *on Windows*.
|
| std::string LowerASCIIOnWindows(const std::string& string) {
|
| #if defined(OS_WIN)
|
| - return base::StringToLowerASCII(string);
|
| + return StringToLowerASCII(string);
|
| #elif defined(OS_POSIX)
|
| return string;
|
| #endif
|
| @@ -105,28 +105,27 @@ std::string LowerASCIIOnWindows(const std::string& string) {
|
|
|
| #if defined(OS_WIN)
|
| // Quote a string as necessary for CommandLineToArgvW compatiblity *on Windows*.
|
| -base::string16 QuoteForCommandLineToArgvW(const base::string16& arg,
|
| - bool quote_placeholders) {
|
| +string16 QuoteForCommandLineToArgvW(const string16& arg,
|
| + bool quote_placeholders) {
|
| // We follow the quoting rules of CommandLineToArgvW.
|
| // http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
|
| - base::string16 quotable_chars(L" \\\"");
|
| + string16 quotable_chars(L" \\\"");
|
| // We may also be required to quote '%', which is commonly used in a command
|
| // line as a placeholder. (It may be substituted for a string with spaces.)
|
| if (quote_placeholders)
|
| quotable_chars.push_back(L'%');
|
| - if (arg.find_first_of(quotable_chars) == base::string16::npos) {
|
| + if (arg.find_first_of(quotable_chars) == string16::npos) {
|
| // No quoting necessary.
|
| return arg;
|
| }
|
|
|
| - base::string16 out;
|
| + string16 out;
|
| out.push_back(L'"');
|
| for (size_t i = 0; i < arg.size(); ++i) {
|
| if (arg[i] == '\\') {
|
| // Find the extent of this run of backslashes.
|
| size_t start = i, end = start + 1;
|
| - for (; end < arg.size() && arg[end] == '\\'; ++end)
|
| - /* empty */;
|
| + for (; end < arg.size() && arg[end] == '\\'; ++end) {}
|
| size_t backslash_count = end - start;
|
|
|
| // Backslashes are escapes only if the run is followed by a double quote.
|
| @@ -230,7 +229,7 @@ bool CommandLine::InitializedForCurrentProcess() {
|
|
|
| #if defined(OS_WIN)
|
| // static
|
| -CommandLine CommandLine::FromString(const base::string16& command_line) {
|
| +CommandLine CommandLine::FromString(const string16& command_line) {
|
| CommandLine cmd(NO_PROGRAM);
|
| cmd.ParseFromString(command_line);
|
| return cmd;
|
| @@ -250,7 +249,7 @@ void CommandLine::InitFromArgv(const StringVector& argv) {
|
| switches_.clear();
|
| begin_args_ = 1;
|
| SetProgram(argv.empty() ? FilePath() : FilePath(argv[0]));
|
| - AppendSwitchesAndArguments(*this, argv);
|
| + AppendSwitchesAndArguments(this, argv);
|
| }
|
|
|
| FilePath CommandLine::GetProgram() const {
|
| @@ -304,7 +303,7 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string,
|
| const CommandLine::StringType& value) {
|
| std::string switch_key(LowerASCIIOnWindows(switch_string));
|
| #if defined(OS_WIN)
|
| - StringType combined_switch_string(ASCIIToWide(switch_key));
|
| + StringType combined_switch_string(ASCIIToUTF16(switch_key));
|
| #elif defined(OS_POSIX)
|
| StringType combined_switch_string(switch_string);
|
| #endif
|
| @@ -322,7 +321,7 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string,
|
| void CommandLine::AppendSwitchASCII(const std::string& switch_string,
|
| const std::string& value_string) {
|
| #if defined(OS_WIN)
|
| - AppendSwitchNative(switch_string, ASCIIToWide(value_string));
|
| + AppendSwitchNative(switch_string, ASCIIToUTF16(value_string));
|
| #elif defined(OS_POSIX)
|
| AppendSwitchNative(switch_string, value_string);
|
| #endif
|
| @@ -369,7 +368,7 @@ void CommandLine::AppendArguments(const CommandLine& other,
|
| bool include_program) {
|
| if (include_program)
|
| SetProgram(other.GetProgram());
|
| - AppendSwitchesAndArguments(*this, other.argv());
|
| + AppendSwitchesAndArguments(this, other.argv());
|
| }
|
|
|
| void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) {
|
| @@ -385,8 +384,8 @@ void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) {
|
| }
|
|
|
| #if defined(OS_WIN)
|
| -void CommandLine::ParseFromString(const base::string16& command_line) {
|
| - base::string16 command_line_string;
|
| +void CommandLine::ParseFromString(const string16& command_line) {
|
| + string16 command_line_string;
|
| TrimWhitespace(command_line, TRIM_ALL, &command_line_string);
|
| if (command_line_string.empty())
|
| return;
|
| @@ -437,8 +436,7 @@ CommandLine::StringType CommandLine::GetArgumentsStringInternal(
|
| #endif
|
| params.append(kSwitchValueSeparator + switch_value);
|
| }
|
| - }
|
| - else {
|
| + } else {
|
| #if defined(OS_WIN)
|
| arg = QuoteForCommandLineToArgvW(arg, quote_placeholders);
|
| #endif
|
|
|