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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include <string> | 8 #include <string> |
6 #include <vector> | 9 #include <vector> |
7 | 10 |
8 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
9 #include "base/basictypes.h" | |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
17 #include "courgette/courgette.h" | 19 #include "courgette/courgette.h" |
18 #include "courgette/streams.h" | 20 #include "courgette/streams.h" |
19 #include "courgette/third_party/bsdiff.h" | 21 #include "courgette/third_party/bsdiff.h" |
(...skipping 21 matching lines...) Expand all Loading... |
41 void Problem(const char* format, ...) { | 43 void Problem(const char* format, ...) { |
42 va_list args; | 44 va_list args; |
43 va_start(args, format); | 45 va_start(args, format); |
44 vfprintf(stderr, format, args); | 46 vfprintf(stderr, format, args); |
45 fprintf(stderr, "\n"); | 47 fprintf(stderr, "\n"); |
46 va_end(args); | 48 va_end(args); |
47 exit(1); | 49 exit(1); |
48 } | 50 } |
49 | 51 |
50 std::string ReadOrFail(const base::FilePath& file_name, const char* kind) { | 52 std::string ReadOrFail(const base::FilePath& file_name, const char* kind) { |
51 int64 file_size = 0; | 53 int64_t file_size = 0; |
52 if (!base::GetFileSize(file_name, &file_size)) | 54 if (!base::GetFileSize(file_name, &file_size)) |
53 Problem("Can't read %s file.", kind); | 55 Problem("Can't read %s file.", kind); |
54 std::string buffer; | 56 std::string buffer; |
55 buffer.reserve(static_cast<size_t>(file_size)); | 57 buffer.reserve(static_cast<size_t>(file_size)); |
56 if (!base::ReadFileToString(file_name, &buffer)) | 58 if (!base::ReadFileToString(file_name, &buffer)) |
57 Problem("Can't read %s file.", kind); | 59 Problem("Can't read %s file.", kind); |
58 return buffer; | 60 return buffer; |
59 } | 61 } |
60 | 62 |
61 void WriteSinkToFile(const courgette::SinkStream *sink, | 63 void WriteSinkToFile(const courgette::SinkStream *sink, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 510 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); |
509 DisassembleAdjustDiff(values[0], values[1], values[2], | 511 DisassembleAdjustDiff(values[0], values[1], values[2], |
510 cmd_spread_1_adjusted); | 512 cmd_spread_1_adjusted); |
511 } else { | 513 } else { |
512 UsageProblem("No operation specified"); | 514 UsageProblem("No operation specified"); |
513 } | 515 } |
514 } | 516 } |
515 | 517 |
516 return 0; | 518 return 0; |
517 } | 519 } |
OLD | NEW |