aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_decoder.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2022-11-27liblzma: Add LZMA_FILTER_LZMA1EXT to support LZMA1 without end marker.Lasse Collin1-1/+25
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: Avoid unneeded use of void pointer in LZMA decoder.Lasse Collin1-2/+1
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-07-14liblzma: Rename a variable and improve a comment.Lasse Collin1-4/+9
2022-07-13liblzma: Add optional autodetection of LZMA end marker.Lasse Collin1-29/+70
Turns out that this is needed for .lzma files as the spec in LZMA SDK says that end marker may be present even if the size is stored in the header. Such files are rare but exist in the real world. The code in liblzma is so old that the spec didn't exist in LZMA SDK back then and I had understood that such files weren't possible (the lzma tool in LZMA SDK didn't create such files). This modifies the internal API so that LZMA decoder can be told if EOPM is allowed even when the uncompressed size is known. It's allowed with .lzma and not with other uses. Thanks to Karl Beldan for reporting the problem.
2019-12-31Rename unaligned_read32ne to read32ne, and similarly for the others.Lasse Collin1-1/+1
2019-06-23liblzma: Fix warnings from -Wsign-conversion.Lasse Collin1-8/+8
Also, more parentheses were added to the literal_subcoder macro in lzma_comon.h (better style but no functional change in the current usage).
2017-08-14Fix or hide warnings from GCC 7's -Wimplicit-fallthrough.Lasse Collin1-0/+6
2016-11-21liblzma: Avoid multiple definitions of lzma_coder structures.Lasse Collin1-15/+12
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
2012-07-17liblzma: Make the use of lzma_allocator const-correct.Lasse Collin1-4/+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.
2012-06-28liblzma: Check that the first byte of range encoded data is 0x00.Lasse Collin1-2/+6
It is just to be more pedantic and thus perhaps catch broken files slightly earlier.
2010-10-26liblzma: Rename a few variables and constants.Lasse Collin1-29/+29
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-2/+2
lzma_chunk_size() was commented out because it is currently useless.
2010-02-12Collection of language fixes to comments and docs.Lasse Collin1-2/+2
Thanks to Jonathan Nieder.
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-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-01-27Added initial support for preset dictionary for raw LZMA1Lasse Collin1-4/+6
and LZMA2. It is not supported by the .xz format or the xz command line tool yet.
2008-12-01Make the memusage functions of LZMA1 and LZMA2 decodersLasse Collin1-4/+10
to validate the filter options.
2008-09-27Some API changes, bug fixes, cleanups etc.Lasse Collin1-20/+17
2008-09-13Renamed constants:Lasse Collin1-7/+7
- LZMA_VLI_VALUE_MAX -> LZMA_VLI_MAX - LZMA_VLI_VALUE_UNKNOWN -> LZMA_VLI_UNKNOWN - LZMA_HEADER_ERRRO -> LZMA_OPTIONS_ERROR
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin1-515/+791
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-19Add limit of lc + lp <= 4. Now we can allocate theLasse Collin1-43/+14
literal coder as part of the main LZMA encoder or decoder structure. Make the LZMA decoder to rely on the current internal API to free the allocated memory in case an error occurs.
2008-06-18Update the code to mostly match the new simpler file formatLasse Collin1-1/+12
specification. Simplify things by removing most of the support for known uncompressed size in most places. There are some miscellaneous changes here and there too. The API of liblzma has got many changes and still some more will be done soon. While most of the code has been updated, some things are not fixed (the command line tool will choke with invalid filter chain, if nothing else). Subblock filter is somewhat broken for now. It will be updated once the encoded format of the Subblock filter has been decided.
2008-03-22Update a comment to use the variable name rep_len_decoder.Lasse Collin1-1/+1
(And BTW, the previous commit actually did change the program logic slightly.)
2008-03-22Demystified the "state" variable in LZMA code. Use theLasse Collin1-23/+24
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-11Apply a minor speed optimization to LZMA decoder.Lasse Collin1-42/+43
2008-02-28Remove two redundant validity checks from the LZMA decoder.Lasse Collin1-19/+4
These are already checked elsewhere, so omitting these gives (very) tiny speed up.
2008-01-14More fixes to LZMA decoder's flush marker handling.Lasse Collin1-22/+30
2008-01-05Another bug fix for flush marker detection.Lasse Collin1-1/+9
2008-01-04Fix stupid bugs in flush marker detection.Lasse Collin1-3/+4
2008-01-04Added support for flush marker, which will be in filesLasse Collin1-117/+100
that use LZMA_SYNC_FLUSH with encoder (not implemented yet). This is a new feature in the raw LZMA format, which isn't supported by old decoders. This shouldn't be a problem in practice, since lzma_alone_encoder() will not allow LZMA_SYNC_FLUSH, and thus not allow creating files on decodable with old decoders. Made lzma_decoder.c to require tab width of 4 characters if one wants to fit the code in 80 columns. This makes the code easier to read.
2008-01-04Moved range decoder initialization (reading the firstLasse Collin1-36/+6
five input bytes) from LZMA decoder to range decoder header. Did the same for decoding of direct bits.