Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: courgette/courgette_tool.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/test/image_decoder_test.cc ('k') | courgette/ensemble_apply.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
63 int count = 63 int count =
64 file_util::WriteFile(output_file, 64 base::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()));
67 if (count == -1) 67 if (count == -1)
68 Problem("Can't write output."); 68 Problem("Can't write output.");
69 if (static_cast<size_t>(count) != sink->Length()) 69 if (static_cast<size_t>(count) != sink->Length())
70 Problem("Incomplete write."); 70 Problem("Incomplete write.");
71 } 71 }
72 72
73 void Disassemble(const base::FilePath& input_file, 73 void Disassemble(const base::FilePath& input_file,
74 const base::FilePath& output_file) { 74 const base::FilePath& output_file) {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « content/test/image_decoder_test.cc ('k') | courgette/ensemble_apply.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698