summaryrefslogtreecommitdiffstats
path: root/liblzma/simple/simple_encoder.c
diff options
context:
space:
mode:
authorliblzma upstream <xz-devel@tukaani.org>2013-06-30 16:55:49 (GMT)
committerBrad King <brad.king@kitware.com>2014-07-21 18:30:16 (GMT)
commitc289e63491982dd8aed7c6b6f54d390df91aaf95 (patch)
tree30ec0cd68d34ac054c6db4d007dbc8aa58f9da23 /liblzma/simple/simple_encoder.c
downloadCMake-c289e63491982dd8aed7c6b6f54d390df91aaf95.zip
CMake-c289e63491982dd8aed7c6b6f54d390df91aaf95.tar.gz
CMake-c289e63491982dd8aed7c6b6f54d390df91aaf95.tar.bz2
liblzma 5.0.5-gb69900ed (reduced)
Extract upstream liblzma using the following shell code. url=http://git.tukaani.org/xz.git && v=5.0.5 && r=b69900ed && paths=" COPYING src/common/common_w32res.rc src/common/sysdefs.h src/common/tuklib_integer.h src/liblzma " && mkdir liblzma-$v-g$r-reduced && git clone $url liblzma-git && date=$(cd liblzma-git && git log -n 1 --format='%cd' $r) && (cd liblzma-git && git archive --format=tar $r -- $paths) | (cd liblzma-$v-g$r-reduced && tar xv && mv src/* . && rmdir src) && echo "g$r date: $date"
Diffstat (limited to 'liblzma/simple/simple_encoder.c')
-rw-r--r--liblzma/simple/simple_encoder.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/liblzma/simple/simple_encoder.c b/liblzma/simple/simple_encoder.c
new file mode 100644
index 0000000..8aa463b
--- /dev/null
+++ b/liblzma/simple/simple_encoder.c
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file simple_encoder.c
+/// \brief Properties encoder for simple filters
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "simple_encoder.h"
+
+
+extern lzma_ret
+lzma_simple_props_size(uint32_t *size, const void *options)
+{
+ const lzma_options_bcj *const opt = options;
+ *size = (opt == NULL || opt->start_offset == 0) ? 0 : 4;
+ return LZMA_OK;
+}
+
+
+extern lzma_ret
+lzma_simple_props_encode(const void *options, uint8_t *out)
+{
+ const lzma_options_bcj *const opt = options;
+
+ // The default start offset is zero, so we don't need to store any
+ // options unless the start offset is non-zero.
+ if (opt == NULL || opt->start_offset == 0)
+ return LZMA_OK;
+
+ unaligned_write32le(out, opt->start_offset);
+
+ return LZMA_OK;
+}