files
kpack_c/lzma_c
rgimad 244e5c92f8 lzma_c: no need to rebuild for using in kpack/kerpack, cleanup
Removed samples, converted indentation to spaces, translated to english, added header for exporting functions.
Added is_kerpack argument to lzma_compress() to make it usable either for kpack and kerpack without rebuild
2025-03-22 18:57:47 +03:00
..
2025-03-22 18:41:40 +03:00
2025-03-22 18:41:40 +03:00
2025-03-22 18:41:40 +03:00
2025-03-22 18:41:40 +03:00
2025-03-22 18:41:40 +03:00

This directory contains a simplified version of the LZMA packer rewritten in C by me, diamond.
The original LZMA SDK 4.32 is copyright (c) 1999-2005
Igor Pavlov, can be obtained from the page http://www.7-zip.org/sdk.html,
in particular, it contains versions of the source code in C++, C# and Java for packing and
unpacking, the LZMA unpacking code in ANSI-C, a description of the 7z format.

This version is not thread-safe (!), supports only bt4 match-finder,
some packing parameters are fixed (however, this can be easily modified if necessary),
only data compression in RAM is supported. (These restrictions are not in the original LZMA SDK.)

This library, like the original LZMA SDK, can be used in other
programs under one of the licenses (your choice) GNU LGPL or
GNU CPL. (The original SDK also allows the original library to be used without restrictions,
provided that the object files are used without modifying the code; this version does not.)

Two functions are exported: in C++ the declaration looks like this:
    extern "C" __stdcall void lzma_set_dict_size(unsigned logdictsize);
    extern "C" __stdcall unsigned lzma_compress(
    const void* source,
    void* destination,
    unsigned length,
    void* workmem, int is_kerpack)

Before packing, the dictionary size of the first of these functions, taking the base 2 logarithm of this value,
(i.e. dictsize == (1<<logdictsize)). The maximum buffer size is 256Mb,
so the logdictsize parameter should not exceed 28. If the buffer size is larger than the input data size,
the result does not depend on the buffer size, i.e. for data of 12345 bytes,
the results of compression with a 16384-byte buffer and with a 1 megabyte buffer are the same.
Packing is performed by calling the second of these functions;
source is a pointer to the input data, destination is a pointer to the buffer for packed data,
length is the length of the input data, workmem is a pointer to temporary memory
used by the packer; at least 0x509000+dictsize*19/2 bytes must be allocated.
For packed data, 0x10 + length*9/8 bytes is enough in the worst case.