diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 18:56:56 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-09 18:56:56 +0000 |
commit | e748e95ffaf0a4e8a485c8f0d8162de0246ffcbf (patch) | |
tree | 016652d7dc42e1ddb97e557dd5127deadeae466e | |
parent | fe944a7847676efd6672773b6c48ef3f8b2f55f0 (diff) | |
download | chromium_src-e748e95ffaf0a4e8a485c8f0d8162de0246ffcbf.zip chromium_src-e748e95ffaf0a4e8a485c8f0d8162de0246ffcbf.tar.gz chromium_src-e748e95ffaf0a4e8a485c8f0d8162de0246ffcbf.tar.bz2 |
Remove all but one last caller of CommandLine::GetSwitchValue().
Review URL: http://codereview.chromium.org/2868117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55429 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome_frame/test/reliability/page_load_test.cc | 8 | ||||
-rw-r--r-- | net/tools/dump_cache/dump_cache.cc | 11 | ||||
-rw-r--r-- | net/tools/testserver/run_testserver.cc | 4 | ||||
-rw-r--r-- | o3d/converter/cross/converter_main.cc | 19 | ||||
-rw-r--r-- | o3d/converter_edge/cross/converter_main.cc | 28 |
5 files changed, 32 insertions, 38 deletions
diff --git a/chrome_frame/test/reliability/page_load_test.cc b/chrome_frame/test/reliability/page_load_test.cc index 799c73e..6d701cd 100644 --- a/chrome_frame/test/reliability/page_load_test.cc +++ b/chrome_frame/test/reliability/page_load_test.cc @@ -560,7 +560,7 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kStartIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( + base::StringToInt(parsed_command_line.GetSwitchValueASCII( kStartIndexSwitch), &g_start_index)); ASSERT_GT(g_start_index, 0); @@ -568,7 +568,7 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kEndIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( + base::StringToInt(parsed_command_line.GetSwitchValueASCII( kEndIndexSwitch), &g_end_index)); ASSERT_GT(g_end_index, 0); @@ -581,7 +581,7 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kIterationSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( + base::StringToInt(parsed_command_line.GetSwitchValueASCII( kIterationSwitch), &g_iterations)); ASSERT_GT(g_iterations, 0); @@ -598,7 +598,7 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kTimeoutSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( + base::StringToInt(parsed_command_line.GetSwitchValueASCII( kTimeoutSwitch), &g_timeout_ms)); ASSERT_GT(g_timeout_ms, 0); diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc index a8a477f..086a9b5 100644 --- a/net/tools/dump_cache/dump_cache.cc +++ b/net/tools/dump_cache/dump_cache.cc @@ -41,8 +41,8 @@ const char kUpgradeHelp[] = "executable should be compiled with version 5.2 being the current one."; // Folders to read and write cache files. -const wchar_t kInputPath[] = L"input"; -const wchar_t kOutputPath[] = L"output"; +const char kInputPath[] = "input"; +const char kOutputPath[] = "output"; // Dumps the file headers to stdout. const wchar_t kDumpHeaders[] = L"dump-headers"; @@ -115,14 +115,15 @@ int main(int argc, const char* argv[]) { CommandLine::Init(argc, argv); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::wstring input_path = command_line.GetSwitchValue(kInputPath); + std::wstring input_path = command_line.GetSwitchValueNative(kInputPath); if (input_path.empty()) return Help(); bool upgrade = false; bool slave_required = false; bool copy_to_text = false; - std::wstring output_path = command_line.GetSwitchValue(kOutputPath); + // TODO(evanm): port to FilePath. + std::wstring output_path = command_line.GetSwitchValueNative(kOutputPath); if (command_line.HasSwitch(kUpgrade)) upgrade = true; if (command_line.HasSwitch(kDumpToFiles)) @@ -146,7 +147,7 @@ int main(int argc, const char* argv[]) { slave_required = true; } - std::wstring pipe_number = command_line.GetSwitchValue(kPipe); + std::wstring pipe_number = command_line.GetSwitchValueNative(kPipe); if (command_line.HasSwitch(kSlave) && slave_required) return RunSlave(input_path, pipe_number); diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index edfecb7..9e0396a 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -41,7 +41,9 @@ int main(int argc, const char* argv[]) { protocol = "http"; port = net::kHTTPDefaultPort; } - std::wstring doc_root = command_line->GetSwitchValue("doc-root"); + // TODO(phajdan.jr): refactor this. + std::wstring doc_root = + command_line->GetSwitchValuePath("doc-root").ToWStringHack(); if (doc_root.empty()) { printf("Error: --doc-root must be specified\n"); PrintUsage(); diff --git a/o3d/converter/cross/converter_main.cc b/o3d/converter/cross/converter_main.cc index ee819a9..ddfc6e9 100644 --- a/o3d/converter/cross/converter_main.cc +++ b/o3d/converter/cross/converter_main.cc @@ -45,9 +45,6 @@ #include "converter/cross/converter.h" #include "utils/cross/file_path_utils.h" -using std::string; -using std::wstring; - #if defined(OS_WIN) int wmain(int argc, wchar_t **argv) { // On Windows, CommandLine::Init ignores its arguments and uses @@ -135,23 +132,21 @@ int CrossMain(int argc, char**argv) { options.convert_dds_to_png = command_line->HasSwitch("convert-dds-to-png"); options.convert_cg_to_glsl = command_line->HasSwitch("convert-cg-to-glsl"); options.converter_tool = command_line->HasSwitch("converter-tool") ? - o3d::WideToFilePath(command_line->GetSwitchValue("converter-tool")) : - converter_tool; + command_line->GetSwitchValuePath("converter-tool") : converter_tool; if (command_line->HasSwitch("base-path")) { - options.base_path = o3d::WideToFilePath( - command_line->GetSwitchValue("base-path")); + options.base_path = command_line->GetSwitchValuePath("base-path"); } if (command_line->HasSwitch("asset-paths")) { - std::vector<std::wstring> paths; - SplitString(command_line->GetSwitchValue("asset-paths"), ',', &paths); + std::vector<CommandLine::StringType> paths; + SplitString(command_line->GetSwitchValueNative("asset-paths"), ',', &paths); for (size_t ii = 0; ii < paths.size(); ++ii) { - options.file_paths.push_back(o3d::WideToFilePath(paths[ii])); + options.file_paths.push_back(FilePath(paths[ii])); } } if (command_line->HasSwitch("up-axis")) { - wstring up_axis_string = command_line->GetSwitchValue("up-axis"); + std::string up_axis_string = command_line->GetSwitchValueASCII("up-axis"); int x, y, z; - if (swscanf(up_axis_string.c_str(), L"%d,%d,%d", &x, &y, &z) != 3) { + if (sscanf(up_axis_string.c_str(), "%d,%d,%d", &x, &y, &z) != 3) { std::cerr << "Invalid --up-axis value. Should be --up-axis=x,y,z\n"; return EXIT_FAILURE; } diff --git a/o3d/converter_edge/cross/converter_main.cc b/o3d/converter_edge/cross/converter_main.cc index eef1dec..2a1c401 100644 --- a/o3d/converter_edge/cross/converter_main.cc +++ b/o3d/converter_edge/cross/converter_main.cc @@ -44,9 +44,6 @@ #include "converter_edge/cross/converter.h" #include "utils/cross/file_path_utils.h" -using std::string; -using std::wstring; - #if defined(OS_WIN) int wmain(int argc, wchar_t **argv) { // On Windows, CommandLine::Init ignores its arguments and uses @@ -113,20 +110,19 @@ int CrossMain(int argc, char**argv) { options.condition = !command_line->HasSwitch("no-condition"); options.pretty_print = command_line->HasSwitch("pretty-print"); if (command_line->HasSwitch("base-path")) { - options.base_path = o3d::WideToFilePath( - command_line->GetSwitchValue("base-path")); + options.base_path = command_line->GetSwitchValuePath("base-path"); } if (command_line->HasSwitch("asset-paths")) { - std::vector<std::wstring> paths; - SplitString(command_line->GetSwitchValue("asset-paths"), ',', &paths); + std::vector<CommandLine::StringType> paths; + SplitString(command_line->GetSwitchValueNative("asset-paths"), ',', &paths); for (size_t ii = 0; ii < paths.size(); ++ii) { - options.file_paths.push_back(o3d::WideToFilePath(paths[ii])); + options.file_paths.push_back(FilePath(paths[ii])); } } if (command_line->HasSwitch("up-axis")) { - wstring up_axis_string = command_line->GetSwitchValue("up-axis"); + std::string up_axis_string = command_line->GetSwitchValueASCII("up-axis"); int x, y, z; - if (swscanf(up_axis_string.c_str(), L"%d,%d,%d", &x, &y, &z) != 3) { + if (sscanf(up_axis_string.c_str(), "%d,%d,%d", &x, &y, &z) != 3) { std::cerr << "Invalid --up-axis value. Should be --up-axis=x,y,z\n"; return EXIT_FAILURE; } @@ -135,10 +131,10 @@ int CrossMain(int argc, char**argv) { static_cast<float>(z)); } if (command_line->HasSwitch("sharp-edge-threshold")) { - wstring soften_edge_string = - command_line->GetSwitchValue("sharp-edge-threshold"); + std::string soften_edge_string = + command_line->GetSwitchValueASCII("sharp-edge-threshold"); float soft_threshold; - if (swscanf(soften_edge_string.c_str(), L"%f", &soft_threshold) != 1) { + if (sscanf(soften_edge_string.c_str(), "%f", &soft_threshold) != 1) { std::cerr << "Invalid --sharp-edges-threshold value.\n"; return EXIT_FAILURE; } @@ -146,10 +142,10 @@ int CrossMain(int argc, char**argv) { options.sharp_edge_threshold = soft_threshold; } if (command_line->HasSwitch("sharp-edge-color")) { - wstring edge_color_str = - command_line->GetSwitchValue("sharp-edge-color"); + std::string edge_color_str = + command_line->GetSwitchValueASCII("sharp-edge-color"); int r, g, b; - if (swscanf(edge_color_str.c_str(), L"%d,%d,%d", &r, &g, &b) != 3) { + if (sscanf(edge_color_str.c_str(), "%d,%d,%d", &r, &g, &b) != 3) { std::cerr << "Invalid --sharp-edge-color value. Should be " << "--sharp-edge-color=r,g,b\n"; return EXIT_FAILURE; |