| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (!file_util::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 (!file_util::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) { |
| 63 int count = | 63 int count = |
| 64 file_util::WriteFile(output_file, | 64 file_util::WriteFile(output_file, |
| 65 reinterpret_cast<const char*>(sink->Buffer()), | 65 reinterpret_cast<const char*>(sink->Buffer()), |
| 66 static_cast<int>(sink->Length())); | 66 static_cast<int>(sink->Length())); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); | 502 UsageProblem("-gen1[au] <old_file> <new_file> <patch_files_root>"); |
| 503 DisassembleAdjustDiff(values[0], values[1], values[2], | 503 DisassembleAdjustDiff(values[0], values[1], values[2], |
| 504 cmd_spread_1_adjusted); | 504 cmd_spread_1_adjusted); |
| 505 } else { | 505 } else { |
| 506 UsageProblem("No operation specified"); | 506 UsageProblem("No operation specified"); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 | 509 |
| 510 return 0; | 510 return 0; |
| 511 } | 511 } |
| OLD | NEW |