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

Side by Side Diff: courgette/simple_delta.cc

Issue 115062: Move Courgette... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/simple_delta.h ('k') | courgette/streams.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Implementation of the byte-level differential compression used internally by
6 // Courgette.
7
8 #include "courgette/simple_delta.h"
9
10 #include "base/basictypes.h"
11 #include "base/logging.h"
12
13 #include "courgette/third_party/bsdiff.h"
14
15 namespace courgette {
16
17 namespace {
18
19 Status BSDiffStatusToStatus(BSDiffStatus status) {
20 switch (status) {
21 case OK: return C_OK;
22 case CRC_ERROR: return C_BINARY_DIFF_CRC_ERROR;
23 default: return C_GENERAL_ERROR;
24 }
25 }
26
27 }
28
29 Status ApplySimpleDelta(SourceStream* old, SourceStream* delta,
30 SinkStream* target) {
31 return BSDiffStatusToStatus(ApplyBinaryPatch(old, delta, target));
32 }
33
34 Status GenerateSimpleDelta(SourceStream* old, SourceStream* target,
35 SinkStream* delta) {
36 LOG(INFO) << "GenerateSimpleDelta "
37 << old->Remaining() << " " << target->Remaining();
38 return BSDiffStatusToStatus(CreateBinaryPatch(old, target, delta));
39 }
40
41 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/simple_delta.h ('k') | courgette/streams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698