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

Side by Side Diff: courgette/ensemble_apply.cc

Issue 8417045: Last small bit of refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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/ensemble.h ('k') | courgette/ensemble_create.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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 12
13 #include "courgette/crc.h" 13 #include "courgette/crc.h"
14 #include "courgette/region.h" 14 #include "courgette/region.h"
15 #include "courgette/streams.h" 15 #include "courgette/streams.h"
16 #include "courgette/simple_delta.h" 16 #include "courgette/simple_delta.h"
17 #include "courgette/win32_x86_patcher.h" 17 #include "courgette/patcher_x86_32.h"
18 18
19 namespace courgette { 19 namespace courgette {
20 20
21 // EnsemblePatchApplication is all the logic and data required to apply the 21 // EnsemblePatchApplication is all the logic and data required to apply the
22 // multi-stage patch. 22 // multi-stage patch.
23 class EnsemblePatchApplication { 23 class EnsemblePatchApplication {
24 public: 24 public:
25 EnsemblePatchApplication(); 25 EnsemblePatchApplication();
26 ~EnsemblePatchApplication(); 26 ~EnsemblePatchApplication();
27 27
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 for (size_t i = 0; i < number_of_transformations; ++i) { 133 for (size_t i = 0; i < number_of_transformations; ++i) {
134 uint32 kind; 134 uint32 kind;
135 if (!transformation_parameters->ReadVarint32(&kind)) 135 if (!transformation_parameters->ReadVarint32(&kind))
136 return C_BAD_ENSEMBLE_HEADER; 136 return C_BAD_ENSEMBLE_HEADER;
137 137
138 TransformationPatcher* patcher = NULL; 138 TransformationPatcher* patcher = NULL;
139 139
140 switch (kind) 140 switch (kind)
141 { 141 {
142 case CourgettePatchFile::T_COURGETTE_WIN32_X86: 142 case EXE_WIN_32_X86:
143 patcher = new CourgetteWin32X86Patcher(base_region_); 143 patcher = new PatcherX86_32(base_region_);
144 break; 144 break;
145 } 145 }
146 146
147 if (patcher) 147 if (patcher)
148 patchers_.push_back(patcher); 148 patchers_.push_back(patcher);
149 else 149 else
150 return C_BAD_ENSEMBLE_HEADER; 150 return C_BAD_ENSEMBLE_HEADER;
151 } 151 }
152 152
153 for (size_t i = 0; i < patchers_.size(); ++i) { 153 for (size_t i = 0; i < patchers_.size(); ++i) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 static_cast<int>(new_sink_stream.Length())); 413 static_cast<int>(new_sink_stream.Length()));
414 if (written == -1) 414 if (written == -1)
415 return C_WRITE_OPEN_ERROR; 415 return C_WRITE_OPEN_ERROR;
416 if (static_cast<size_t>(written) != new_sink_stream.Length()) 416 if (static_cast<size_t>(written) != new_sink_stream.Length())
417 return C_WRITE_ERROR; 417 return C_WRITE_ERROR;
418 418
419 return C_OK; 419 return C_OK;
420 } 420 }
421 421
422 } // namespace 422 } // namespace
OLDNEW
« no previous file with comments | « courgette/ensemble.h ('k') | courgette/ensemble_create.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698