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

Side by Side Diff: courgette/simple_delta.cc

Issue 2031193002: [Courgette] Refactor BSDiff namespaces and bsdiff::search() interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 years, 4 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 | « courgette/courgette_tool.cc ('k') | courgette/third_party/bsdiff/README.chromium » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Implementation of the byte-level differential compression used internally by 5 // Implementation of the byte-level differential compression used internally by
6 // Courgette. 6 // Courgette.
7 7
8 #include "courgette/simple_delta.h" 8 #include "courgette/simple_delta.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 11
12 #include "courgette/third_party/bsdiff/bsdiff.h" 12 #include "courgette/third_party/bsdiff/bsdiff.h"
13 13
14 namespace courgette { 14 namespace courgette {
15 15
16 namespace { 16 namespace {
17 17
18 Status BSDiffStatusToStatus(BSDiffStatus status) { 18 Status BSDiffStatusToStatus(bsdiff::BSDiffStatus status) {
19 switch (status) { 19 switch (status) {
20 case OK: return C_OK; 20 case bsdiff::OK: return C_OK;
21 case CRC_ERROR: return C_BINARY_DIFF_CRC_ERROR; 21 case bsdiff::CRC_ERROR: return C_BINARY_DIFF_CRC_ERROR;
22 default: return C_GENERAL_ERROR; 22 default: return C_GENERAL_ERROR;
23 } 23 }
24 } 24 }
25 25
26 } 26 }
27 27
28 Status ApplySimpleDelta(SourceStream* old, SourceStream* delta, 28 Status ApplySimpleDelta(SourceStream* old, SourceStream* delta,
29 SinkStream* target) { 29 SinkStream* target) {
30 return BSDiffStatusToStatus(ApplyBinaryPatch(old, delta, target)); 30 return BSDiffStatusToStatus(bsdiff::ApplyBinaryPatch(old, delta, target));
31 } 31 }
32 32
33 Status GenerateSimpleDelta(SourceStream* old, SourceStream* target, 33 Status GenerateSimpleDelta(SourceStream* old, SourceStream* target,
34 SinkStream* delta) { 34 SinkStream* delta) {
35 VLOG(1) << "GenerateSimpleDelta " << old->Remaining() 35 VLOG(1) << "GenerateSimpleDelta " << old->Remaining()
36 << " " << target->Remaining(); 36 << " " << target->Remaining();
37 return BSDiffStatusToStatus(CreateBinaryPatch(old, target, delta)); 37 return BSDiffStatusToStatus(bsdiff::CreateBinaryPatch(old, target, delta));
38 } 38 }
39 39
40 } // namespace courgette 40 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/courgette_tool.cc ('k') | courgette/third_party/bsdiff/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698