aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/delta/delta_encoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-08-28 22:53:15 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-08-28 22:53:15 +0300
commit3b34851de1eaf358cf9268922fa0eeed8278d680 (patch)
tree7bab212af647541df64227a8d350d17a2e789f6b /src/liblzma/delta/delta_encoder.c
parentFix test_filter_flags to match the new restriction of lc+lp. (diff)
downloadxz-3b34851de1eaf358cf9268922fa0eeed8278d680.tar.xz
Sort of garbage collection commit. :-| Many things are still
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
Diffstat (limited to '')
-rw-r--r--src/liblzma/delta/delta_encoder.c (renamed from src/liblzma/common/delta_encoder.c)21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/liblzma/common/delta_encoder.c b/src/liblzma/delta/delta_encoder.c
index a8bb9341..d8f40287 100644
--- a/src/liblzma/common/delta_encoder.c
+++ b/src/liblzma/delta/delta_encoder.c
@@ -96,3 +96,24 @@ lzma_delta_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
{
return lzma_delta_coder_init(next, allocator, filters, &delta_encode);
}
+
+
+extern lzma_ret
+lzma_delta_props_encode(const void *options, uint8_t *out)
+{
+ if (options == NULL)
+ return LZMA_PROG_ERROR;
+
+ const lzma_options_delta *opt = options;
+
+ // It's possible that newer liblzma versions will support larger
+ // distance values.
+ if (opt->type != LZMA_DELTA_TYPE_BYTE
+ || opt->distance < LZMA_DELTA_DISTANCE_MIN
+ || opt->distance > LZMA_DELTA_DISTANCE_MAX)
+ return LZMA_HEADER_ERROR;
+
+ out[0] = opt->distance - LZMA_DELTA_DISTANCE_MIN;
+
+ return LZMA_OK;
+}