aboutsummaryrefslogtreecommitdiff
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2008-09-10Filter handling cleanupsLasse Collin6-151/+156
2008-09-10CommentsLasse Collin1-1/+5
2008-09-10Cleaned up Block encoder and moved the no longer sharedLasse Collin5-100/+66
code from block_private.h to block_decoder.c. Now the Block encoder doesn't need compressed_size and uncompressed_size from lzma_block structure to be initialized.
2008-09-07Changed Filter ID of LZMA to 0x20.Lasse Collin1-1/+1
2008-09-06CommentsLasse Collin5-39/+65
2008-09-06Some API cleanupsLasse Collin10-166/+282
2008-09-04Added support for raw encoding and decoding to the commandLasse Collin4-34/+50
line tool, and made various cleanups. --lzma was renamed to --lzma1 to prevent people from accidentally using LZMA when they want LZMA2.
2008-09-04Don't allow LZMA_SYNC_FLUSH with decoders anymore. There'sLasse Collin3-3/+2
simply nothing that would use it. Allow LZMA_FINISH to the decoders, which will usually ignore it (auto decoder and Stream decoder being exceptions).
2008-09-02Command line tool fixesLasse Collin1-8/+13
2008-09-02Auto decoder cleanupLasse Collin1-1/+1
2008-09-02Updated auto decoder to handle LZMA_CONCATENATED when decodingLasse Collin1-16/+71
LZMA_Alone files. Decoding of concatenated LZMA_Alone files is intentionally not supported, so it is better to put this in auto decoder than LZMA_Alone decoder.
2008-09-02Stream decoder cleanupsLasse Collin1-25/+32
2008-09-02Some fixes to LZ encoder.Lasse Collin3-75/+94
2008-08-31Fix wrong pointer calculation in LZMA encoder.Lasse Collin1-1/+3
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin147-7082/+8453
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-19Add limit of lc + lp <= 4. Now we can allocate theLasse Collin6-91/+43
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-18CommentsLasse Collin1-5/+2
2008-06-18Update the code to mostly match the new simpler file formatLasse Collin98-6746/+3836
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-06-11Fix uninitialized variable in LZMA encoder. This wasLasse Collin1-0/+2
introduced in 369f72fd656f537a9a8e06f13e6d0d4c242be22f.
2008-06-11Improve command line integer parsing a little in lzma andLasse Collin2-22/+32
lzmadec to make them accept also KiB in addition Ki etc. Fix also memory usage information in lzmadec --help.
2008-06-10s/decompressed/compressed/ in the command line tool'sLasse Collin1-1/+1
error message.
2008-06-01Fix a buffer overflow in the LZMA encoder. It was due to myLasse Collin8-620/+532
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-05-11Remove support for pre-C89 libc versions that lack memcpy,Lasse Collin2-14/+3
memmove, and memset.
2008-05-06Bunch of grammar fixes from meyering.Lasse Collin2-4/+4
2008-05-06Typo fixLasse Collin1-1/+1
2008-05-04Don't print an error message on broken pipe unless --verboseLasse Collin1-1/+14
is used.
2008-04-30Fix a crash with --format=alone if other filters than LZMALasse Collin1-0/+9
are specified on the command line.
2008-04-28Fixed wrong spelling "limitter" to "limiter". This affectsLasse Collin7-20/+20
liblzma's API.
2008-04-25Prevent LZ encoder from hanging with known uncompressedlarhzu/v4.999.3alphaLasse Collin1-2/+7
size. The "fix" breaks LZMA_SYNC_FLUSH at end of stream with known uncompressed size, but since it currently seems likely that support for encoding with known uncompressed size will go away anyway, I'm not fixing this problem now.
2008-04-25Removed src/liblzma/common/sysdefs.h symlink, which wasLasse Collin5-5/+3
annoying, because "make dist" put two copies of sysdefs.h into the tarball instead of the symlink.
2008-04-25Bumped version number to 4.999.3alpha. It will become 5.0.0Lasse Collin1-12/+10
once we have a stable release (won't be very soon). The version number is no longer related to version of LZMA SDK. Made some small Automake-related changes to toplevel Makefile.am and configure.ac.
2008-04-24Fix a memory leak by calling free(extra->data) inLasse Collin1-0/+1
lzma_extra_free().
2008-04-24Make unlzma and lzcat symlinks.Lasse Collin1-0/+12
2008-04-24Fixed a bug in command line option parsing.Lasse Collin1-1/+1
2008-04-24Added two assert()s.Lasse Collin1-1/+3
2008-04-24Switch to uint16_t as the type of range coder probabilities.Lasse Collin1-6/+19
2008-04-24Fix wrong return type (uint32_t -> bool).Lasse Collin2-2/+2
2008-04-24Fix data corruption in LZ encoder with LZMA_SYNC_FLUSH.Lasse Collin3-5/+38
2008-04-24Fix fastpos problem in Makefile.am when built with --enable-small.Lasse Collin1-1/+4
2008-04-24Use 64-bit integer as range encoder's cache size. This fixes aLasse Collin1-1/+1
theoretical data corruption, which should be very hard to trigger even intentionally.
2008-03-24Replaced the range decoder optimization that used arithmeticLasse Collin1-37/+16
right shift with as fast version that doesn't need arithmetic right shift. Removed the related check from configure.ac.
2008-03-22Take advantage of arithmetic right shift in range decoder.Lasse Collin1-15/+37
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 Collin6-70/+107
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-03-14Fix a comment API header.Lasse Collin1-1/+1
2008-03-12Make lzma_stream.next_in const. Let's see if anyone complains.Lasse Collin1-1/+1
2008-03-11Apply a minor speed optimization to LZMA decoder.Lasse Collin1-42/+43
2008-03-11Initialize the last byte of the dictionary to zero so thatLasse Collin1-0/+1
lz_get_byte(lz, 0) returns zero. This was broken by 1a3b21859818e4d8e89a1da99699233c1bfd197d.
2008-03-10Really fix the price count initialization.Lasse Collin1-2/+2
2008-03-10Initialize align_price_count and match_price_count inLasse Collin1-0/+2
lzma_encoder_init.c. While we don't call fill_distances_prices() and fill_align_prices() in lzma_lzma_encoder_init(), we still need to initialize these two variables so that the fill functions get called in lzma_encoder_getoptimum.c in the beginning of a stream.
2008-03-10Always initialize lz->temp_size in lz_decoder.c. temp_size didLasse Collin1-5/+6
get initialized as a side-effect after allocating a new decoder, but not when the decoder was reused.
2008-03-10Don't fill allocated memory with 0xFD when debugging isLasse Collin1-3/+4
enabled. It hides errors from Valgrind.
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-02-02Don't memzero() the history buffer when initializing LZLasse Collin1-4/+3
decoder. There's no danger of information leak here, so it isn't required. Doing memzero() takes a lot of time with large dictionaries, which could make it easier to construct DoS attack to consume too much CPU time.
2008-02-01Do uncompressed size validation in raw encoder. This wayLasse Collin1-17/+73
it gets done for not only raw encoder, but also Block and LZMA_Alone encoders.
2008-02-01Avoid unneeded function call in raw_common.c.Lasse Collin1-9/+11
2008-01-26Added note.GNU-stack to x86 assembler files. It is neededLasse Collin2-0/+18
when using non-executable stack.
2008-01-26Added api/lzma/easy.h. I had forgot to add this to theLasse Collin1-0/+174
git repo. Thanks to Stephan Kulow.
2008-01-26Return LZMA_HEADER_ERROR if LZMA_SYNC_FLUSH is used with anyLasse Collin2-0/+17
of the so called simple filters. If there is demand, limited support for LZMA_SYNC_FLUSH may be added in future. After this commit, using LZMA_SYNC_FLUSH shouldn't cause undefined behavior in any situation.
2008-01-25Combine lzma_options_block validation needed by both BlockLasse Collin3-48/+71
encoder and decoder, and put the shared things to block_private.h. Improved the checks a little so that they may detect too big Compressed Size at initialization time if lzma_options_block.total_size or .total_limit is known. Allow encoding and decoding Blocks with combinations of fields that are not allowed by the file format specification. Doing this requires that the application passes such a combination in lzma_options_lzma; liblzma doesn't do that, but it's not impossible that someone could find them useful in some custom file format.
2008-01-25Improved the memory limitter:Lasse Collin2-14/+118
- Added lzma_memlimit_max() and lzma_memlimit_reached() API functions. - Added simple estimation of malloc()'s memory usage overhead. - Fixed integer overflow detection in lzma_memlimit_alloc(). - Made some white space cleanups and added more comments. The description of lzma_memlimit_max() in memlimit.h is bad and should be improved.
2008-01-23Fix decoding of empty Metadata Blocks, that don't haveLasse Collin1-1/+3
even the Metadata Flags field. Earlier the code allowed such files; now they are prohibited as the file format specification requires.
2008-01-23Fix a bug related to 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6.Lasse Collin1-6/+7
lzma_metadata.header_metadata_size was not properly set to zero if the Metadata had only the Metadata Flags field.
2008-01-23Fix decoding of Extra Records that have empty Data.Lasse Collin1-1/+12
2008-01-23Add the trailing '\0' to lzma_extra.data as the API headerLasse Collin1-1/+3
already documents.
2008-01-23Return LZMA_STREAM_END instead of LZMA_OK ifLasse Collin1-1/+5
LZMA_SYNC_FLUSH or LZMA_FULL_FLUSH is used when there's no unfinished Block open.
2008-01-23Fixed a typo.Lasse Collin1-1/+1
2008-01-23Fix a memory leak in the Subblock encoder.Lasse Collin1-0/+1
2008-01-23Fix Size of Header Metadata Block handling. NowLasse Collin3-15/+15
lzma_metadata.header_metadata_size == LZMA_VLI_VALUE_UNKNOWN is not allowed at all. To indicate missing Header Metadata Block, header_metadata_size must be set to zero. This is what Metadata decoder does after this patch too. Note that other missing fields in lzma_metadata are still indicated with LZMA_VLI_VALUE_UNKNOWN. This isn't as illogical as it sounds at first, because missing Size of Header Metadata Block means that Header Metadata Block is not present in the Stream. With other Metadata fields, a missing field means only that the value is unknown.
2008-01-23Fix a memory leak in metadata_decoder.c.Lasse Collin1-0/+1
2008-01-23Fix the fix 863028cb7ad6d8d0455fa69348f56b376d7b908f whichLasse Collin1-1/+4
just moved to problem. Now it's really fixed.
2008-01-23Take advantage of return_if_error() macro inLasse Collin1-16/+8
lzma_info_metadata_set() in info.c.
2008-01-23Fixed a dangling pointer that caused invalid free().Lasse Collin1-0/+1
2008-01-22Added lzma_easy_* functions. These should make usingLasse Collin9-2/+256
liblzma as easy as using zlib, because the easy API don't require developers to know any fancy LZMA options. Note that Multi-Block Stream encoding is currently broken. The easy API should be OK, the bug(s) are elsewhere.
2008-01-22Fix Multi-Block Stream encoder's EOPM usage.Lasse Collin1-1/+1
2008-01-22Made lzma_extra pointers const in lzma_options_stream.Lasse Collin2-4/+8
2008-01-20Fix alignment handling bugs in Subblock encoder.Lasse Collin1-51/+119
This leaves one known alignment bug unfixed: If repeat count doesn't fit into 28-bit integer, the encoder has to split this to multiple Subblocks with Subblock Type `Repeating Data'. The extra Subblocks may have wrong alignment. Correct alignment is restored after the split Repeating Data has been completely written out. Since the encoder doesn't even try to fix the alignment unless the size of Data is at least 4 bytes, to trigger this bug you need at least 4 GiB of repeating data with sequence length of 4 or more bytes. Since the worst thing done by this bug is misaligned data (no data corruption), this bug simply isn't worth fixing, because a proper fix isn't simple.
2008-01-19Implemented LZMA_SYNC_FLUSH support to the Subblock encoder.Lasse Collin2-78/+214
The API for handing Subfilters was changed to make it consistent with LZMA_SYNC_FLUSH. A few sanity checks were added for Subfilter handling. Some small bugs were fixed. More comments were added.
2008-01-19Revised the Delta filter implementation. The initializationLasse Collin10-200/+363
function is still shared between encoder and decoder, but the actual coding is in separate files for encoder and decoder. There are now separate functions for the actual delta calculation depending on if Delta is the last filter in the chain or not. If it is the last, the new code copies the data from input to output buffer and does the delta calculation at the same time. The old code first copied the data, then did the delta in the target buffer, which required reading through the data twice. Support for LZMA_SYNC_FLUSH was added to the Delta encoder. This doesn't change anything in the file format.
2008-01-18Fix LZMA_SYNC_FLUSH handling in LZ and LZMA encoders.Lasse Collin3-33/+29
That code is now almost completely in LZ coder, where it can be shared with other LZ77-based algorithms in future.
2008-01-18Set stdin and stdout to binary mode on Windows. This patch isLasse Collin1-0/+9
a forward port of b7b22fcb979a16d3a47c8001f058c9f7d4416068 from lzma-utils-legacy.git. I don't know if the new code base builds on Windows, but this is a start.
2008-01-17Subblock decoder: Don't exit the main loop in decode_buffer()Lasse Collin1-133/+139
too early if we hit End of Input while decoding a Subblock of type Repeating Data. To keep the loop termination condition elegant, the order of enumerations in coder->sequence were changed. To keep the case-labels in roughly the same order as the enumerations in coder->sequence, large chunks of code was moved around. This made the diff big and ugly compared to the amount of the actual changes made.
2008-01-17Fix wrong too small size of argument unfiltered_maxLasse Collin1-1/+1
in ia64_coder_init(). It triggered assert() in simple_coder.c, and could have caused a buffer overflow. This error was probably a copypaste mistake, since most of the simple filters use unfiltered_max = 4.
2008-01-17Added --delta to the output of "lzma --help".Lasse Collin1-0/+4
2008-01-17Fix Subblock docoder: If Subblock filter was used with knownLasse Collin1-0/+6
Uncompressed Size, and the last output byte was from RLE, the code didn't stop decoding as it should have done.
2008-01-16Plugged a memory leak in stream_decoder.c.Lasse Collin1-0/+20
2008-01-16Added memory leak detection to lzmadec.c.Lasse Collin1-0/+3
2008-01-16Added lzma_memlimit_count().Lasse Collin2-0/+29
2008-01-16Added ARRAY_SIZE(array) macro.Lasse Collin1-0/+4
2008-01-16Make Uncompresed Size validation more strictLasse Collin1-1/+2
in alone_decoder.c.
2008-01-15Free the allocated memory in lzmadec if debugging isLasse Collin1-0/+7
enabled. This should make it possible to detect possible memory leaks with Valgrind.
2008-01-15Use fastpos.h when encoding LZMA dictionary size inLasse Collin1-21/+19
Filter Flags encoder.
2008-01-15Revised the fastpos code. It now uses the slightly fasterLasse Collin10-47/+746
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-15Added bsr.h.Lasse Collin2-0/+62
2008-01-15Omit invalid space from printf() format stringLasse Collin1-1/+1
in price_table_gen.c.
2008-01-15Removed a few unused macros from lzma_common.h.Lasse Collin1-6/+2
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 Collin3-55/+56
from macros to inline functions.
2008-01-15Fix CRC code in case --enable-small is used.Lasse Collin4-6/+2
2008-01-15Added precomputed range coder probability price table.Lasse Collin7-17/+153
2008-01-14Remove RC_BUFFER_SIZE from lzma_encoder_private.hLasse Collin1-2/+4
and replace it with a sanity check.
2008-01-14Major changes to LZ encoder, LZMA encoder, and range encoder.Lasse Collin4-140/+206
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.
2008-01-14Added one assert() to process.c of the command line tool.Lasse Collin1-0/+1
2008-01-14Don't use coder->lz.stream_end_was_reached in assertionsLasse Collin1-2/+0
in match_c.h.
2008-01-14In lzma_read_match_distances(), don't useLasse Collin1-3/+3
coder->lz.stream_end_was_reached. That variable will be removed, and the check isn't required anyway. Rearrange the check so that it doesn't make one to think that there could be an integer overflow.
2008-01-14Small LZMA_SYNC_FLUSH fixes to Block and Single-Stream encoders.Lasse Collin2-2/+3
2008-01-14More fixes to LZMA decoder's flush marker handling.Lasse Collin1-22/+30
2008-01-10Eliminate lzma_lz_encoder.must_move_pos. It's neededLasse Collin2-8/+2
only in one place which isn't performance criticial.
2008-01-08Take advantage of return_if_error() in block_decoder.c.Lasse Collin1-16/+7
2008-01-08Fix decoding of Blocks that have only Block Header.Lasse Collin1-23/+14
2008-01-08Disable CRC32 from Block Headers when --check=noneLasse Collin1-1/+1
has been specified.
2008-01-08Fixed encoding of empty files. Arguments to is_size_valid()Lasse Collin1-1/+1
were in wrong order in block_encoder.c.
2008-01-08More pre-C99 inttypes.h compatibility fixes. Now the codeLasse Collin5-29/+6
should work even if the system has no inttypes.h.
2008-01-06With printf(), use PRIu64 with a cast to uint64_t insteadLasse Collin2-8/+11
of %zu, because some pre-C99 libc versions don't support %zu.
2008-01-06Introduced compatibility with systems that have pre-C99Lasse Collin11-32/+86
or no inttypes.h. This is useful when the compiler has good enough support for C99, but libc headers don't. Changed liblzma API so that sys/types.h and inttypes.h have to be #included before #including lzma.h. On systems that don't have C99 inttypes.h, it's the problem of the applications to provide the required types and macros before #including lzma.h. If lzma.h defined the missing types and macros, it could conflict with third-party applications whose configure has detected that the types are missing and defined them in config.h already. An alternative would have been introducing lzma_uint32 and similar types, but that would just be an extra pain on modern systems.
2008-01-05Fix typo in comment (INT64_MAX -> UINT64_MAX).Lasse Collin1-1/+1
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 Collin2-117/+104
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 Collin2-63/+66
five input bytes) from LZMA decoder to range decoder header. Did the same for decoding of direct bits.
2007-12-14Use the filename suffix .S instead of .s for assembler filesLasse Collin3-2/+2
so that the preprocessor removes the /* */ style comments, which are not supported by some non-GNU assemblers (Solaris) that otherwise work with this code.
2007-12-14Fixed wrong symbol name in crc64_x86.s.Lasse Collin1-1/+1
2007-12-14Use .globl instead of .global in x86 assembler code forLasse Collin2-2/+2
better portability. Still needs fixing the commenting.
2007-12-13Fixed a few short options that take an argument.Lasse Collin1-1/+1
short_opts[] was missing colons to indicate required argument. Thanks to Fabio Pedretti for the bug report.
2007-12-11Removed uncompressed size tracking from Delta encoder too.Lasse Collin1-18/+3
2007-12-11Remove uncompressed size tracking from the filter encoders.Lasse Collin3-80/+12
It's not strictly needed there, and just complicates the code. LZ encoder never even had this feature. The primary reason to have uncompressed size tracking in filter encoders was validating that the application doesn't give different amount of input that it had promised. A side effect was to validate internal workings of liblzma. Uncompressed size tracking is still present in the Block encoder. Maybe it should be added to LZMA_Alone and raw encoders too. It's simpler to have one coder just to validate the uncompressed size instead of having it in every filter.
2007-12-11Get rid of no-NLS gnulib. I don't know how to get itLasse Collin2-2/+4
working with Automake. People who want smaller lzmadec should use --disable-nls on non-GNU systems.
2007-12-11Fixed wrong type of flags_size in Subblock encoder.Lasse Collin1-1/+1
2007-12-10Bumped version number to 4.42.3alpha.Lasse Collin1-1/+1
2007-12-09Added LZMA_SYNC_FLUSH support to the Copy filter.Lasse Collin1-35/+57
2007-12-09Added missing LZMA_API to the C versions of the CRC functions.Lasse Collin2-2/+2
The x86 assembler versions were already OK.
2007-12-09Take advantage of return_if_error() macro in more places.Lasse Collin7-138/+63
Cleaned Subblock filter's initialization code too.
2007-12-09Re-enabled the security checks in Subblock decoderLasse Collin1-3/+3
that were disabled for debugging reasons.
2007-12-09Imported to git.Lasse Collin195-0/+30589