Use AppCompat AlertDialogs even when dialogs contain EditTexts.
[chromium-blink-merge.git] / courgette / simple_delta.cc
blob37b910d050e37bf3c5a6579acadf4911d6c77798
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
3 // found in the LICENSE file.
5 // Implementation of the byte-level differential compression used internally by
6 // Courgette.
8 #include "courgette/simple_delta.h"
10 #include "base/basictypes.h"
11 #include "base/logging.h"
13 #include "courgette/third_party/bsdiff.h"
15 namespace courgette {
17 namespace {
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;
29 Status ApplySimpleDelta(SourceStream* old, SourceStream* delta,
30 SinkStream* target) {
31 return BSDiffStatusToStatus(ApplyBinaryPatch(old, delta, target));
34 Status GenerateSimpleDelta(SourceStream* old, SourceStream* target,
35 SinkStream* delta) {
36 VLOG(1) << "GenerateSimpleDelta " << old->Remaining()
37 << " " << target->Remaining();
38 return BSDiffStatusToStatus(CreateBinaryPatch(old, target, delta));
41 } // namespace courgette