OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 bool cmd_disadj = command_line.HasSwitch("disadj"); | 412 bool cmd_disadj = command_line.HasSwitch("disadj"); |
413 bool cmd_make_patch = command_line.HasSwitch("gen"); | 413 bool cmd_make_patch = command_line.HasSwitch("gen"); |
414 bool cmd_apply_patch = command_line.HasSwitch("apply"); | 414 bool cmd_apply_patch = command_line.HasSwitch("apply"); |
415 bool cmd_make_bsdiff_patch = command_line.HasSwitch("genbsdiff"); | 415 bool cmd_make_bsdiff_patch = command_line.HasSwitch("genbsdiff"); |
416 bool cmd_apply_bsdiff_patch = command_line.HasSwitch("applybsdiff"); | 416 bool cmd_apply_bsdiff_patch = command_line.HasSwitch("applybsdiff"); |
417 bool cmd_spread_1_adjusted = command_line.HasSwitch("gen1a"); | 417 bool cmd_spread_1_adjusted = command_line.HasSwitch("gen1a"); |
418 bool cmd_spread_1_unadjusted = command_line.HasSwitch("gen1u"); | 418 bool cmd_spread_1_unadjusted = command_line.HasSwitch("gen1u"); |
419 | 419 |
420 // TODO(evanm): this whole file should use FilePaths instead of wstrings. | 420 // TODO(evanm): this whole file should use FilePaths instead of wstrings. |
421 std::vector<std::wstring> values; | 421 std::vector<std::wstring> values; |
422 for (size_t i = 0; i < command_line.args().size(); ++i) { | 422 const CommandLine::StringVector& args = command_line.GetArgs(); |
| 423 for (size_t i = 0; i < args.size(); ++i) { |
423 #if defined(OS_WIN) | 424 #if defined(OS_WIN) |
424 values.push_back(command_line.args()[i]); | 425 values.push_back(args[i]); |
425 #else | 426 #else |
426 values.push_back(ASCIIToWide(command_line.args()[i])); | 427 values.push_back(ASCIIToWide(args[i])); |
427 #endif | 428 #endif |
428 } | 429 } |
429 | 430 |
430 // '-repeat=N' is for debugging. Running many iterations can reveal leaks and | 431 // '-repeat=N' is for debugging. Running many iterations can reveal leaks and |
431 // bugs in cleanup. | 432 // bugs in cleanup. |
432 int repeat_count = 1; | 433 int repeat_count = 1; |
433 std::string repeat_switch = command_line.GetSwitchValueASCII("repeat"); | 434 std::string repeat_switch = command_line.GetSwitchValueASCII("repeat"); |
434 if (!repeat_switch.empty()) | 435 if (!repeat_switch.empty()) |
435 if (!base::StringToInt(repeat_switch, &repeat_count)) | 436 if (!base::StringToInt(repeat_switch, &repeat_count)) |
436 repeat_count = 1; | 437 repeat_count = 1; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } else if (cmd_spread_1_adjusted || cmd_spread_1_unadjusted) { | 476 } else if (cmd_spread_1_adjusted || cmd_spread_1_unadjusted) { |
476 if (values.size() != 3) | 477 if (values.size() != 3) |
477 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 478 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); |
478 DisassembleAdjustDiff(values[0], values[1], values[2], | 479 DisassembleAdjustDiff(values[0], values[1], values[2], |
479 cmd_spread_1_adjusted); | 480 cmd_spread_1_adjusted); |
480 } else { | 481 } else { |
481 UsageProblem("No operation specified"); | 482 UsageProblem("No operation specified"); |
482 } | 483 } |
483 } | 484 } |
484 } | 485 } |
OLD | NEW |