diff options
author | sra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 23:00:29 +0000 |
---|---|---|
committer | sra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 23:00:29 +0000 |
commit | 04ca1bc65afb76ea30698c25f24599d20119e3d2 (patch) | |
tree | 2bb65e974d478f4d607b83f6a84a56c01f501ac0 /courgette/simple_delta.cc | |
parent | 9adf1dcf3281408560267787eddcc767566b425f (diff) | |
download | chromium_src-04ca1bc65afb76ea30698c25f24599d20119e3d2.zip chromium_src-04ca1bc65afb76ea30698c25f24599d20119e3d2.tar.gz chromium_src-04ca1bc65afb76ea30698c25f24599d20119e3d2.tar.bz2 |
Move Courgette
from src\third_party\courgette
to src\courgette and src\courgette\third_party
Fixed #includes
Added properties to ignore generated files:
C:\c5\src>svn pg svn:ignore courgette
courgette.xcodeproj
courgette.sln
courgette_fuzz.vcproj
courgette_lib.vcproj
courgette_minimal_tool.vcproj
courgette_tool.vcproj
courgette.vcproj
courgette_unittests.vcproj
SConstruct
courgette_fuzz.scons
courgette_lib.scons
courgette_main.scons
courgette_minimal_tool.scons
courgette.scons
courgette_tool.scons
courgette_unittests.scons
Review URL: http://codereview.chromium.org/115062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/simple_delta.cc')
-rw-r--r-- | courgette/simple_delta.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/courgette/simple_delta.cc b/courgette/simple_delta.cc new file mode 100644 index 0000000..71038fd --- /dev/null +++ b/courgette/simple_delta.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Implementation of the byte-level differential compression used internally by +// Courgette. + +#include "courgette/simple_delta.h" + +#include "base/basictypes.h" +#include "base/logging.h" + +#include "courgette/third_party/bsdiff.h" + +namespace courgette { + +namespace { + +Status BSDiffStatusToStatus(BSDiffStatus status) { + switch (status) { + case OK: return C_OK; + case CRC_ERROR: return C_BINARY_DIFF_CRC_ERROR; + default: return C_GENERAL_ERROR; + } +} + +} + +Status ApplySimpleDelta(SourceStream* old, SourceStream* delta, + SinkStream* target) { + return BSDiffStatusToStatus(ApplyBinaryPatch(old, delta, target)); +} + +Status GenerateSimpleDelta(SourceStream* old, SourceStream* target, + SinkStream* delta) { + LOG(INFO) << "GenerateSimpleDelta " + << old->Remaining() << " " << target->Remaining(); + return BSDiffStatusToStatus(CreateBinaryPatch(old, target, delta)); +} + +} // namespace courgette |