| 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" | 
|  | 11 #include "base/file_path.h" | 
| 11 #include "base/file_util.h" | 12 #include "base/file_util.h" | 
| 12 #include "base/logging.h" | 13 #include "base/logging.h" | 
| 13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" | 
| 14 #include "base/string_util.h" | 15 #include "base/string_util.h" | 
| 15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" | 
| 16 #include "courgette/third_party/bsdiff.h" | 17 #include "courgette/third_party/bsdiff.h" | 
| 17 #include "courgette/courgette.h" | 18 #include "courgette/courgette.h" | 
| 18 #include "courgette/streams.h" | 19 #include "courgette/streams.h" | 
| 19 | 20 | 
| 20 | 21 | 
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 338   if (status != courgette::OK) Problem("-applybsdiff failed."); | 339   if (status != courgette::OK) Problem("-applybsdiff failed."); | 
| 339 | 340 | 
| 340   WriteSinkToFile(&new_stream, new_file); | 341   WriteSinkToFile(&new_stream, new_file); | 
| 341 } | 342 } | 
| 342 | 343 | 
| 343 int main(int argc, const char* argv[]) { | 344 int main(int argc, const char* argv[]) { | 
| 344   base::AtExitManager at_exit_manager; | 345   base::AtExitManager at_exit_manager; | 
| 345   CommandLine::Init(argc, argv); | 346   CommandLine::Init(argc, argv); | 
| 346   const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 347   const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 
| 347 | 348 | 
|  | 349   (void)logging::InitLogging(FILE_PATH_LITERAL("courgette.log"), | 
|  | 350                              logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | 
|  | 351                              logging::LOCK_LOG_FILE, | 
|  | 352                              logging::APPEND_TO_OLD_LOG_FILE); | 
|  | 353   logging::SetMinLogLevel(logging::LOG_VERBOSE); | 
|  | 354 | 
| 348   bool cmd_dis = command_line.HasSwitch("dis"); | 355   bool cmd_dis = command_line.HasSwitch("dis"); | 
| 349   bool cmd_asm = command_line.HasSwitch("asm"); | 356   bool cmd_asm = command_line.HasSwitch("asm"); | 
| 350   bool cmd_disadj = command_line.HasSwitch("disadj"); | 357   bool cmd_disadj = command_line.HasSwitch("disadj"); | 
| 351   bool cmd_make_patch = command_line.HasSwitch("gen"); | 358   bool cmd_make_patch = command_line.HasSwitch("gen"); | 
| 352   bool cmd_apply_patch = command_line.HasSwitch("apply"); | 359   bool cmd_apply_patch = command_line.HasSwitch("apply"); | 
| 353   bool cmd_make_bsdiff_patch = command_line.HasSwitch("genbsdiff"); | 360   bool cmd_make_bsdiff_patch = command_line.HasSwitch("genbsdiff"); | 
| 354   bool cmd_apply_bsdiff_patch = command_line.HasSwitch("applybsdiff"); | 361   bool cmd_apply_bsdiff_patch = command_line.HasSwitch("applybsdiff"); | 
| 355   bool cmd_spread_1_adjusted = command_line.HasSwitch("gen1a"); | 362   bool cmd_spread_1_adjusted = command_line.HasSwitch("gen1a"); | 
| 356   bool cmd_spread_1_unadjusted = command_line.HasSwitch("gen1u"); | 363   bool cmd_spread_1_unadjusted = command_line.HasSwitch("gen1u"); | 
| 357 | 364 | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 413     } else if (cmd_spread_1_adjusted || cmd_spread_1_unadjusted) { | 420     } else if (cmd_spread_1_adjusted || cmd_spread_1_unadjusted) { | 
| 414       if (values.size() != 3) | 421       if (values.size() != 3) | 
| 415         UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 422         UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 
| 416       DisassembleAdjustDiff(values[0], values[1], values[2], | 423       DisassembleAdjustDiff(values[0], values[1], values[2], | 
| 417                             cmd_spread_1_adjusted); | 424                             cmd_spread_1_adjusted); | 
| 418     } else { | 425     } else { | 
| 419       UsageProblem("No operation specified"); | 426       UsageProblem("No operation specified"); | 
| 420     } | 427     } | 
| 421   } | 428   } | 
| 422 } | 429 } | 
| OLD | NEW | 
|---|