1
0
Fork 0

Adding upstream version 1.6~pre1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-20 20:19:30 +01:00
parent 9300469d70
commit ba5d134f3a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
15 changed files with 149 additions and 142 deletions

View file

@ -1,3 +1,9 @@
2013-10-07 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.6-pre1 released.
* configure: Added new option '--disable-ldconfig'.
* Makefile.in: Ignore errors from ldconfig.
2013-09-15 Antonio Diaz Diaz <antonio@gnu.org> 2013-09-15 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.5 released. * Version 1.5 released.

View file

@ -95,7 +95,8 @@ install-bin : all
fi ; \ fi ; \
cd "$(DESTDIR)$(libdir)" && ln -s lib$(libname).so.$(pkgversion) lib$(libname).so ; \ cd "$(DESTDIR)$(libdir)" && ln -s lib$(libname).so.$(pkgversion) lib$(libname).so ; \
cd "$(DESTDIR)$(libdir)" && ln -s lib$(libname).so.$(pkgversion) lib$(libname).so.$(soversion) ; \ cd "$(DESTDIR)$(libdir)" && ln -s lib$(libname).so.$(pkgversion) lib$(libname).so.$(soversion) ; \
if [ $${run_ldconfig} = yes ] && [ -x "$(LDCONFIG)" ] ; then "$(LDCONFIG)" -n "$(DESTDIR)$(libdir)" ; fi ; \ if [ "${disable_ldconfig}" != yes ] && [ $${run_ldconfig} = yes ] && \
[ -x "$(LDCONFIG)" ] ; then "$(LDCONFIG)" -n "$(DESTDIR)$(libdir)" || true ; fi ; \
fi fi
install-info : install-info :

9
NEWS
View file

@ -1,8 +1,7 @@
Changes in version 1.5: Changes in version 1.6:
Decompression support for deprecated version 0 files has been removed. Improved portability to BSD systems:
A bug has been fixed that would make an instance of "struct LZ_Encoder" The configure script now accepts the option "--disable-ldconfig".
unresponsive if "LZ_compress_sync_flush" is called at the wrong moment.
Minor fixes have been made. "make install" now ignores any errors from ldconfig.

6
configure vendored
View file

@ -6,10 +6,11 @@
# to copy, distribute and modify it. # to copy, distribute and modify it.
pkgname=lzlib pkgname=lzlib
pkgversion=1.5 pkgversion=1.6-pre1
soversion=1 soversion=1
progname=minilzip progname=minilzip
progname_shared= progname_shared=
disable_ldconfig=
libname=lz libname=lz
srctrigger=doc/${pkgname}.texinfo srctrigger=doc/${pkgname}.texinfo
@ -72,6 +73,7 @@ while [ $# != 0 ] ; do
echo " --libdir=DIR object code libraries [${libdir}]" echo " --libdir=DIR object code libraries [${libdir}]"
echo " --mandir=DIR man pages directory [${mandir}]" echo " --mandir=DIR man pages directory [${mandir}]"
echo " --enable-shared build also a shared library [disable]" echo " --enable-shared build also a shared library [disable]"
echo " --disable-ldconfig do not run ldconfig after install"
echo " CC=COMPILER C compiler to use [gcc]" echo " CC=COMPILER C compiler to use [gcc]"
echo " CPPFLAGS=OPTIONS command line options for the preprocessor [${CPPFLAGS}]" echo " CPPFLAGS=OPTIONS command line options for the preprocessor [${CPPFLAGS}]"
echo " CFLAGS=OPTIONS command line options for the C compiler [${CFLAGS}]" echo " CFLAGS=OPTIONS command line options for the C compiler [${CFLAGS}]"
@ -102,6 +104,7 @@ while [ $# != 0 ] ; do
--mandir=*) mandir=${optarg} ;; --mandir=*) mandir=${optarg} ;;
--no-create) no_create=yes ;; --no-create) no_create=yes ;;
--enable-shared) progname_shared=${progname}_shared ;; --enable-shared) progname_shared=${progname}_shared ;;
--disable-ldconfig) disable_ldconfig=yes ;;
CC=*) CC=${optarg} ;; CC=*) CC=${optarg} ;;
CPPFLAGS=*) CPPFLAGS=${optarg} ;; CPPFLAGS=*) CPPFLAGS=${optarg} ;;
@ -191,6 +194,7 @@ pkgversion = ${pkgversion}
soversion = ${soversion} soversion = ${soversion}
progname = ${progname} progname = ${progname}
progname_shared = ${progname_shared} progname_shared = ${progname_shared}
disable_ldconfig = ${disable_ldconfig}
libname = ${libname} libname = ${libname}
VPATH = ${srcdir} VPATH = ${srcdir}
prefix = ${prefix} prefix = ${prefix}

View file

@ -86,9 +86,9 @@ static int LZd_decode_member( struct LZ_decoder * const decoder )
else else
{ {
int len; int len;
if( Rd_decode_bit( rdec, &decoder->bm_rep[*state] ) == 1 ) /* 2nd bit */ if( Rd_decode_bit( rdec, &decoder->bm_rep[*state] ) != 0 ) /* 2nd bit */
{ {
if( Rd_decode_bit( rdec, &decoder->bm_rep0[*state] ) == 1 ) /* 3rd bit */ if( Rd_decode_bit( rdec, &decoder->bm_rep0[*state] ) != 0 ) /* 3rd bit */
{ {
unsigned distance; unsigned distance;
if( Rd_decode_bit( rdec, &decoder->bm_rep1[*state] ) == 0 ) /* 4th bit */ if( Rd_decode_bit( rdec, &decoder->bm_rep1[*state] ) == 0 ) /* 4th bit */
@ -118,7 +118,7 @@ static int LZd_decode_member( struct LZ_decoder * const decoder )
int dis_slot; int dis_slot;
const unsigned rep0_saved = decoder->rep0; const unsigned rep0_saved = decoder->rep0;
len = min_match_len + Rd_decode_len( rdec, &decoder->match_len_model, pos_state ); len = min_match_len + Rd_decode_len( rdec, &decoder->match_len_model, pos_state );
dis_slot = Rd_decode_tree6( rdec, decoder->bm_dis_slot[get_dis_state(len)] ); dis_slot = Rd_decode_tree6( rdec, decoder->bm_dis_slot[get_len_state(len)] );
if( dis_slot < start_dis_model ) decoder->rep0 = dis_slot; if( dis_slot < start_dis_model ) decoder->rep0 = dis_slot;
else else
{ {

View file

@ -326,7 +326,7 @@ struct LZ_decoder
Bit_model bm_rep1[states]; Bit_model bm_rep1[states];
Bit_model bm_rep2[states]; Bit_model bm_rep2[states];
Bit_model bm_len[states][pos_states]; Bit_model bm_len[states][pos_states];
Bit_model bm_dis_slot[dis_states][1<<dis_slot_bits]; Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];
Bit_model bm_dis[modeled_distances-end_dis_model]; Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size]; Bit_model bm_align[dis_align_size];
@ -405,7 +405,7 @@ static inline bool LZd_init( struct LZ_decoder * const decoder,
Bm_array_init( decoder->bm_rep1, states ); Bm_array_init( decoder->bm_rep1, states );
Bm_array_init( decoder->bm_rep2, states ); Bm_array_init( decoder->bm_rep2, states );
Bm_array_init( decoder->bm_len[0], states * pos_states ); Bm_array_init( decoder->bm_len[0], states * pos_states );
Bm_array_init( decoder->bm_dis_slot[0], dis_states * (1 << dis_slot_bits) ); Bm_array_init( decoder->bm_dis_slot[0], len_states * (1 << dis_slot_bits) );
Bm_array_init( decoder->bm_dis, modeled_distances - end_dis_model ); Bm_array_init( decoder->bm_dis, modeled_distances - end_dis_model );
Bm_array_init( decoder->bm_align, dis_align_size ); Bm_array_init( decoder->bm_align, dis_align_size );

View file

@ -1,4 +1,4 @@
This is lzlib.info, produced by makeinfo version 4.13 from This is lzlib.info, produced by makeinfo version 4.13+ from
lzlib.texinfo. lzlib.texinfo.
INFO-DIR-SECTION Data Compression INFO-DIR-SECTION Data Compression
@ -12,7 +12,7 @@ File: lzlib.info, Node: Top, Next: Introduction, Up: (dir)
Lzlib Manual Lzlib Manual
************ ************
This manual is for Lzlib (version 1.5, 15 September 2013). This manual is for Lzlib (version 1.6-pre1, 7 October 2013).
* Menu: * Menu:
@ -51,8 +51,8 @@ clean, provides very safe 4 factor integrity checking, and is backed by
the recovery capabilities of lziprecover. the recovery capabilities of lziprecover.
The functions and variables forming the interface of the compression The functions and variables forming the interface of the compression
library are declared in the file `lzlib.h'. Usage examples of the library are declared in the file 'lzlib.h'. Usage examples of the
library are given in the files `main.c' and `bbexample.c' from the library are given in the files 'main.c' and 'bbexample.c' from the
source distribution. source distribution.
Compression/decompression is done by repeatedly calling a couple of Compression/decompression is done by repeatedly calling a couple of
@ -100,11 +100,11 @@ File: lzlib.info, Node: Library version, Next: Buffering, Prev: Introduction,
Returns the library version as a string. Returns the library version as a string.
-- Constant: const char * LZ_version_string -- Constant: const char * LZ_version_string
This constant is defined in the header file `lzlib.h'. This constant is defined in the header file 'lzlib.h'.
The application should compare LZ_version and LZ_version_string for The application should compare LZ_version and LZ_version_string for
consistency. If the first character differs, the library code actually consistency. If the first character differs, the library code actually
used may be incompatible with the `lzlib.h' header file used by the used may be incompatible with the 'lzlib.h' header file used by the
application. application.
if( LZ_version()[0] != LZ_version_string[0] ) if( LZ_version()[0] != LZ_version_string[0] )
@ -124,17 +124,17 @@ Finally, for security reasons, lzlib uses two more internal buffers.
These are the four buffers used by lzlib, and their guaranteed These are the four buffers used by lzlib, and their guaranteed
minimum sizes: minimum sizes:
* Input compression buffer. Written to by the `LZ_compress_write' * Input compression buffer. Written to by the 'LZ_compress_write'
function. Its size is two times the dictionary size set with the function. Its size is two times the dictionary size set with the
`LZ_compress_open' function or 64 KiB, whichever is larger. 'LZ_compress_open' function or 64 KiB, whichever is larger.
* Output compression buffer. Read from by the `LZ_compress_read' * Output compression buffer. Read from by the 'LZ_compress_read'
function. Its size is 64 KiB. function. Its size is 64 KiB.
* Input decompression buffer. Written to by the * Input decompression buffer. Written to by the
`LZ_decompress_write' function. Its size is 64 KiB. 'LZ_decompress_write' function. Its size is 64 KiB.
* Output decompression buffer. Read from by the `LZ_decompress_read' * Output decompression buffer. Read from by the 'LZ_decompress_read'
function. Its size is the dictionary size set in the header of the function. Its size is the dictionary size set in the header of the
member currently being decompressed or 64 KiB, whichever is larger. member currently being decompressed or 64 KiB, whichever is larger.
@ -175,8 +175,8 @@ File: lzlib.info, Node: Compression functions, Next: Decompression functions,
These are the functions used to compress data. In case of error, all of These are the functions used to compress data. In case of error, all of
them return -1 or 0, for signed and unsigned return values respectively, them return -1 or 0, for signed and unsigned return values respectively,
except `LZ_compress_open' whose return value must be verified by except 'LZ_compress_open' whose return value must be verified by
calling `LZ_compress_errno' before using it. calling 'LZ_compress_errno' before using it.
-- Function: struct LZ_Encoder * LZ_compress_open ( const int -- Function: struct LZ_Encoder * LZ_compress_open ( const int
DICTIONARY_SIZE, const int MATCH_LEN_LIMIT, const unsigned DICTIONARY_SIZE, const int MATCH_LEN_LIMIT, const unsigned
@ -187,9 +187,9 @@ calling `LZ_compress_errno' before using it.
could not be allocated. could not be allocated.
The returned pointer must be verified by calling The returned pointer must be verified by calling
`LZ_compress_errno' before using it. If `LZ_compress_errno' does 'LZ_compress_errno' before using it. If 'LZ_compress_errno' does
not return `LZ_ok', the returned pointer must not be used and not return 'LZ_ok', the returned pointer must not be used and
should be freed with `LZ_compress_close' to avoid memory leaks. should be freed with 'LZ_compress_close' to avoid memory leaks.
DICTIONARY_SIZE sets the dictionary size to be used, in bytes. DICTIONARY_SIZE sets the dictionary size to be used, in bytes.
Valid values range from 4 KiB to 512 MiB. Note that dictionary Valid values range from 4 KiB to 512 MiB. Note that dictionary
@ -211,45 +211,45 @@ calling `LZ_compress_errno' before using it.
) )
Frees all dynamically allocated data structures for this stream. Frees all dynamically allocated data structures for this stream.
This function discards any unprocessed input and does not flush This function discards any unprocessed input and does not flush
any pending output. After a call to `LZ_compress_close', ENCODER any pending output. After a call to 'LZ_compress_close', ENCODER
can no more be used as an argument to any LZ_compress function. can no more be used as an argument to any LZ_compress function.
-- Function: int LZ_compress_finish ( struct LZ_Encoder * const -- Function: int LZ_compress_finish ( struct LZ_Encoder * const
ENCODER ) ENCODER )
Use this function to tell `lzlib' that all the data for this member Use this function to tell 'lzlib' that all the data for this member
has already been written (with the `LZ_compress_write' function). has already been written (with the 'LZ_compress_write' function).
After all the produced compressed data has been read with After all the produced compressed data has been read with
`LZ_compress_read' and `LZ_compress_member_finished' returns 1, a 'LZ_compress_read' and 'LZ_compress_member_finished' returns 1, a
new member can be started with `LZ_compress_restart_member'. new member can be started with 'LZ_compress_restart_member'.
-- Function: int LZ_compress_restart_member ( struct LZ_Encoder * -- Function: int LZ_compress_restart_member ( struct LZ_Encoder *
const ENCODER, const unsigned long long MEMBER_SIZE ) const ENCODER, const unsigned long long MEMBER_SIZE )
Use this function to start a new member, in a multi-member data Use this function to start a new member, in a multi-member data
stream. Call this function only after stream. Call this function only after
`LZ_compress_member_finished' indicates that the current member 'LZ_compress_member_finished' indicates that the current member
has been fully read (with the `LZ_compress_read' function). has been fully read (with the 'LZ_compress_read' function).
-- Function: int LZ_compress_sync_flush ( struct LZ_Encoder * const -- Function: int LZ_compress_sync_flush ( struct LZ_Encoder * const
ENCODER ) ENCODER )
Use this function to make available to `LZ_compress_read' all the Use this function to make available to 'LZ_compress_read' all the
data already written with the `LZ_compress_write' function. data already written with the 'LZ_compress_write' function.
Repeated use of `LZ_compress_sync_flush' may degrade compression Repeated use of 'LZ_compress_sync_flush' may degrade compression
ratio, so use it only when needed. ratio, so use it only when needed.
-- Function: int LZ_compress_read ( struct LZ_Encoder * const ENCODER, -- Function: int LZ_compress_read ( struct LZ_Encoder * const ENCODER,
uint8_t * const BUFFER, const int SIZE ) uint8_t * const BUFFER, const int SIZE )
The `LZ_compress_read' function reads up to SIZE bytes from the The 'LZ_compress_read' function reads up to SIZE bytes from the
stream pointed to by ENCODER, storing the results in BUFFER. stream pointed to by ENCODER, storing the results in BUFFER.
The return value is the number of bytes actually read. This might The return value is the number of bytes actually read. This might
be less than SIZE; for example, if there aren't that many bytes be less than SIZE; for example, if there aren't that many bytes
left in the stream or if more bytes have to be yet written with the left in the stream or if more bytes have to be yet written with the
`LZ_compress_write' function. Note that reading less than SIZE 'LZ_compress_write' function. Note that reading less than SIZE
bytes is not an error. bytes is not an error.
-- Function: int LZ_compress_write ( struct LZ_Encoder * const -- Function: int LZ_compress_write ( struct LZ_Encoder * const
ENCODER, uint8_t * const BUFFER, const int SIZE ) ENCODER, uint8_t * const BUFFER, const int SIZE )
The `LZ_compress_write' function writes up to SIZE bytes from The 'LZ_compress_write' function writes up to SIZE bytes from
BUFFER to the stream pointed to by ENCODER. BUFFER to the stream pointed to by ENCODER.
The return value is the number of bytes actually written. This The return value is the number of bytes actually written. This
@ -258,11 +258,11 @@ calling `LZ_compress_errno' before using it.
-- Function: int LZ_compress_write_size ( struct LZ_Encoder * const -- Function: int LZ_compress_write_size ( struct LZ_Encoder * const
ENCODER ) ENCODER )
The `LZ_compress_write_size' function returns the maximum number of The 'LZ_compress_write_size' function returns the maximum number of
bytes that can be immediately written through the bytes that can be immediately written through the
`LZ_compress_write' function. 'LZ_compress_write' function.
It is guaranteed that an immediate call to `LZ_compress_write' will It is guaranteed that an immediate call to 'LZ_compress_write' will
accept a SIZE up to the returned number of bytes. accept a SIZE up to the returned number of bytes.
-- Function: enum LZ_Errno LZ_compress_errno ( struct LZ_Encoder * -- Function: enum LZ_Errno LZ_compress_errno ( struct LZ_Encoder *
@ -271,13 +271,13 @@ calling `LZ_compress_errno' before using it.
-- Function: int LZ_compress_finished ( struct LZ_Encoder * const -- Function: int LZ_compress_finished ( struct LZ_Encoder * const
ENCODER ) ENCODER )
Returns 1 if all the data has been read and `LZ_compress_close' can Returns 1 if all the data has been read and 'LZ_compress_close' can
be safely called. Otherwise it returns 0. be safely called. Otherwise it returns 0.
-- Function: int LZ_compress_member_finished ( struct LZ_Encoder * -- Function: int LZ_compress_member_finished ( struct LZ_Encoder *
const ENCODER ) const ENCODER )
Returns 1 if the current member, in a multi-member data stream, Returns 1 if the current member, in a multi-member data stream,
has been fully read and `LZ_compress_restart_member' can be safely has been fully read and 'LZ_compress_restart_member' can be safely
called. Otherwise it returns 0. called. Otherwise it returns 0.
-- Function: unsigned long long LZ_compress_data_position ( struct -- Function: unsigned long long LZ_compress_data_position ( struct
@ -307,8 +307,8 @@ File: lzlib.info, Node: Decompression functions, Next: Error codes, Prev: Com
These are the functions used to decompress data. In case of error, all These are the functions used to decompress data. In case of error, all
of them return -1 or 0, for signed and unsigned return values of them return -1 or 0, for signed and unsigned return values
respectively, except `LZ_decompress_open' whose return value must be respectively, except 'LZ_decompress_open' whose return value must be
verified by calling `LZ_decompress_errno' before using it. verified by calling 'LZ_decompress_errno' before using it.
-- Function: struct LZ_Decoder * LZ_decompress_open ( void ) -- Function: struct LZ_Decoder * LZ_decompress_open ( void )
Initializes the internal stream state for decompression and Initializes the internal stream state for decompression and
@ -317,35 +317,35 @@ verified by calling `LZ_decompress_errno' before using it.
decoder could not be allocated. decoder could not be allocated.
The returned pointer must be verified by calling The returned pointer must be verified by calling
`LZ_decompress_errno' before using it. If `LZ_decompress_errno' 'LZ_decompress_errno' before using it. If 'LZ_decompress_errno'
does not return `LZ_ok', the returned pointer must not be used and does not return 'LZ_ok', the returned pointer must not be used and
should be freed with `LZ_decompress_close' to avoid memory leaks. should be freed with 'LZ_decompress_close' to avoid memory leaks.
-- Function: int LZ_decompress_close ( struct LZ_Decoder * const -- Function: int LZ_decompress_close ( struct LZ_Decoder * const
DECODER ) DECODER )
Frees all dynamically allocated data structures for this stream. Frees all dynamically allocated data structures for this stream.
This function discards any unprocessed input and does not flush This function discards any unprocessed input and does not flush
any pending output. After a call to `LZ_decompress_close', DECODER any pending output. After a call to 'LZ_decompress_close', DECODER
can no more be used as an argument to any LZ_decompress function. can no more be used as an argument to any LZ_decompress function.
-- Function: int LZ_decompress_finish ( struct LZ_Decoder * const -- Function: int LZ_decompress_finish ( struct LZ_Decoder * const
DECODER ) DECODER )
Use this function to tell `lzlib' that all the data for this stream Use this function to tell 'lzlib' that all the data for this stream
has already been written (with the `LZ_decompress_write' function). has already been written (with the 'LZ_decompress_write' function).
-- Function: int LZ_decompress_reset ( struct LZ_Decoder * const -- Function: int LZ_decompress_reset ( struct LZ_Decoder * const
DECODER ) DECODER )
Resets the internal state of DECODER as it was just after opening Resets the internal state of DECODER as it was just after opening
it with the `LZ_decompress_open' function. Data stored in the it with the 'LZ_decompress_open' function. Data stored in the
internal buffers is discarded. Position counters are set to 0. internal buffers is discarded. Position counters are set to 0.
-- Function: int LZ_decompress_sync_to_member ( struct LZ_Decoder * -- Function: int LZ_decompress_sync_to_member ( struct LZ_Decoder *
const DECODER ) const DECODER )
Resets the error state of DECODER and enters a search state that Resets the error state of DECODER and enters a search state that
lasts until a new member header (or the end of the stream) is lasts until a new member header (or the end of the stream) is
found. After a successful call to `LZ_decompress_sync_to_member', found. After a successful call to 'LZ_decompress_sync_to_member',
data written with `LZ_decompress_write' will be consumed and data written with 'LZ_decompress_write' will be consumed and
`LZ_decompress_read' will return 0 until a header is found. 'LZ_decompress_read' will return 0 until a header is found.
This function is useful to discard any data preceding the first This function is useful to discard any data preceding the first
member, or to discard the rest of the current member, for example member, or to discard the rest of the current member, for example
@ -354,18 +354,18 @@ verified by calling `LZ_decompress_errno' before using it.
-- Function: int LZ_decompress_read ( struct LZ_Decoder * const -- Function: int LZ_decompress_read ( struct LZ_Decoder * const
DECODER, uint8_t * const BUFFER, const int SIZE ) DECODER, uint8_t * const BUFFER, const int SIZE )
The `LZ_decompress_read' function reads up to SIZE bytes from the The 'LZ_decompress_read' function reads up to SIZE bytes from the
stream pointed to by DECODER, storing the results in BUFFER. stream pointed to by DECODER, storing the results in BUFFER.
The return value is the number of bytes actually read. This might The return value is the number of bytes actually read. This might
be less than SIZE; for example, if there aren't that many bytes be less than SIZE; for example, if there aren't that many bytes
left in the stream or if more bytes have to be yet written with the left in the stream or if more bytes have to be yet written with the
`LZ_decompress_write' function. Note that reading less than SIZE 'LZ_decompress_write' function. Note that reading less than SIZE
bytes is not an error. bytes is not an error.
-- Function: int LZ_decompress_write ( struct LZ_Decoder * const -- Function: int LZ_decompress_write ( struct LZ_Decoder * const
DECODER, uint8_t * const BUFFER, const int SIZE ) DECODER, uint8_t * const BUFFER, const int SIZE )
The `LZ_decompress_write' function writes up to SIZE bytes from The 'LZ_decompress_write' function writes up to SIZE bytes from
BUFFER to the stream pointed to by DECODER. BUFFER to the stream pointed to by DECODER.
The return value is the number of bytes actually written. This The return value is the number of bytes actually written. This
@ -374,11 +374,11 @@ verified by calling `LZ_decompress_errno' before using it.
-- Function: int LZ_decompress_write_size ( struct LZ_Decoder * const -- Function: int LZ_decompress_write_size ( struct LZ_Decoder * const
DECODER ) DECODER )
The `LZ_decompress_write_size' function returns the maximum number The 'LZ_decompress_write_size' function returns the maximum number
of bytes that can be immediately written through the of bytes that can be immediately written through the
`LZ_decompress_write' function. 'LZ_decompress_write' function.
It is guaranteed that an immediate call to `LZ_decompress_write' It is guaranteed that an immediate call to 'LZ_decompress_write'
will accept a SIZE up to the returned number of bytes. will accept a SIZE up to the returned number of bytes.
-- Function: enum LZ_Errno LZ_decompress_errno ( struct LZ_Decoder * -- Function: enum LZ_Errno LZ_decompress_errno ( struct LZ_Decoder *
@ -387,16 +387,16 @@ verified by calling `LZ_decompress_errno' before using it.
-- Function: int LZ_decompress_finished ( struct LZ_Decoder * const -- Function: int LZ_decompress_finished ( struct LZ_Decoder * const
DECODER ) DECODER )
Returns 1 if all the data has been read and `LZ_decompress_close' Returns 1 if all the data has been read and 'LZ_decompress_close'
can be safely called. Otherwise it returns 0. can be safely called. Otherwise it returns 0.
-- Function: int LZ_decompress_member_finished ( struct LZ_Decoder * -- Function: int LZ_decompress_member_finished ( struct LZ_Decoder *
const DECODER ) const DECODER )
Returns 1 if the previous call to `LZ_decompress_read' finished Returns 1 if the previous call to 'LZ_decompress_read' finished
reading the current member, indicating that final values for reading the current member, indicating that final values for
member are available through `LZ_decompress_data_crc', member are available through 'LZ_decompress_data_crc',
`LZ_decompress_data_position', and 'LZ_decompress_data_position', and
`LZ_decompress_member_position'. Otherwise it returns 0. 'LZ_decompress_member_position'. Otherwise it returns 0.
-- Function: int LZ_decompress_member_version ( struct LZ_Decoder * -- Function: int LZ_decompress_member_version ( struct LZ_Decoder *
const DECODER ) const DECODER )
@ -410,7 +410,7 @@ verified by calling `LZ_decompress_errno' before using it.
const DECODER ) const DECODER )
Returns the 32 bit Cyclic Redundancy Check of the data Returns the 32 bit Cyclic Redundancy Check of the data
decompressed from the current member. The returned value is valid decompressed from the current member. The returned value is valid
only when `LZ_decompress_member_finished' returns 1. only when 'LZ_decompress_member_finished' returns 1.
-- Function: unsigned long long LZ_decompress_data_position ( struct -- Function: unsigned long long LZ_decompress_data_position ( struct
LZ_Decoder * const DECODER ) LZ_Decoder * const DECODER )
@ -440,16 +440,16 @@ File: lzlib.info, Node: Error codes, Next: Error messages, Prev: Decompressio
Most library functions return -1 to indicate that they have failed. But Most library functions return -1 to indicate that they have failed. But
this return value only tells you that an error has occurred. To find out this return value only tells you that an error has occurred. To find out
what kind of error it was, you need to verify the error code by calling what kind of error it was, you need to verify the error code by calling
`LZ_(de)compress_errno'. 'LZ_(de)compress_errno'.
Library functions do not change the value returned by Library functions do not change the value returned by
`LZ_(de)compress_errno' when they succeed; thus, the value returned by 'LZ_(de)compress_errno' when they succeed; thus, the value returned by
`LZ_(de)compress_errno' after a successful call is not necessarily 'LZ_(de)compress_errno' after a successful call is not necessarily
LZ_ok, and you should not use `LZ_(de)compress_errno' to determine LZ_ok, and you should not use 'LZ_(de)compress_errno' to determine
whether a call failed. If the call failed, then you can examine whether a call failed. If the call failed, then you can examine
`LZ_(de)compress_errno'. 'LZ_(de)compress_errno'.
The error codes are defined in the header file `lzlib.h'. The error codes are defined in the header file 'lzlib.h'.
-- Constant: enum LZ_Errno LZ_ok -- Constant: enum LZ_Errno LZ_ok
The value of this constant is 0 and is used to indicate that there The value of this constant is 0 and is used to indicate that there
@ -465,8 +465,8 @@ whether a call failed. If the call failed, then you can examine
-- Constant: enum LZ_Errno LZ_sequence_error -- Constant: enum LZ_Errno LZ_sequence_error
A library function was called in the wrong order. For example A library function was called in the wrong order. For example
`LZ_compress_restart_member' was called before 'LZ_compress_restart_member' was called before
`LZ_compress_member_finished' indicates that the current member is 'LZ_compress_member_finished' indicates that the current member is
finished. finished.
-- Constant: enum LZ_Errno LZ_header_error -- Constant: enum LZ_Errno LZ_header_error
@ -497,7 +497,7 @@ File: lzlib.info, Node: Error messages, Next: Data format, Prev: Error codes,
library call. library call.
The value of LZ_ERRNO normally comes from a call to The value of LZ_ERRNO normally comes from a call to
`LZ_(de)compress_errno'. 'LZ_(de)compress_errno'.
 
File: lzlib.info, Node: Data format, Next: Examples, Prev: Error messages, Up: Top File: lzlib.info, Node: Data format, Next: Examples, Prev: Error messages, Up: Top
@ -534,15 +534,15 @@ with no additional information before, between, or after them.
All multibyte values are stored in little endian order. All multibyte values are stored in little endian order.
`ID string' 'ID string'
A four byte string, identifying the lzip format, with the value A four byte string, identifying the lzip format, with the value
"LZIP" (0x4C, 0x5A, 0x49, 0x50). "LZIP" (0x4C, 0x5A, 0x49, 0x50).
`VN (version number, 1 byte)' 'VN (version number, 1 byte)'
Just in case something needs to be modified in the future. 1 for Just in case something needs to be modified in the future. 1 for
now. now.
`DS (coded dictionary size, 1 byte)' 'DS (coded dictionary size, 1 byte)'
Lzip divides the distance between any two powers of 2 into 8 Lzip divides the distance between any two powers of 2 into 8
equally spaced intervals, named "wedges". The dictionary size is equally spaced intervals, named "wedges". The dictionary size is
calculated by taking a power of 2 (the base size) and substracting calculated by taking a power of 2 (the base size) and substracting
@ -554,20 +554,20 @@ with no additional information before, between, or after them.
Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB
Valid values for dictionary size range from 4 KiB to 512 MiB. Valid values for dictionary size range from 4 KiB to 512 MiB.
`Lzma stream' 'Lzma stream'
The lzma stream, finished by an end of stream marker. Uses default The lzma stream, finished by an end of stream marker. Uses default
values for encoder properties. See the lzip manual for a full values for encoder properties. See the lzip manual for a full
description. description.
Lzip only uses the LZMA marker `2' ("End Of Stream" marker). Lzlib Lzip only uses the LZMA marker '2' ("End Of Stream" marker). Lzlib
also uses the LZMA marker `3' ("Sync Flush" marker). also uses the LZMA marker '3' ("Sync Flush" marker).
`CRC32 (4 bytes)' 'CRC32 (4 bytes)'
CRC of the uncompressed original data. CRC of the uncompressed original data.
`Data size (8 bytes)' 'Data size (8 bytes)'
Size of the uncompressed original data. Size of the uncompressed original data.
`Member size (8 bytes)' 'Member size (8 bytes)'
Total size of the member, including header and trailer. This field Total size of the member, including header and trailer. This field
acts as a distributed index, allows the verification of stream acts as a distributed index, allows the verification of stream
integrity, and facilitates safe recovery of undamaged members from integrity, and facilitates safe recovery of undamaged members from
@ -582,7 +582,7 @@ File: lzlib.info, Node: Examples, Next: Problems, Prev: Data format, Up: Top
This chapter shows the order in which the library functions should be This chapter shows the order in which the library functions should be
called depending on what kind of data stream you want to compress or called depending on what kind of data stream you want to compress or
decompress. See the file `bbexample.c' in the source distribution for decompress. See the file 'bbexample.c' in the source distribution for
an example of how buffer-to-buffer compression/decompression can be an example of how buffer-to-buffer compression/decompression can be
implemented using lzlib. implemented using lzlib.
@ -707,8 +707,8 @@ for all eternity, if not longer.
If you find a bug in Lzlib, please send electronic mail to If you find a bug in Lzlib, please send electronic mail to
<lzip-bug@nongnu.org>. Include the version number, which you can find <lzip-bug@nongnu.org>. Include the version number, which you can find
by running `minilzip --version' or in `LZ_version_string' from by running 'minilzip --version' or in 'LZ_version_string' from
`lzlib.h'. 'lzlib.h'.
 
File: lzlib.info, Node: Concept index, Prev: Problems, Up: Top File: lzlib.info, Node: Concept index, Prev: Problems, Up: Top
@ -736,19 +736,19 @@ Concept index
 
Tag Table: Tag Table:
Node: Top217 Node: Top218
Node: Introduction1323 Node: Introduction1326
Node: Library version3904 Node: Library version3907
Node: Buffering4549 Node: Buffering4552
Node: Parameter limits5672 Node: Parameter limits5675
Node: Compression functions6631 Node: Compression functions6634
Node: Decompression functions12844 Node: Decompression functions12847
Node: Error codes19005 Node: Error codes19008
Node: Error messages20944 Node: Error messages20947
Node: Data format21523 Node: Data format21526
Node: Examples24172 Node: Examples24175
Node: Problems28255 Node: Problems28258
Node: Concept index28827 Node: Concept index28830
 
End Tag Table End Tag Table

View file

@ -6,8 +6,8 @@
@finalout @finalout
@c %**end of header @c %**end of header
@set UPDATED 15 September 2013 @set UPDATED 7 October 2013
@set VERSION 1.5 @set VERSION 1.6-pre1
@dircategory Data Compression @dircategory Data Compression
@direntry @direntry

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH MINILZIP "1" "September 2013" "Minilzip 1.5" "User Commands" .TH MINILZIP "1" "October 2013" "Minilzip 1.6-pre1" "User Commands"
.SH NAME .SH NAME
Minilzip \- reduces the size of files Minilzip \- reduces the size of files
.SH SYNOPSIS .SH SYNOPSIS
@ -83,7 +83,7 @@ Report bugs to lzip\-bug@nongnu.org
Lzlib home page: http://www.nongnu.org/lzip/lzlib.html Lzlib home page: http://www.nongnu.org/lzip/lzlib.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2013 Antonio Diaz Diaz. Copyright \(co 2013 Antonio Diaz Diaz.
Using Lzlib 1.5 Using Lzlib 1.6\-pre1
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -311,7 +311,7 @@ static void LZe_fill_align_prices( struct LZ_encoder * const encoder )
static void LZe_fill_distance_prices( struct LZ_encoder * const encoder ) static void LZe_fill_distance_prices( struct LZ_encoder * const encoder )
{ {
int dis, dis_state; int dis, len_state;
for( dis = start_dis_model; dis < modeled_distances; ++dis ) for( dis = start_dis_model; dis < modeled_distances; ++dis )
{ {
const int dis_slot = dis_slots[dis]; const int dis_slot = dis_slots[dis];
@ -320,15 +320,15 @@ static void LZe_fill_distance_prices( struct LZ_encoder * const encoder )
const int price = const int price =
price_symbol_reversed( encoder->bm_dis + base - dis_slot - 1, price_symbol_reversed( encoder->bm_dis + base - dis_slot - 1,
dis - base, direct_bits ); dis - base, direct_bits );
for( dis_state = 0; dis_state < dis_states; ++dis_state ) for( len_state = 0; len_state < len_states; ++len_state )
encoder->dis_prices[dis_state][dis] = price; encoder->dis_prices[len_state][dis] = price;
} }
for( dis_state = 0; dis_state < dis_states; ++dis_state ) for( len_state = 0; len_state < len_states; ++len_state )
{ {
int * const dsp = encoder->dis_slot_prices[dis_state]; int * const dsp = encoder->dis_slot_prices[len_state];
int * const dp = encoder->dis_prices[dis_state]; int * const dp = encoder->dis_prices[len_state];
const Bit_model * const bmds = encoder->bm_dis_slot[dis_state]; const Bit_model * const bmds = encoder->bm_dis_slot[len_state];
int slot = 0; int slot = 0;
for( ; slot < end_dis_model && slot < encoder->num_dis_slots; ++slot ) for( ; slot < end_dis_model && slot < encoder->num_dis_slots; ++slot )
dsp[slot] = price_symbol( bmds, slot, dis_slot_bits ); dsp[slot] = price_symbol( bmds, slot, dis_slot_bits );
@ -361,7 +361,7 @@ static bool LZe_init( struct LZ_encoder * const encoder,
Bm_array_init( encoder->bm_rep1, states ); Bm_array_init( encoder->bm_rep1, states );
Bm_array_init( encoder->bm_rep2, states ); Bm_array_init( encoder->bm_rep2, states );
Bm_array_init( encoder->bm_len[0], states * pos_states ); Bm_array_init( encoder->bm_len[0], states * pos_states );
Bm_array_init( encoder->bm_dis_slot[0], dis_states * (1 << dis_slot_bits) ); Bm_array_init( encoder->bm_dis_slot[0], len_states * (1 << dis_slot_bits) );
Bm_array_init( encoder->bm_dis, modeled_distances - end_dis_model ); Bm_array_init( encoder->bm_dis, modeled_distances - end_dis_model );
Bm_array_init( encoder->bm_align, dis_align_size ); Bm_array_init( encoder->bm_align, dis_align_size );

View file

@ -591,7 +591,7 @@ struct LZ_encoder
Bit_model bm_rep1[states]; Bit_model bm_rep1[states];
Bit_model bm_rep2[states]; Bit_model bm_rep2[states];
Bit_model bm_len[states][pos_states]; Bit_model bm_len[states][pos_states];
Bit_model bm_dis_slot[dis_states][1<<dis_slot_bits]; Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];
Bit_model bm_dis[modeled_distances-end_dis_model]; Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size]; Bit_model bm_align[dis_align_size];
@ -605,8 +605,8 @@ struct LZ_encoder
struct Pair pairs[max_match_len+1]; struct Pair pairs[max_match_len+1];
struct Trial trials[max_num_trials]; struct Trial trials[max_num_trials];
int dis_slot_prices[dis_states][2*max_dictionary_bits]; int dis_slot_prices[len_states][2*max_dictionary_bits];
int dis_prices[dis_states][modeled_distances]; int dis_prices[len_states][modeled_distances];
int align_prices[dis_align_size]; int align_prices[dis_align_size];
int align_price_count; int align_price_count;
int fill_counter; int fill_counter;
@ -678,12 +678,12 @@ static inline int LZe_price_rep0_len( const struct LZ_encoder * const encoder,
} }
static inline int LZe_price_dis( const struct LZ_encoder * const encoder, static inline int LZe_price_dis( const struct LZ_encoder * const encoder,
const int dis, const int dis_state ) const int dis, const int len_state )
{ {
if( dis < modeled_distances ) if( dis < modeled_distances )
return encoder->dis_prices[dis_state][dis]; return encoder->dis_prices[len_state][dis];
else else
return encoder->dis_slot_prices[dis_state][get_slot( dis )] + return encoder->dis_slot_prices[len_state][get_slot( dis )] +
encoder->align_prices[dis & (dis_align_size - 1)]; encoder->align_prices[dis & (dis_align_size - 1)];
} }
@ -692,7 +692,7 @@ static inline int LZe_price_pair( const struct LZ_encoder * const encoder,
const int pos_state ) const int pos_state )
{ {
return Lee_price( &encoder->match_len_encoder, len, pos_state ) + return Lee_price( &encoder->match_len_encoder, len, pos_state ) +
LZe_price_dis( encoder, dis, get_dis_state( len ) ); LZe_price_dis( encoder, dis, get_len_state( len ) );
} }
static inline int LZe_price_literal( const struct LZ_encoder * const encoder, static inline int LZe_price_literal( const struct LZ_encoder * const encoder,
@ -723,7 +723,7 @@ static inline void LZe_encode_pair( struct LZ_encoder * const encoder,
{ {
const int dis_slot = get_slot( dis ); const int dis_slot = get_slot( dis );
Lee_encode( &encoder->match_len_encoder, &encoder->renc, len, pos_state ); Lee_encode( &encoder->match_len_encoder, &encoder->renc, len, pos_state );
Re_encode_tree( &encoder->renc, encoder->bm_dis_slot[get_dis_state(len)], Re_encode_tree( &encoder->renc, encoder->bm_dis_slot[get_len_state(len)],
dis_slot, dis_slot_bits ); dis_slot, dis_slot_bits );
if( dis_slot >= start_dis_model ) if( dis_slot >= start_dis_model )

9
lzip.h
View file

@ -64,6 +64,7 @@ enum {
pos_states = 1 << pos_state_bits, pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1, pos_state_mask = pos_states - 1,
len_states = 4,
dis_slot_bits = 6, dis_slot_bits = 6,
start_dis_model = 4, start_dis_model = 4,
end_dis_model = 14, end_dis_model = 14,
@ -81,12 +82,10 @@ enum {
min_match_len = 2, /* must be 2 */ min_match_len = 2, /* must be 2 */
max_match_len = min_match_len + max_len_symbols - 1, /* 273 */ max_match_len = min_match_len + max_len_symbols - 1, /* 273 */
min_match_len_limit = 5, min_match_len_limit = 5 };
dis_states = 4 }; static inline int get_len_state( const int len )
{ return min( len - min_match_len, len_states - 1 ); }
static inline int get_dis_state( const int len )
{ return min( len - min_match_len, dis_states - 1 ); }
static inline int get_lit_state( const uint8_t prev_byte ) static inline int get_lit_state( const uint8_t prev_byte )
{ return ( prev_byte >> ( 8 - literal_context_bits ) ); } { return ( prev_byte >> ( 8 - literal_context_bits ) ); }

View file

@ -29,7 +29,7 @@
extern "C" { extern "C" {
#endif #endif
static const char * const LZ_version_string = "1.5"; static const char * const LZ_version_string = "1.6-pre1";
enum LZ_Errno { LZ_ok = 0, LZ_bad_argument, LZ_mem_error, enum LZ_Errno { LZ_ok = 0, LZ_bad_argument, LZ_mem_error,
LZ_sequence_error, LZ_header_error, LZ_unexpected_eof, LZ_sequence_error, LZ_header_error, LZ_unexpected_eof,

14
main.c
View file

@ -54,6 +54,10 @@
#include "carg_parser.h" #include "carg_parser.h"
#include "lzlib.h" #include "lzlib.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
#if CHAR_BIT != 8 #if CHAR_BIT != 8
#error "Environments where CHAR_BIT != 8 are not supported." #error "Environments where CHAR_BIT != 8 are not supported."
#endif #endif
@ -75,12 +79,6 @@ const char * const program_name = "minilzip";
const char * const program_year = "2013"; const char * const program_year = "2013";
const char * invocation_name = 0; const char * invocation_name = 0;
#ifdef O_BINARY
const int o_binary = O_BINARY;
#else
const int o_binary = 0;
#endif
struct { const char * from; const char * to; } const known_extensions[] = { struct { const char * from; const char * to; } const known_extensions[] = {
{ ".lz", "" }, { ".lz", "" },
{ ".tlz", ".tar" }, { ".tlz", ".tar" },
@ -306,7 +304,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp
} }
else else
{ {
infd = open( name, O_RDONLY | o_binary ); infd = open( name, O_RDONLY | O_BINARY );
if( infd < 0 ) if( infd < 0 )
{ {
if( verbosity >= 0 ) if( verbosity >= 0 )
@ -387,7 +385,7 @@ static void set_d_outname( const char * const name, const int i )
static bool open_outstream( const bool force ) static bool open_outstream( const bool force )
{ {
int flags = O_CREAT | O_WRONLY | o_binary; int flags = O_CREAT | O_WRONLY | O_BINARY;
if( force ) flags |= O_TRUNC; else flags |= O_EXCL; if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
outfd = open( output_filename, flags, outfd_mode ); outfd = open( output_filename, flags, outfd_mode );

View file

@ -67,7 +67,7 @@ if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi
cmp in copy || fail=1 cmp in copy || fail=1
printf . printf .
for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do for i in s4Ki 0 1 2 3 4 5 6 7s16 8s16 9s16 ; do
"${LZIP}" -k -$i in || fail=1 "${LZIP}" -k -$i in || fail=1
mv -f in.lz copy.lz || fail=1 mv -f in.lz copy.lz || fail=1
printf "garbage" >> copy.lz || fail=1 printf "garbage" >> copy.lz || fail=1
@ -76,7 +76,7 @@ for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do
done done
printf . printf .
for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do for i in s4Ki 0 1 2 3 4 5 6 7s16 8s16 9s16 ; do
"${LZIP}" -c -$i in > out || fail=1 "${LZIP}" -c -$i in > out || fail=1
printf "g" >> out || fail=1 printf "g" >> out || fail=1
"${LZIP}" -cd out > copy || fail=1 "${LZIP}" -cd out > copy || fail=1
@ -84,14 +84,14 @@ for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do
done done
printf . printf .
for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do for i in s4Ki 0 1 2 3 4 5 6 7s16 8s16 9s16 ; do
"${LZIP}" -$i < in > out || fail=1 "${LZIP}" -$i < in > out || fail=1
"${LZIP}" -d < out > copy || fail=1 "${LZIP}" -d < out > copy || fail=1
cmp in copy || fail=1 cmp in copy || fail=1
done done
printf . printf .
for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do for i in s4Ki 0 1 2 3 4 5 6 7s16 8s16 9s16 ; do
"${LZIP}" -f -$i -o out < in || fail=1 "${LZIP}" -f -$i -o out < in || fail=1
"${LZIP}" -df -o copy < out.lz || fail=1 "${LZIP}" -df -o copy < out.lz || fail=1
cmp in copy || fail=1 cmp in copy || fail=1