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

Side by Side Diff: courgette/ensemble_apply.cc

Issue 1025523002: Remove misleading comment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 ensemble_correction, output); 374 ensemble_correction, output);
375 if (status != C_OK) 375 if (status != C_OK)
376 return status; 376 return status;
377 377
378 return C_OK; 378 return C_OK;
379 } 379 }
380 380
381 Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, 381 Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name,
382 const base::FilePath::CharType* patch_file_name, 382 const base::FilePath::CharType* patch_file_name,
383 const base::FilePath::CharType* new_file_name) { 383 const base::FilePath::CharType* new_file_name) {
384 // First read enough of the patch file to validate the header is well-formed.
385 // A few varint32 numbers should fit in 100.
386 base::FilePath patch_file_path(patch_file_name); 384 base::FilePath patch_file_path(patch_file_name);
387 base::MemoryMappedFile patch_file; 385 base::MemoryMappedFile patch_file;
388 if (!patch_file.Initialize(patch_file_path)) 386 if (!patch_file.Initialize(patch_file_path))
389 return C_READ_OPEN_ERROR; 387 return C_READ_OPEN_ERROR;
390 388
391 // 'Dry-run' the first step of the patch process to validate format of header. 389 // 'Dry-run' the first step of the patch process to validate format of header.
392 SourceStream patch_header_stream; 390 SourceStream patch_header_stream;
393 patch_header_stream.Init(patch_file.data(), patch_file.length()); 391 patch_header_stream.Init(patch_file.data(), patch_file.length());
394 EnsemblePatchApplication patch_process; 392 EnsemblePatchApplication patch_process;
395 Status status = patch_process.ReadHeader(&patch_header_stream); 393 Status status = patch_process.ReadHeader(&patch_header_stream);
(...skipping 26 matching lines...) Expand all
422 static_cast<int>(new_sink_stream.Length())); 420 static_cast<int>(new_sink_stream.Length()));
423 if (written == -1) 421 if (written == -1)
424 return C_WRITE_OPEN_ERROR; 422 return C_WRITE_OPEN_ERROR;
425 if (static_cast<size_t>(written) != new_sink_stream.Length()) 423 if (static_cast<size_t>(written) != new_sink_stream.Length())
426 return C_WRITE_ERROR; 424 return C_WRITE_ERROR;
427 425
428 return C_OK; 426 return C_OK;
429 } 427 }
430 428
431 } // namespace 429 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698