Lasse Collin [Wed, 10 Sep 2008 14:02:00 +0000 (17:02 +0300)]
Check for LZMA_FILTER_RESERVED_START in filter_flags_encoder.c.
Use LZMA_PROG_ERROR instead of LZMA_HEADER_ERROR if the Filter ID
is in the reserved range. This allows Block Header encoder to
detect unallowed Filter IDs, which is good for Stream encoder.
Lasse Collin [Tue, 9 Sep 2008 21:27:02 +0000 (00:27 +0300)]
Cleaned up Block encoder and moved the no longer shared
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.
Lasse Collin [Thu, 4 Sep 2008 08:53:06 +0000 (11:53 +0300)]
Added support for raw encoding and decoding to the command
line tool, and made various cleanups. --lzma was renamed to
--lzma1 to prevent people from accidentally using LZMA when
they want LZMA2.
Lasse Collin [Thu, 4 Sep 2008 07:39:15 +0000 (10:39 +0300)]
Don't allow LZMA_SYNC_FLUSH with decoders anymore. There's
simply nothing that would use it. Allow LZMA_FINISH to the
decoders, which will usually ignore it (auto decoder and
Stream decoder being exceptions).
Lasse Collin [Tue, 2 Sep 2008 16:12:12 +0000 (19:12 +0300)]
Updated auto decoder to handle LZMA_CONCATENATED when decoding
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.
Lasse Collin [Thu, 28 Aug 2008 19:53:15 +0000 (22:53 +0300)]
Sort of garbage collection commit. :-| Many things are still
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.
Lasse Collin [Wed, 18 Jun 2008 15:02:10 +0000 (18:02 +0300)]
Update the code to mostly match the new simpler file format
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.
Lasse Collin [Tue, 17 Jun 2008 12:03:46 +0000 (15:03 +0300)]
Update the file format specification draft. The new one is
a lot simpler than the previous versions, but it also means
that the existing code will change a lot.
Lasse Collin [Wed, 11 Jun 2008 12:08:44 +0000 (15:08 +0300)]
Improve command line integer parsing a little in lzma and
lzmadec to make them accept also KiB in addition Ki etc.
Fix also memory usage information in lzmadec --help.
Lasse Collin [Sun, 1 Jun 2008 09:48:17 +0000 (12:48 +0300)]
Fix a buffer overflow in the LZMA encoder. It was due to my
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.
Lasse Collin [Sun, 11 May 2008 11:17:21 +0000 (14:17 +0300)]
Improved C99 compiler detection in configure.ac. It will
pass -std=gnu99 instead of -std=c99 to GCC now, but -pedantic
should still give warnings about GNU extensions like before
except with some special keywords like asm().
Lasse Collin [Fri, 25 Apr 2008 12:39:50 +0000 (15:39 +0300)]
Prevent LZ encoder from hanging with known uncompressed
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.
Lasse Collin [Fri, 25 Apr 2008 10:58:56 +0000 (13:58 +0300)]
Removed src/liblzma/common/sysdefs.h symlink, which was
annoying, because "make dist" put two copies of sysdefs.h
into the tarball instead of the symlink.
Lasse Collin [Fri, 25 Apr 2008 10:32:35 +0000 (13:32 +0300)]
Bumped version number to 4.999.3alpha. It will become 5.0.0
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.
Lasse Collin [Mon, 24 Mar 2008 14:38:40 +0000 (16:38 +0200)]
Replaced the range decoder optimization that used arithmetic
right shift with as fast version that doesn't need
arithmetic right shift. Removed the related check from
configure.ac.
Lasse Collin [Fri, 21 Mar 2008 22:57:33 +0000 (00:57 +0200)]
Demystified the "state" variable in LZMA code. Use the
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.
Lasse Collin [Mon, 10 Mar 2008 11:46:48 +0000 (13:46 +0200)]
Initialize align_price_count and match_price_count in
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.
Lasse Collin [Mon, 10 Mar 2008 11:44:29 +0000 (13:44 +0200)]
Always initialize lz->temp_size in lz_decoder.c. temp_size did
get initialized as a side-effect after allocating a new decoder,
but not when the decoder was reused.
Lasse Collin [Sat, 2 Feb 2008 12:51:06 +0000 (14:51 +0200)]
Don't memzero() the history buffer when initializing LZ
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.
Lasse Collin [Fri, 25 Jan 2008 22:25:34 +0000 (00:25 +0200)]
Return LZMA_HEADER_ERROR if LZMA_SYNC_FLUSH is used with any
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.
Lasse Collin [Fri, 25 Jan 2008 21:12:36 +0000 (23:12 +0200)]
Combine lzma_options_block validation needed by both Block
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.
Lasse Collin [Fri, 25 Jan 2008 17:20:28 +0000 (19:20 +0200)]
Improved the memory limitter:
- 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.
Lasse Collin [Wed, 23 Jan 2008 21:43:00 +0000 (23:43 +0200)]
Fix decoding of empty Metadata Blocks, that don't have
even the Metadata Flags field. Earlier the code allowed
such files; now they are prohibited as the file format
specification requires.
Lasse Collin [Wed, 23 Jan 2008 21:38:18 +0000 (23:38 +0200)]
Fix a bug related to 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6.
lzma_metadata.header_metadata_size was not properly set to
zero if the Metadata had only the Metadata Flags field.
Lasse Collin [Wed, 23 Jan 2008 11:36:07 +0000 (13:36 +0200)]
Fix Size of Header Metadata Block handling. Now
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.
Lasse Collin [Tue, 22 Jan 2008 20:49:24 +0000 (22:49 +0200)]
Added lzma_easy_* functions. These should make using
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.