From 90cd6e9b8b41a5418b87ab3f4832fdcc3cf2c3f5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 6 Nov 2015 12:40:25 +0100 Subject: Merging upstream version 1.5. Signed-off-by: Daniel Baumann --- ChangeLog | 16 +++------------- Makefile.in | 3 +-- carg_parser.c | 6 +++--- configure | 2 +- decoder.c | 10 +++++----- decoder.h | 4 ++-- doc/clzip.1 | 2 +- doc/clzip.info | 14 +++++++------- doc/clzip.texinfo | 8 ++++---- encoder.c | 16 ++++++++-------- encoder.h | 16 ++++++++-------- lzip.h | 9 ++++----- 12 files changed, 47 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3755bc2..9ac77bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,8 @@ -2013-08-01 Antonio Diaz Diaz +2013-09-17 Antonio Diaz Diaz - * Version 1.5-rc1 released. - * main.c (show_header): Do not show header version. - * Minor fixes. - -2013-07-17 Antonio Diaz Diaz - - * Version 1.5-pre2 released. + * Version 1.5 released. * Show progress of compression at verbosity level 2 (-vv). - -2013-05-13 Antonio Diaz Diaz - - * Version 1.5-pre1 released. - * main.c (show_header): Show header version if verbosity >= 4. + * main.c (show_header): Do not show header version. * Ignore option '-n, --threads' for compatibility with plzip. * configure: Options now accept a separate argument. diff --git a/Makefile.in b/Makefile.in index bc932b7..7976c19 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,8 +44,7 @@ $(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texinfo man : $(VPATH)/doc/$(progname).1 $(VPATH)/doc/$(progname).1 : $(progname) - help2man -n 'reduces the size of files' \ - -o $@ ./$(progname) + help2man -n 'reduces the size of files' -o $@ ./$(progname) Makefile : $(VPATH)/configure $(VPATH)/Makefile.in ./config.status diff --git a/carg_parser.c b/carg_parser.c index a86f76f..378b5e3 100644 --- a/carg_parser.c +++ b/carg_parser.c @@ -45,7 +45,7 @@ static char push_back_record( struct Arg_parser * const ap, const int code, const char * const argument ) { const int len = strlen( argument ); - struct ap_Record *p; + struct ap_Record * p; void * tmp = ap_resize_buffer( ap->data, ( ap->data_size + 1 ) * sizeof (struct ap_Record) ); if( !tmp ) return 0; @@ -222,12 +222,12 @@ char ap_init( struct Arg_parser * const ap, while( argind < argc ) { const unsigned char ch1 = argv[argind][0]; - const unsigned char ch2 = ( ch1 ? argv[argind][1] : 0 ); + const unsigned char ch2 = ch1 ? argv[argind][1] : 0; if( ch1 == '-' && ch2 ) /* we found an option */ { const char * const opt = argv[argind]; - const char * const arg = (argind + 1 < argc) ? argv[argind+1] : 0; + const char * const arg = ( argind + 1 < argc ) ? argv[argind+1] : 0; if( ch2 == '-' ) { if( !argv[argind][2] ) { ++argind; break; } /* we found "--" */ diff --git a/configure b/configure index dc3023b..4619a0e 100755 --- a/configure +++ b/configure @@ -6,7 +6,7 @@ # to copy, distribute and modify it. pkgname=clzip -pkgversion=1.5-rc1 +pkgversion=1.5 progname=clzip srctrigger=doc/${pkgname}.texinfo diff --git a/decoder.c b/decoder.c index 9c31677..15ede6c 100644 --- a/decoder.c +++ b/decoder.c @@ -104,9 +104,9 @@ bool Rd_read_block( struct Range_decoder * const rdec ) void LZd_flush_data( struct LZ_decoder * const decoder ) { - const int size = decoder->pos - decoder->stream_pos; - if( size > 0 ) + if( decoder->pos > decoder->stream_pos ) { + const int size = decoder->pos - decoder->stream_pos; CRC32_update_buf( &decoder->crc, decoder->buffer + decoder->stream_pos, size ); if( decoder->outfd >= 0 && writeblock( decoder->outfd, decoder->buffer + decoder->stream_pos, size ) != size ) @@ -223,9 +223,9 @@ int LZd_decode_member( struct LZ_decoder * const decoder, else { 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; if( Rd_decode_bit( rdec, &decoder->bm_rep1[state] ) == 0 ) /* 4th bit */ @@ -255,7 +255,7 @@ int LZd_decode_member( struct LZ_decoder * const decoder, int dis_slot; const unsigned rep0_saved = rep0; 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 ) rep0 = dis_slot; else { diff --git a/decoder.h b/decoder.h index 280af82..af044d0 100644 --- a/decoder.h +++ b/decoder.h @@ -245,7 +245,7 @@ struct LZ_decoder Bit_model bm_rep1[states]; Bit_model bm_rep2[states]; Bit_model bm_len[states][pos_states]; - Bit_model bm_dis_slot[max_dis_states][1<bm_rep1, states ); Bm_array_init( decoder->bm_rep2, states ); Bm_array_init( decoder->bm_len[0], states * pos_states ); - Bm_array_init( decoder->bm_dis_slot[0], max_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_align, dis_align_size ); diff --git a/doc/clzip.1 b/doc/clzip.1 index 5c1bd8c..a365d55 100644 --- a/doc/clzip.1 +++ b/doc/clzip.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH CLZIP "1" "August 2013" "Clzip 1.5-rc1" "User Commands" +.TH CLZIP "1" "September 2013" "Clzip 1.5" "User Commands" .SH NAME Clzip \- reduces the size of files .SH SYNOPSIS diff --git a/doc/clzip.info b/doc/clzip.info index f7a9f4a..227a396 100644 --- a/doc/clzip.info +++ b/doc/clzip.info @@ -12,7 +12,7 @@ File: clzip.info, Node: Top, Next: Introduction, Up: (dir) Clzip Manual ************ -This manual is for Clzip (version 1.5-rc1, 1 August 2013). +This manual is for Clzip (version 1.5, 17 September 2013). * Menu: @@ -281,7 +281,7 @@ The format for running clzip is: `--verbose' Verbose mode. When compressing, show the compression ratio for each file - processed. A second -v shows the progress of compression. + processed. A second `-v' shows the progress of compression. When decompressing or testing, further -v's (up to 4) increase the verbosity level, showing status, compression ratio, dictionary size, and trailer contents (CRC, data size, member size). @@ -484,7 +484,7 @@ file with a member size of 32 MiB.  File: clzip.info, Node: Problems, Next: Concept index, Prev: Examples, Up: Top -6 Reporting Bugs +6 Reporting bugs **************** There are probably bugs in clzip. There are certainly errors and @@ -523,10 +523,10 @@ Node: Top212 Node: Introduction914 Node: Algorithm5091 Node: Invoking clzip7590 -Node: File format13187 -Node: Examples15692 -Node: Problems17660 -Node: Concept index18186 +Node: File format13189 +Node: Examples15694 +Node: Problems17662 +Node: Concept index18188  End Tag Table diff --git a/doc/clzip.texinfo b/doc/clzip.texinfo index ac684be..95bfe68 100644 --- a/doc/clzip.texinfo +++ b/doc/clzip.texinfo @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 1 August 2013 -@set VERSION 1.5-rc1 +@set UPDATED 17 September 2013 +@set VERSION 1.5 @dircategory Data Compression @direntry @@ -301,7 +301,7 @@ Use it together with @samp{-v} to see information about the file. @itemx --verbose Verbose mode.@* When compressing, show the compression ratio for each file processed. A -second -v shows the progress of compression.@* +second @samp{-v} shows the progress of compression.@* When decompressing or testing, further -v's (up to 4) increase the verbosity level, showing status, compression ratio, dictionary size, and trailer contents (CRC, data size, member size). @@ -541,7 +541,7 @@ clzip -b 32MiB -S 650MB big_db @node Problems -@chapter Reporting Bugs +@chapter Reporting bugs @cindex bugs @cindex getting help diff --git a/encoder.c b/encoder.c index 66358cb..088a9e5 100644 --- a/encoder.c +++ b/encoder.c @@ -317,7 +317,7 @@ static void LZe_fill_align_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 ) { const int dis_slot = dis_slots[dis]; @@ -326,15 +326,15 @@ static void LZe_fill_distance_prices( struct LZ_encoder * const encoder ) const int price = price_symbol_reversed( encoder->bm_dis + base - dis_slot - 1, dis - base, direct_bits ); - for( dis_state = 0; dis_state < max_dis_states; ++dis_state ) - encoder->dis_prices[dis_state][dis] = price; + for( len_state = 0; len_state < len_states; ++len_state ) + encoder->dis_prices[len_state][dis] = price; } - for( dis_state = 0; dis_state < max_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 dp = encoder->dis_prices[dis_state]; - const Bit_model * const bmds = encoder->bm_dis_slot[dis_state]; + int * const dsp = encoder->dis_slot_prices[len_state]; + int * const dp = encoder->dis_prices[len_state]; + const Bit_model * const bmds = encoder->bm_dis_slot[len_state]; int slot = 0; for( ; slot < end_dis_model && slot < encoder->num_dis_slots; ++slot ) dsp[slot] = price_symbol( bmds, slot, dis_slot_bits ); @@ -365,7 +365,7 @@ bool LZe_init( struct LZ_encoder * const encoder, Bm_array_init( encoder->bm_rep1, states ); Bm_array_init( encoder->bm_rep2, states ); Bm_array_init( encoder->bm_len[0], states * pos_states ); - Bm_array_init( encoder->bm_dis_slot[0], max_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_align, dis_align_size ); diff --git a/encoder.h b/encoder.h index 365d602..a1d9478 100644 --- a/encoder.h +++ b/encoder.h @@ -488,7 +488,7 @@ struct LZ_encoder Bit_model bm_rep1[states]; Bit_model bm_rep2[states]; Bit_model bm_len[states][pos_states]; - Bit_model bm_dis_slot[max_dis_states][1<dis_prices[dis_state][dis]; + return encoder->dis_prices[len_state][dis]; 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)]; } @@ -582,7 +582,7 @@ static inline int LZe_price_pair( const struct LZ_encoder * const encoder, const int 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, @@ -613,7 +613,7 @@ static inline void LZe_encode_pair( struct LZ_encoder * const encoder, { const int dis_slot = get_slot( dis ); 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 ); if( dis_slot >= start_dis_model ) diff --git a/lzip.h b/lzip.h index 6f11a75..ae4bbf4 100644 --- a/lzip.h +++ b/lzip.h @@ -54,6 +54,7 @@ enum { pos_states = 1 << pos_state_bits, pos_state_mask = pos_states - 1, + len_states = 4, dis_slot_bits = 6, start_dis_model = 4, end_dis_model = 14, @@ -71,12 +72,10 @@ enum { min_match_len = 2, /* must be 2 */ max_match_len = min_match_len + max_len_symbols - 1, /* 273 */ - min_match_len_limit = 5, + min_match_len_limit = 5 }; - max_dis_states = 4 }; - -static inline int get_dis_state( const int len ) - { return min( len - min_match_len, max_dis_states - 1 ); } +static inline int get_len_state( const int len ) + { return min( len - min_match_len, len_states - 1 ); } static inline int get_lit_state( const uint8_t prev_byte ) { return ( prev_byte >> ( 8 - literal_context_bits ) ); } -- cgit v1.2.3