This source file includes following definitions.
- BSDiffStatusToStatus
- ApplySimpleDelta
- GenerateSimpleDelta
#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) {
VLOG(1) << "GenerateSimpleDelta " << old->Remaining()
<< " " << target->Remaining();
return BSDiffStatusToStatus(CreateBinaryPatch(old, target, delta));
}
}