OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 bool cmd_make_bsdiff_patch = command_line.HasSwitch("genbsdiff"); | 357 bool cmd_make_bsdiff_patch = command_line.HasSwitch("genbsdiff"); |
358 bool cmd_apply_bsdiff_patch = command_line.HasSwitch("applybsdiff"); | 358 bool cmd_apply_bsdiff_patch = command_line.HasSwitch("applybsdiff"); |
359 bool cmd_spread_1_adjusted = command_line.HasSwitch("gen1a"); | 359 bool cmd_spread_1_adjusted = command_line.HasSwitch("gen1a"); |
360 bool cmd_spread_1_unadjusted = command_line.HasSwitch("gen1u"); | 360 bool cmd_spread_1_unadjusted = command_line.HasSwitch("gen1u"); |
361 | 361 |
362 std::vector<std::wstring> values = command_line.GetLooseValues(); | 362 std::vector<std::wstring> values = command_line.GetLooseValues(); |
363 | 363 |
364 // '-repeat=N' is for debugging. Running many iterations can reveal leaks and | 364 // '-repeat=N' is for debugging. Running many iterations can reveal leaks and |
365 // bugs in cleanup. | 365 // bugs in cleanup. |
366 int repeat_count = 1; | 366 int repeat_count = 1; |
367 std::wstring repeat_switch = command_line.GetSwitchValue("repeat"); | 367 std::string repeat_switch = command_line.GetSwitchValueASCII("repeat"); |
368 if (!repeat_switch.empty()) | 368 if (!repeat_switch.empty()) |
369 if (!WideStringToInt(repeat_switch, &repeat_count)) | 369 if (!StringToInt(repeat_switch, &repeat_count)) |
370 repeat_count = 1; | 370 repeat_count = 1; |
371 | 371 |
372 if (cmd_dis + cmd_asm + cmd_disadj + cmd_make_patch + cmd_apply_patch + | 372 if (cmd_dis + cmd_asm + cmd_disadj + cmd_make_patch + cmd_apply_patch + |
373 cmd_make_bsdiff_patch + cmd_apply_bsdiff_patch + | 373 cmd_make_bsdiff_patch + cmd_apply_bsdiff_patch + |
374 cmd_spread_1_adjusted + cmd_spread_1_unadjusted | 374 cmd_spread_1_adjusted + cmd_spread_1_unadjusted |
375 != 1) | 375 != 1) |
376 UsageProblem( | 376 UsageProblem( |
377 "Must have exactly one of:\n" | 377 "Must have exactly one of:\n" |
378 " -asm, -dis, -disadj, -gen or -apply, -genbsdiff or -applybsdiff."); | 378 " -asm, -dis, -disadj, -gen or -apply, -genbsdiff or -applybsdiff."); |
379 | 379 |
(...skipping 29 matching lines...) Expand all Loading... |
409 } else if (cmd_spread_1_adjusted || cmd_spread_1_unadjusted) { | 409 } else if (cmd_spread_1_adjusted || cmd_spread_1_unadjusted) { |
410 if (values.size() != 3) | 410 if (values.size() != 3) |
411 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 411 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); |
412 DisassembleAdjustDiff(values[0], values[1], values[2], | 412 DisassembleAdjustDiff(values[0], values[1], values[2], |
413 cmd_spread_1_adjusted); | 413 cmd_spread_1_adjusted); |
414 } else { | 414 } else { |
415 UsageProblem("No operation specified"); | 415 UsageProblem("No operation specified"); |
416 } | 416 } |
417 } | 417 } |
418 } | 418 } |
OLD | NEW |