aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_encoder.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-12-22liblzma: Improve lzma encoder init function consistency.Jia Tan1-0/+3
lzma_encoder_init() did not check for NULL options, but lzma2_encoder_init() did. This is more of a code style improvement than anything else to help make lzma_encoder_init() and lzma2_encoder_init() more similar.
2023-08-01Docs: Fix typos found by codespellDimitri Papadopoulos Orfanos1-2/+2
2022-11-27liblzma: Add LZMA_FILTER_LZMA1EXT to support LZMA1 without end marker.Lasse Collin1-5/+35
Some file formats need support for LZMA1 streams that don't use the end of payload marker (EOPM) alias end of stream (EOS) marker. So far liblzma API has supported decompressing such streams via lzma_alone_decoder() when .lzma header specifies a known uncompressed size. Encoding support hasn't been available in the API. Instead of adding a new LZMA1-only API for this purpose, this commit adds a new filter ID for use with raw encoder and decoder. The main benefit of this approach is that then also filter chains are possible, for example, if someone wants to implement support for .7z files that use the x86 BCJ filter with LZMA1 (not BCJ2 as that isn't supported in liblzma).
2022-11-27liblzma: Pass the Filter ID to LZ encoder and decoder.Lasse Collin1-1/+1
This allows using two Filter IDs with the same initialization function and data structures.
2022-11-24liblzma: Allow nice_len 2 and 3 even if match finder requires 3 or 4.Lasse Collin1-3/+8
That is, if the specified nice_len is smaller than the minimum of the match finder, silently use the match finder's minimum value instead of reporting an error. The old behavior is annoying to users and it complicates xz options handling too.
2022-11-22liblzma: Fix infinite loop in LZMA encoder init with dict_size >= 2 GiB.Lasse Collin1-4/+15
The encoder doesn't support dictionary sizes larger than 1536 MiB. This is validated, for example, when calculating the memory usage via lzma_raw_encoder_memusage(). It is also enforced by the LZ part of the encoder initialization. However, LZMA encoder with LZMA_MODE_NORMAL did an unsafe calculation with dict_size before such validation and that results in an infinite loop if dict_size was 2 << 30 or greater.
2022-02-07liblzma: Add NULL checks to LZMA and LZMA2 properties encoders.jiat751-0/+3
Previously lzma_lzma_props_encode() and lzma_lzma2_props_encode() assumed that the options pointers must be non-NULL because the with these filters the API says it must never be NULL. It is good to do these checks anyway.
2021-01-29liblzma: Fix unitialized variable.Lasse Collin1-0/+1
This was introduced two weeks ago in the commit 625f4c7c99b2fcc4db9e7ab2deb4884790e2e17c. Thanks to Nathan Moinvaziri.
2021-01-14liblzma: Add rough support for output-size-limited encoding in LZMA1.Lasse Collin1-35/+92
With this it is possible to encode LZMA1 data without EOPM so that the encoder will encode as much input as it can without exceeding the specified output size limit. The resulting LZMA1 stream will be a normal LZMA1 stream without EOPM. The actual uncompressed size will be available to the caller via the uncomp_size pointer. One missing thing is that the LZMA layer doesn't inform the LZ layer when the encoding is finished and thus the LZ may read more input when it won't be used. However, this doesn't matter if encoding is done with a single call (which is the planned use case for now). For proper multi-call encoding this should be improved. This commit only adds the functionality for internal use. Nothing uses it yet.
2019-12-31Rename unaligned_read32ne to read32ne, and similarly for the others.Lasse Collin1-1/+1
2016-11-21liblzma: Avoid multiple definitions of lzma_coder structures.Lasse Collin1-14/+15
Only one definition was visible in a translation unit. It avoided a few casts and temp variables but seems that this hack doesn't work with link-time optimizations in compilers as it's not C99/C11 compliant. Fixes: http://www.mail-archive.com/xz-devel@tukaani.org/msg00279.html
2015-03-07liblzma: Silence more uint32_t vs. size_t warnings.Lasse Collin1-1/+1
2012-07-17liblzma: Make the use of lzma_allocator const-correct.Lasse Collin1-3/+4
There is a tiny risk of causing breakage: If an application assigns lzma_stream.allocator to a non-const pointer, such code won't compile anymore. I don't know why anyone would do such a thing though, so in practice this shouldn't cause trouble. Thanks to Jan Kratochvil for the patch.
2010-10-26liblzma: Rename a few variables and constants.Lasse Collin1-28/+28
This has no semantic changes. I find the new names slightly more logical and they match the names that are already used in XZ Embedded. The name fastpos wasn't changed (not worth the hassle).
2010-10-19Clean up a few FIXMEs and TODOs.Lasse Collin1-1/+1
lzma_chunk_size() was commented out because it is currently useless.
2009-10-04Use a tuklib module for integer handling.Lasse Collin1-1/+1
This replaces bswap.h and integer.h. The tuklib module uses <byteswap.h> on GNU, <sys/endian.h> on *BSDs and <sys/byteorder.h> on Solaris, which may contain optimized code like inline assembly.
2009-09-11Fix a couple of warnings.Lasse Collin1-1/+1
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin1-12/+5
Some minor documentation cleanups were made at the same time.
2009-02-02Modify LZMA_API macro so that it works on Windows withLasse Collin1-1/+1
other compilers than MinGW. This may hurt readability of the API headers slightly, but I don't know any better way to do this.
2009-01-27Added initial support for preset dictionary for raw LZMA1Lasse Collin1-1/+8
and LZMA2. It is not supported by the .xz format or the xz command line tool yet.
2009-01-19Move some LZMA2 constants to lzma2_encoder.h so that theyLasse Collin1-1/+2
can be used outside lzma2_encoder.c.
2008-12-27Bunch of liblzma tweaks, including some API changes.Lasse Collin1-1/+1
The API and ABI should now be very close to stable, although the code behind it isn't yet.
2008-12-09Make the memusage functions of LZMA1 and LZMA2 encodersLasse Collin1-14/+30
to validate the filter options. Add missing validation to LZMA2 encoder when options are changed in the middle of encoding.
2008-09-27Some API changes, bug fixes, cleanups etc.Lasse Collin1-30/+21
2008-09-17Miscellaneous LZ and LZMA encoder cleanupsLasse Collin1-41/+23
2008-09-13Renamed constants:Lasse Collin1-4/+4
- LZMA_VLI_VALUE_MAX -> LZMA_VLI_MAX - LZMA_VLI_VALUE_UNKNOWN -> LZMA_VLI_UNKNOWN - LZMA_HEADER_ERRRO -> LZMA_OPTIONS_ERROR
2008-08-31Fix wrong pointer calculation in LZMA encoder.Lasse Collin1-1/+3
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin1-126/+450
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.
2008-06-20Remove some redundant code from LZMA encoder.Lasse Collin1-14/+1
2008-06-18CommentsLasse Collin1-5/+2
2008-06-01Fix a buffer overflow in the LZMA encoder. It was due to myLasse Collin1-290/+261
misunderstanding of the code. There's no tiny fix for this problem, so I also cleaned up the code in general. This reduces the speed of the encoder 2-5 % in the fastest compression mode ("lzma -1"). High compression modes should have no noticeable performance difference. This commit breaks things (especially LZMA_SYNC_FLUSH) but I will fix them once the new format and LZMA2 has been roughly implemented. Plain LZMA won't support LZMA_SYNC_FLUSH at all and won't be supported in the new .lzma format. This may change still but this is what it looks like now. Support for known uncompressed size (that is, LZMA or LZMA2 without EOPM) is likely to go away. This means there will be API changes.
2008-04-24Added two assert()s.Lasse Collin1-1/+3
2008-03-22Demystified the "state" variable in LZMA code. Use theLasse Collin1-7/+7
word literal instead of char for better consistency. There are still some names with _char instead of _literal in lzma_optimum, these may be changed later. Renamed length coder variables. This commit doesn't change the program logic.
2008-03-14Fix data corruption in LZMA encoder. Note that this bug wasLasse Collin1-0/+4
specific to liblzma and was *not* present in LZMA SDK.
2008-01-18Fix LZMA_SYNC_FLUSH handling in LZ and LZMA encoders.Lasse Collin1-25/+2
That code is now almost completely in LZ coder, where it can be shared with other LZ77-based algorithms in future.
2008-01-15Revised the fastpos code. It now uses the slightly fasterLasse Collin1-0/+1
table-based version from LZMA SDK 4.57. This should be fast on most systems. A simpler and smaller alternative version is also provided. On some CPUs this can be even a little faster than the default table-based version (see comments in fastpos.h), but on most systems the table-based code is faster.
2008-01-15Fix a typo in lzma_encoder.c.Lasse Collin1-1/+1
2008-01-15Convert bittree_get_price() and bittree_reverse_get_price()Lasse Collin1-12/+7
from macros to inline functions.
2008-01-14Major changes to LZ encoder, LZMA encoder, and range encoder.Lasse Collin1-31/+43
These changes implement support for LZMA_SYNC_FLUSH in LZMA encoder, and move the temporary buffer needed by range encoder from lzma_range_encoder structure to lzma_lz_encoder.