diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-12 20:31:13 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-12 20:31:13 +0000 |
commit | a015f9d29bdf73788a620fee73120022b7fa4a71 (patch) | |
tree | 257b21aa7af125b6f6dc815a247ba59e850b8197 /base | |
parent | cf299bca597ce630d636a81dbd8421db9a0b5f9b (diff) | |
download | chromium_src-a015f9d29bdf73788a620fee73120022b7fa4a71.zip chromium_src-a015f9d29bdf73788a620fee73120022b7fa4a71.tar.gz chromium_src-a015f9d29bdf73788a620fee73120022b7fa4a71.tar.bz2 |
CommandLine: remove three useless functions.
PrefixedSwitchString was full of encoding conversions, but there was only one
real caller, and the function is trivial.
Terminate is leftover cruft.
TEST=compiles
Review URL: http://codereview.chromium.org/3138001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/command_line.cc | 44 | ||||
-rw-r--r-- | base/command_line.h | 13 |
2 files changed, 10 insertions, 47 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index 906c8f4..5767669 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -353,37 +353,10 @@ std::string CommandLine::command_line_string() const { } #endif -// static -std::wstring CommandLine::PrefixedSwitchString( - const std::string& switch_string) { -#if defined(OS_WIN) - return kSwitchPrefixes[0] + ASCIIToWide(switch_string); -#else - return ASCIIToWide(kSwitchPrefixes[0] + switch_string); -#endif -} - -// static -std::wstring CommandLine::PrefixedSwitchStringWithValue( - const std::string& switch_string, const std::wstring& value_string) { - if (value_string.empty()) { - return PrefixedSwitchString(switch_string); - } - - return PrefixedSwitchString(switch_string + -#if defined(OS_WIN) - WideToASCII(kSwitchValueSeparator) -#else - kSwitchValueSeparator -#endif - ) + value_string; -} - #if defined(OS_WIN) void CommandLine::AppendSwitch(const std::string& switch_string) { - std::wstring prefixed_switch_string = PrefixedSwitchString(switch_string); command_line_string_.append(L" "); - command_line_string_.append(prefixed_switch_string); + command_line_string_.append(kSwitchPrefixes[0] + ASCIIToWide(switch_string)); switches_[switch_string] = L""; } @@ -437,15 +410,16 @@ static std::wstring WindowsStyleQuote(const std::wstring& arg) { } void CommandLine::AppendSwitchNative(const std::string& switch_string, - const std::wstring& value_string) { - std::wstring quoted_value_string = WindowsStyleQuote(value_string); + const std::wstring& value) { std::wstring combined_switch_string = - PrefixedSwitchStringWithValue(switch_string, quoted_value_string); + kSwitchPrefixes[0] + ASCIIToWide(switch_string); + if (!value.empty()) + combined_switch_string += kSwitchValueSeparator + WindowsStyleQuote(value); command_line_string_.append(L" "); command_line_string_.append(combined_switch_string); - switches_[switch_string] = value_string; + switches_[switch_string] = value; } void CommandLine::AppendLooseValue(const std::wstring& value) { @@ -486,8 +460,10 @@ void CommandLine::AppendSwitch(const std::string& switch_string) { void CommandLine::AppendSwitchNative(const std::string& switch_string, const std::string& value) { - argv_.push_back(kSwitchPrefixes[0] + switch_string + - kSwitchValueSeparator + value); + std::string combined_switch_string = kSwitchPrefixes[0] + switch_string; + if (!value.empty()) + combined_switch_string += kSwitchValueSeparator + value; + argv_.push_back(combined_switch_string); switches_[switch_string] = value; } diff --git a/base/command_line.h b/base/command_line.h index ecfb1bd..10fbc92 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -79,9 +79,6 @@ class CommandLine { // If Init is called only once, e.g. in main(), calling Reset() is not // necessary. static void Reset(); - // The same function snuck into this class under two different names; - // this one remains for backwards compat with the older o3d build. - static void Terminate() { Reset(); } // Get the singleton CommandLine representing the current process's // command line. Note: returned value is mutable, but not thread safe; @@ -134,16 +131,6 @@ class CommandLine { // Returns the program part of the command line string (the first item). FilePath GetProgram() const; - // Return a copy of the string prefixed with a switch prefix. - // Used internally. - static std::wstring PrefixedSwitchString(const std::string& switch_string); - - // Return a copy of the string prefixed with a switch prefix, - // and appended with the given value. Used internally. - static std::wstring PrefixedSwitchStringWithValue( - const std::string& switch_string, - const std::wstring& value_string); - // Append a switch to the command line. void AppendSwitch(const std::string& switch_string); |