diff options
-rw-r--r-- | base/command_line.cc | 28 | ||||
-rw-r--r-- | base/command_line.h | 2 |
2 files changed, 10 insertions, 20 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index a68c8f3..4d76ed0 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -297,7 +297,16 @@ bool CommandLine::HasSwitch(const std::wstring& switch_string) const { std::string CommandLine::GetSwitchValueASCII( const std::string& switch_string) const { - return WideToASCII(GetSwitchValue(switch_string)); + CommandLine::StringType value = GetSwitchValueNative(switch_string); + if (!IsStringASCII(value)) { + LOG(WARNING) << "Value of --" << switch_string << " must be ASCII."; + return ""; + } +#if defined(OS_WIN) + return WideToASCII(value); +#else + return value; +#endif } FilePath CommandLine::GetSwitchValuePath( @@ -322,23 +331,6 @@ CommandLine::StringType CommandLine::GetSwitchValueNative( } } -std::wstring CommandLine::GetSwitchValue( - const std::string& switch_string) const { - // TODO(evanm): deprecate. - CommandLine::StringType value = GetSwitchValueNative(switch_string); -#if defined(OS_WIN) - return value; -#else - return base::SysNativeMBToWide(value); -#endif -} - -std::wstring CommandLine::GetSwitchValue( - const std::wstring& switch_string) const { - // TODO(evanm): deprecate. - return GetSwitchValue(WideToASCII(switch_string)); -} - FilePath CommandLine::GetProgram() const { return FilePath::FromWStringHack(program()); } diff --git a/base/command_line.h b/base/command_line.h index ce10d65..9cad0f1 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -162,8 +162,6 @@ class CommandLine { // APIs that work with wstrings are deprecated. // TODO(evanm): remove all of these. - std::wstring GetSwitchValue(const std::string& switch_string) const; - std::wstring GetSwitchValue(const std::wstring& switch_string) const; std::wstring program() const; #if defined(OS_WIN) // Deprecated on non-Windows. |