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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 va_list args; | 42 va_list args; |
43 va_start(args, format); | 43 va_start(args, format); |
44 vfprintf(stderr, format, args); | 44 vfprintf(stderr, format, args); |
45 fprintf(stderr, "\n"); | 45 fprintf(stderr, "\n"); |
46 va_end(args); | 46 va_end(args); |
47 exit(1); | 47 exit(1); |
48 } | 48 } |
49 | 49 |
50 std::string ReadOrFail(const base::FilePath& file_name, const char* kind) { | 50 std::string ReadOrFail(const base::FilePath& file_name, const char* kind) { |
51 int64 file_size = 0; | 51 int64 file_size = 0; |
52 if (!file_util::GetFileSize(file_name, &file_size)) | 52 if (!base::GetFileSize(file_name, &file_size)) |
53 Problem("Can't read %s file.", kind); | 53 Problem("Can't read %s file.", kind); |
54 std::string buffer; | 54 std::string buffer; |
55 buffer.reserve(static_cast<size_t>(file_size)); | 55 buffer.reserve(static_cast<size_t>(file_size)); |
56 if (!base::ReadFileToString(file_name, &buffer)) | 56 if (!base::ReadFileToString(file_name, &buffer)) |
57 Problem("Can't read %s file.", kind); | 57 Problem("Can't read %s file.", kind); |
58 return buffer; | 58 return buffer; |
59 } | 59 } |
60 | 60 |
61 void WriteSinkToFile(const courgette::SinkStream *sink, | 61 void WriteSinkToFile(const courgette::SinkStream *sink, |
62 const base::FilePath& output_file) { | 62 const base::FilePath& output_file) { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 507 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); |
508 DisassembleAdjustDiff(values[0], values[1], values[2], | 508 DisassembleAdjustDiff(values[0], values[1], values[2], |
509 cmd_spread_1_adjusted); | 509 cmd_spread_1_adjusted); |
510 } else { | 510 } else { |
511 UsageProblem("No operation specified"); | 511 UsageProblem("No operation specified"); |
512 } | 512 } |
513 } | 513 } |
514 | 514 |
515 return 0; | 515 return 0; |
516 } | 516 } |
OLD | NEW |