From 19cb9cdfc26d8e209ca88cc10afe0cff554c499b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 04:39:06 +0200 Subject: Merging upstream version 1.15~pre1. Signed-off-by: Daniel Baumann --- ChangeLog | 14 +++++++++++--- INSTALL | 14 ++++++++++---- Makefile.in | 21 +++++++++++++-------- NEWS | 22 +++++++--------------- README | 2 +- configure | 13 ++++++++++--- decoder.c | 10 +++++----- doc/lzlib.info | 52 +++++++++++++++++++++++++++------------------------- doc/lzlib.texi | 10 ++++++---- doc/minilzip.1 | 8 ++++---- encoder_base.c | 10 ++++------ lzlib.h | 4 ++-- minilzip.c | 10 +++++++--- 13 files changed, 107 insertions(+), 83 deletions(-) diff --git a/ChangeLog b/ChangeLog index f178fe7..a945949 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-04-19 Antonio Diaz Diaz + + * Version 1.15-pre1 released. + * Makefile.in: New target 'lib' which builds just the library. + New target 'bin' which builds the library and minilzip. + 'lib' is now the default; minilzip is no longer built by default. + 'install-bin' installs minilzip and its man page again. + * INSTALL: Document use of 'make bin'. + 2024-01-20 Antonio Diaz Diaz * Version 1.14 released. @@ -261,6 +270,5 @@ Copyright (C) 2009-2024 Antonio Diaz Diaz. -This file is a collection of facts, and thus it is not copyrightable, -but just in case, you have unlimited permission to copy, distribute, and -modify it. +This file is a collection of facts, and thus it is not copyrightable, but just +in case, you have unlimited permission to copy, distribute, and modify it. diff --git a/INSTALL b/INSTALL index 275b69b..570247e 100644 --- a/INSTALL +++ b/INSTALL @@ -35,10 +35,16 @@ extracted from the archive. ./configure CFLAGS+='-D __USE_MINGW_ANSI_STDIO' -3. Run make. +3. Run make make +to build the library, or + + make bin + +to build also minilzip. + 4. Optionally, type 'make check' to run the tests that come with lzlib. 5. Type 'make install' to install the library and any data files and @@ -52,9 +58,9 @@ extracted from the archive. You can install only the library or the info manual by typing 'make install-lib' or 'make install-info' respectively. - 'make install-bin install-man' installs the program minilzip and its man - page. 'install-bin' installs a shared minilzip if the shared library has - been configured. Else it installs a static minilzip. + 'make install-bin' installs the program minilzip and its man page. It + installs a shared minilzip if the shared library has been configured. + Else it installs a static minilzip. 'make install-bin-compress' additionally compresses the man page after installation. diff --git a/Makefile.in b/Makefile.in index de54626..cf90c91 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,7 +20,9 @@ objs = carg_parser.o minilzip.o uninstall uninstall-bin uninstall-lib uninstall-info uninstall-man \ doc info man check dist clean distclean -all : $(progname_static) $(progname_shared) +all : lib + +lib : $(libname_static) $(libname_shared) lib$(libname).a : lzlib.o $(AR) $(ARFLAGS) $@ $< @@ -28,6 +30,8 @@ lib$(libname).a : lzlib.o lib$(libname).so.$(pkgversion) : lzlib_sh.o $(CC) $(CFLAGS) $(LDFLAGS) -fpic -fPIC -shared -Wl,--soname=lib$(libname).so.$(soversion) -o $@ $< +bin : $(progname_static) $(progname_shared) + $(progname) : $(objs) lib$(libname).a $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objs) lib$(libname).a @@ -54,7 +58,8 @@ lzlib_sh.o : lzlib.c # prevent 'make' from trying to remake source files $(VPATH)/configure $(VPATH)/Makefile.in $(VPATH)/doc/$(pkgname).texi : ; -%.h %.c : ; +MAKEFLAGS += -r +.SUFFIXES : lzdeps = lzlib.h lzip.h cbuffer.c decoder.h decoder.c encoder_base.h \ encoder_base.c encoder.h encoder.c fast_encoder.h fast_encoder.c @@ -93,21 +98,21 @@ install-strip-compress : install-lib-strip install-info-compress install-bin-compress : install-bin install-man-compress install-bin-strip-compress : install-bin-strip install-man-compress -install-bin : all +install-bin : bin install-man if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi $(INSTALL_PROGRAM) ./$(progname_lzip) "$(DESTDIR)$(bindir)/$(progname)" -install-bin-strip : all +install-bin-strip : bin $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-bin -install-lib : all +install-lib : lib if [ ! -d "$(DESTDIR)$(includedir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(includedir)" ; fi if [ ! -d "$(DESTDIR)$(libdir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(libdir)" ; fi $(INSTALL_DATA) $(VPATH)/$(libname)lib.h "$(DESTDIR)$(includedir)/$(libname)lib.h" - if [ -n "$(progname_static)" ] ; then \ + if [ -n "$(libname_static)" ] ; then \ $(INSTALL_DATA) ./lib$(libname).a "$(DESTDIR)$(libdir)/lib$(libname).a" ; \ fi - if [ -n "$(progname_shared)" ] ; then \ + if [ -n "$(libname_shared)" ] ; then \ $(INSTALL_PROGRAM) ./lib$(libname).so.$(pkgversion) "$(DESTDIR)$(libdir)/lib$(libname).so.$(pkgversion)" ; \ if [ -e "$(DESTDIR)$(libdir)/lib$(libname).so.$(soversion)" ] ; then \ run_ldconfig=no ; \ @@ -121,7 +126,7 @@ install-lib : all [ -x "$(LDCONFIG)" ] ; then "$(LDCONFIG)" -n "$(DESTDIR)$(libdir)" || true ; fi ; \ fi -install-lib-strip : all +install-lib-strip : lib $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-lib install-info : diff --git a/NEWS b/NEWS index 101b35a..94f6a9a 100644 --- a/NEWS +++ b/NEWS @@ -1,19 +1,11 @@ -Changes in version 1.14: +Changes in version 1.15: -In minilzip, file diagnostics have been reformatted as 'PROGRAM: FILE: MESSAGE'. +The targets 'lib' and 'bin' have been added to Makefile.in. 'lib' is the new +default and builds just the library. 'bin' builds both the library and +minilzip. -In minilzip, diagnostics caused by invalid arguments to command-line options -now show the argument and the name of the option. +minilzip is no longer built by default. -The option '-o, --output' of minilzip now preserves dates, permissions, and -ownership of the file, when (de)compressing exactly one file. +'install-bin' installs minilzip and its man page again. -It has been documented in the manual that it is the responsibility of the -program using lzlib to include before 'lzlib.h' some header that declares -the type 'uint8_t'. (Reported by Michal Górny). - -The variable MAKEINFO has been added to configure and Makefile.in. - -It has been documented in INSTALL that when choosing a C standard, the POSIX -features need to be enabled explicitly: - ./configure CFLAGS+='--std=c99 -D_XOPEN_SOURCE=500' +The use of the target 'bin' has been documented in INSTALL. diff --git a/README b/README index 7dc2950..2207fb5 100644 --- a/README +++ b/README @@ -83,7 +83,7 @@ Lzlib currently implements two variants of the LZMA algorithm: fast (used by option '-0' of minilzip) and normal (used by all other compression levels). The high compression of LZMA comes from combining two basic, well-proven -compression ideas: sliding dictionaries (LZ77) and markov models (the thing +compression ideas: sliding dictionaries (LZ77) and Markov models (the thing used by every compression algorithm that uses a range encoder or similar order-0 entropy coder as its last stage) with segregation of contexts according to what the bits are used for. diff --git a/configure b/configure index ec5c149..b24d769 100755 --- a/configure +++ b/configure @@ -6,14 +6,16 @@ # to copy, distribute, and modify it. pkgname=lzlib -pkgversion=1.14 +pkgversion=1.15-pre1 soversion=1 +libname=lz +libname_static=lib${libname}.a +libname_shared= progname=minilzip progname_static=${progname} progname_shared= progname_lzip=${progname} disable_ldconfig= -libname=lz srctrigger=doc/${pkgname}.texi # clear some things potentially inherited from environment. @@ -115,10 +117,13 @@ while [ $# != 0 ] ; do --mandir=*) mandir=${optarg} ;; --no-create) no_create=yes ;; --disable-static) + libname_static= + libname_shared=lib${libname}.so.${pkgversion} progname_static= progname_shared=${progname}_shared progname_lzip=${progname}_shared ;; --enable-shared) + libname_shared=lib${libname}.so.${pkgversion} progname_shared=${progname}_shared progname_lzip=${progname}_shared ;; --disable-ldconfig) disable_ldconfig=yes ;; @@ -216,12 +221,14 @@ cat > Makefile << EOF pkgname = ${pkgname} pkgversion = ${pkgversion} soversion = ${soversion} +libname = ${libname} +libname_static = ${libname_static} +libname_shared = ${libname_shared} progname = ${progname} progname_static = ${progname_static} progname_shared = ${progname_shared} progname_lzip = ${progname_lzip} disable_ldconfig = ${disable_ldconfig} -libname = ${libname} VPATH = ${srcdir} prefix = ${prefix} exec_prefix = ${exec_prefix} diff --git a/decoder.c b/decoder.c index 6544ec6..d1fbe54 100644 --- a/decoder.c +++ b/decoder.c @@ -40,7 +40,7 @@ static int LZd_decode_member( struct LZ_decoder * const d ) { struct Range_decoder * const rdec = d->rdec; State * const state = &d->state; - /* unsigned old_mpos = rdec->member_position; */ + unsigned old_mpos = rdec->member_position; if( d->member_finished ) return 0; if( !Rd_try_reload( rdec ) ) @@ -49,9 +49,9 @@ static int LZd_decode_member( struct LZ_decoder * const d ) while( !Rd_finished( rdec ) ) { - /* const unsigned mpos = rdec->member_position; + const unsigned mpos = rdec->member_position; if( mpos - old_mpos > rd_min_available_bytes ) return 5; - old_mpos = mpos; */ + old_mpos = mpos; if( !Rd_enough_available_bytes( rdec ) ) /* check unexpected EOF */ { if( !rdec->at_stream_end ) return 0; if( Cb_empty( &rdec->cb ) ) break; } /* decode until EOF */ @@ -116,9 +116,9 @@ static int LZd_decode_member( struct LZ_decoder * const d ) if( distance == 0xFFFFFFFFU ) /* marker found */ { Rd_normalize( rdec ); - /* const unsigned mpos = rdec->member_position; + const unsigned mpos = rdec->member_position; if( mpos - old_mpos > rd_min_available_bytes ) return 5; - old_mpos = mpos; */ + old_mpos = mpos; if( len == min_match_len ) /* End Of Stream marker */ { d->check_trailer_pending = true; diff --git a/doc/lzlib.info b/doc/lzlib.info index 979c477..314c98a 100644 --- a/doc/lzlib.info +++ b/doc/lzlib.info @@ -11,7 +11,7 @@ File: lzlib.info, Node: Top, Next: Introduction, Up: (dir) Lzlib Manual ************ -This manual is for Lzlib (version 1.14, 20 January 2024). +This manual is for Lzlib (version 1.15-pre1, 19 April 2024). * Menu: @@ -127,7 +127,7 @@ using the LZMA coding scheme. levels). The high compression of LZMA comes from combining two basic, well-proven -compression ideas: sliding dictionaries (LZ77) and markov models (the thing +compression ideas: sliding dictionaries (LZ77) and Markov models (the thing used by every compression algorithm that uses a range encoder or similar order-0 entropy coder as its last stage) with segregation of contexts according to what the bits are used for. @@ -647,7 +647,9 @@ File: lzlib.info, Node: Invoking minilzip, Next: Data format, Prev: Error mes ******************* Minilzip is a test program for the compression library lzlib, compatible -with lzip 1.4 or newer. +(interoperable) with lzip 1.4 or newer. Minilzip is not intended to be +installed because lzip has more features, but minilzip is well tested and +you can use it as your main compressor if so you wish. Lzip is a lossless data compressor with a user interface similar to the one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov @@ -1305,28 +1307,28 @@ Concept index  Tag Table: Node: Top215 -Node: Introduction1338 -Node: Library version6778 -Node: Buffering9329 -Node: Parameter limits10554 -Node: Compression functions11508 -Ref: member_size13301 -Ref: sync_flush15063 -Node: Decompression functions19751 -Node: Error codes27308 -Node: Error messages29598 -Node: Invoking minilzip30177 -Node: Data format40595 -Ref: coded-dict-size42041 -Node: Examples43446 -Node: Buffer compression44407 -Node: Buffer decompression45927 -Node: File compression47341 -Node: File decompression48324 -Node: File compression mm49328 -Node: Skipping data errors52357 -Node: Problems53662 -Node: Concept index54223 +Node: Introduction1341 +Node: Library version6781 +Node: Buffering9332 +Node: Parameter limits10557 +Node: Compression functions11511 +Ref: member_size13304 +Ref: sync_flush15066 +Node: Decompression functions19754 +Node: Error codes27311 +Node: Error messages29601 +Node: Invoking minilzip30180 +Node: Data format40774 +Ref: coded-dict-size42220 +Node: Examples43625 +Node: Buffer compression44586 +Node: Buffer decompression46106 +Node: File compression47520 +Node: File decompression48503 +Node: File compression mm49507 +Node: Skipping data errors52536 +Node: Problems53841 +Node: Concept index54402  End Tag Table diff --git a/doc/lzlib.texi b/doc/lzlib.texi index 75cb7ba..462c840 100644 --- a/doc/lzlib.texi +++ b/doc/lzlib.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 20 January 2024 -@set VERSION 1.14 +@set UPDATED 19 April 2024 +@set VERSION 1.15-pre1 @dircategory Compression @direntry @@ -158,7 +158,7 @@ Lzlib currently implements two variants of the LZMA algorithm: fast (used by option @option{-0} of minilzip) and normal (used by all other compression levels). The high compression of LZMA comes from combining two basic, well-proven -compression ideas: sliding dictionaries (LZ77) and markov models (the thing +compression ideas: sliding dictionaries (LZ77) and Markov models (the thing used by every compression algorithm that uses a range encoder or similar order-0 entropy coder as its last stage) with segregation of contexts according to what the bits are used for. @@ -735,7 +735,9 @@ The value of @var{lz_errno} normally comes from a call to @cindex options Minilzip is a test program for the compression library lzlib, compatible -with lzip 1.4 or newer. +(interoperable) with lzip 1.4 or newer. Minilzip is not intended to be +installed because lzip has more features, but minilzip is well tested and +you can use it as your main compressor if so you wish. @uref{http://www.nongnu.org/lzip/lzip.html,,Lzip} is a lossless data compressor with a user interface similar to the one diff --git a/doc/minilzip.1 b/doc/minilzip.1 index 3532520..22ad101 100644 --- a/doc/minilzip.1 +++ b/doc/minilzip.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. -.TH MINILZIP "1" "January 2024" "minilzip 1.14" "User Commands" +.TH MINILZIP "1" "April 2024" "minilzip 1.15-pre1" "User Commands" .SH NAME minilzip \- reduces the size of files .SH SYNOPSIS @@ -7,7 +7,7 @@ minilzip \- reduces the size of files [\fI\,options\/\fR] [\fI\,files\/\fR] .SH DESCRIPTION Minilzip is a test program for the compression library lzlib, compatible -with lzip 1.4 or newer. +(interoperable) with lzip 1.4 or newer. .PP Lzip is a lossless data compressor with a user interface similar to the one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel\-Ziv\-Markov @@ -116,12 +116,12 @@ Report bugs to lzip\-bug@nongnu.org Lzlib home page: http://www.nongnu.org/lzip/lzlib.html .SH COPYRIGHT Copyright \(co 2024 Antonio Diaz Diaz. -Using lzlib 1.14 -Using LZ_API_VERSION = 1014 License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. +Using lzlib 1.15\-pre1 +Using LZ_API_VERSION = 1015 .SH "SEE ALSO" The full documentation for .B minilzip diff --git a/encoder_base.c b/encoder_base.c index 047f372..d2ed53c 100644 --- a/encoder_base.c +++ b/encoder_base.c @@ -126,9 +126,8 @@ static void Mb_reset( struct Matchfinder_base * const mb ) /* End Of Stream marker => (dis == 0xFFFFFFFFU, len == min_match_len) */ static void LZeb_try_full_flush( struct LZ_encoder_base * const eb ) { - if( eb->member_finished || - Cb_free_bytes( &eb->renc.cb ) < max_marker_size + eb->renc.ff_count + Lt_size ) - return; + if( eb->member_finished || Cb_free_bytes( &eb->renc.cb ) < + max_marker_size + eb->renc.ff_count + Lt_size ) return; eb->member_finished = true; const int pos_state = Mb_data_position( &eb->mb ) & pos_state_mask; const State state = eb->state; @@ -171,9 +170,8 @@ static void LZeb_reset( struct LZ_encoder_base * const eb, const unsigned long long max_member_size = 0x0008000000000000ULL; /* 2 PiB */ int i; Mb_reset( &eb->mb ); - eb->member_size_limit = - min( max( min_member_size, member_size ), max_member_size ) - - Lt_size - max_marker_size; + eb->member_size_limit = min( max( min_member_size, member_size ), + max_member_size ) - Lt_size - max_marker_size; eb->crc = 0xFFFFFFFFU; Bm_array_init( eb->bm_literal[0], (1 << literal_context_bits) * 0x300 ); Bm_array_init( eb->bm_match[0], states * pos_states ); diff --git a/lzlib.h b/lzlib.h index b7357d2..7a52342 100644 --- a/lzlib.h +++ b/lzlib.h @@ -24,9 +24,9 @@ extern "C" { /* LZ_API_VERSION was first defined in lzlib 1.8 to 1. Since lzlib 1.12, LZ_API_VERSION is defined as (major * 1000 + minor). */ -#define LZ_API_VERSION 1014 +#define LZ_API_VERSION 1015 -static const char * const LZ_version_string = "1.14"; +static const char * const LZ_version_string = "1.15-pre1"; enum LZ_Errno { LZ_ok = 0, LZ_bad_argument, LZ_mem_error, LZ_sequence_error, LZ_header_error, LZ_unexpected_eof, diff --git a/minilzip.c b/minilzip.c index a0a6721..c0e542a 100644 --- a/minilzip.c +++ b/minilzip.c @@ -26,7 +26,7 @@ #include #include #include -#include /* SSIZE_MAX */ +#include /* CHAR_BIT, SSIZE_MAX */ #include #include #include /* SIZE_MAX */ @@ -117,7 +117,7 @@ static bool delete_output_on_interrupt = false; static void show_help( void ) { printf( "Minilzip is a test program for the compression library lzlib, compatible\n" - "with lzip 1.4 or newer.\n" + "(interoperable) with lzip 1.4 or newer.\n" "\nLzip is a lossless data compressor with a user interface similar to the one\n" "of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov\n" "chain-Algorithm' (LZMA) stream format to maximize interoperability. The\n" @@ -196,10 +196,10 @@ static void show_version( void ) { printf( "%s %s\n", program_name, PROGVERSION ); printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year ); - show_lzlib_version(); printf( "License GPLv2+: GNU GPL version 2 or later \n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" ); + show_lzlib_version(); } @@ -294,6 +294,9 @@ static void Pp_init( struct Pretty_print * const pp, if( pp->longest_name == 0 ) pp->longest_name = stdin_name_len; } +void Pp_free( struct Pretty_print * const pp ) + { if( pp->padded_name ) { free( pp->padded_name ); pp->padded_name = 0; } } + static void Pp_set_name( struct Pretty_print * const pp, const char * const filename ) { @@ -1286,6 +1289,7 @@ int main( const int argc, const char * const argv[] ) program_name, failed_tests, ( failed_tests == 1 ) ? "file" : "files" ); free( output_filename ); + Pp_free( &pp ); free( filenames ); ap_free( &parser ); return retval; -- cgit v1.2.3