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

Side by Side Diff: courgette/ensemble_apply.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 | « courgette/courgette_tool.cc ('k') | courgette/third_party/bsdiff_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 // This file contains the code to apply a Courgette patch. 5 // This file contains the code to apply a Courgette patch.
6 6
7 #include "courgette/ensemble.h" 7 #include "courgette/ensemble.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 patch_source_stream.Init(patch_file.data(), patch_file.length()); 409 patch_source_stream.Init(patch_file.data(), patch_file.length());
410 SinkStream new_sink_stream; 410 SinkStream new_sink_stream;
411 status = ApplyEnsemblePatch(&old_source_stream, &patch_source_stream, 411 status = ApplyEnsemblePatch(&old_source_stream, &patch_source_stream,
412 &new_sink_stream); 412 &new_sink_stream);
413 if (status != C_OK) 413 if (status != C_OK)
414 return status; 414 return status;
415 415
416 // Write the patched data to |new_file_name|. 416 // Write the patched data to |new_file_name|.
417 base::FilePath new_file_path(new_file_name); 417 base::FilePath new_file_path(new_file_name);
418 int written = 418 int written =
419 file_util::WriteFile( 419 base::WriteFile(
420 new_file_path, 420 new_file_path,
421 reinterpret_cast<const char*>(new_sink_stream.Buffer()), 421 reinterpret_cast<const char*>(new_sink_stream.Buffer()),
422 static_cast<int>(new_sink_stream.Length())); 422 static_cast<int>(new_sink_stream.Length()));
423 if (written == -1) 423 if (written == -1)
424 return C_WRITE_OPEN_ERROR; 424 return C_WRITE_OPEN_ERROR;
425 if (static_cast<size_t>(written) != new_sink_stream.Length()) 425 if (static_cast<size_t>(written) != new_sink_stream.Length())
426 return C_WRITE_ERROR; 426 return C_WRITE_ERROR;
427 427
428 return C_OK; 428 return C_OK;
429 } 429 }
430 430
431 } // namespace 431 } // namespace
OLDNEW
« no previous file with comments | « courgette/courgette_tool.cc ('k') | courgette/third_party/bsdiff_apply.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698