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

Unified Diff: third_party/courgette/simple_delta.cc

Issue 113009: Move Courgette from internal depot to third_party. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/courgette/simple_delta.h ('k') | third_party/courgette/streams.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/courgette/simple_delta.cc
===================================================================
--- third_party/courgette/simple_delta.cc (revision 0)
+++ third_party/courgette/simple_delta.cc (revision 0)
@@ -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 "third_party/courgette/simple_delta.h"
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+
+#include "third_party/courgette/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
« no previous file with comments | « third_party/courgette/simple_delta.h ('k') | third_party/courgette/streams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698