summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.in3
-rw-r--r--carg_parser.c6
-rwxr-xr-xconfigure2
-rw-r--r--decoder.c22
-rw-r--r--decoder.h4
-rw-r--r--doc/lunzip.12
-rw-r--r--lzip.h9
-rw-r--r--main.c3
9 files changed, 26 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 900ecf1..eac5edd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
-2013-06-27 Antonio Diaz Diaz <antonio@gnu.org>
+2013-09-17 Antonio Diaz Diaz <antonio@gnu.org>
- * Version 1.4-rc1 released.
+ * Version 1.4 released.
* main.c (show_header): Do not show header version.
* Minor fixes.
diff --git a/Makefile.in b/Makefile.in
index 0e9b9ae..307943b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -43,8 +43,7 @@ $(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texinfo
man : $(VPATH)/doc/$(progname).1
$(VPATH)/doc/$(progname).1 : $(progname)
- help2man -n 'decompressor for lzip files' \
- -o $@ --no-info ./$(progname)
+ help2man -n 'decompressor for lzip files' -o $@ --no-info ./$(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 21b385d..2ad9981 100755
--- a/configure
+++ b/configure
@@ -6,7 +6,7 @@
# to copy, distribute and modify it.
pkgname=lunzip
-pkgversion=1.4-rc1
+pkgversion=1.4
progname=lunzip
srctrigger=doc/${progname}.1
diff --git a/decoder.c b/decoder.c
index acaa693..c079504 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,15 +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] ) == 0 ) /* 3rd bit */
- {
- if( Rd_decode_bit( rdec, &decoder->bm_len[state][pos_state] ) == 0 ) /* 4th bit */
- { state = St_set_short_rep( state );
- LZd_put_byte( decoder, LZd_get_byte( decoder, rep0 ) ); continue; }
- }
- else
+ 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 */
@@ -247,6 +241,12 @@ int LZd_decode_member( struct LZ_decoder * const decoder,
rep1 = rep0;
rep0 = distance;
}
+ else
+ {
+ if( Rd_decode_bit( rdec, &decoder->bm_len[state][pos_state] ) == 0 ) /* 4th bit */
+ { state = St_set_short_rep( state );
+ LZd_put_byte( decoder, LZd_get_byte( decoder, rep0 ) ); continue; }
+ }
state = St_set_rep( state );
len = min_match_len + Rd_decode_len( rdec, &decoder->rep_len_model, pos_state );
}
@@ -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 45d8aa9..063511b 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<<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_align[dis_align_size];
@@ -321,7 +321,7 @@ static inline bool LZd_init( struct LZ_decoder * const decoder,
Bm_array_init( decoder->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/lunzip.1 b/doc/lunzip.1
index ab4c9e0..0d10c1d 100644
--- a/doc/lunzip.1
+++ b/doc/lunzip.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
-.TH LUNZIP "1" "July 2013" "Lunzip 1.4-rc1" "User Commands"
+.TH LUNZIP "1" "September 2013" "Lunzip 1.4" "User Commands"
.SH NAME
Lunzip \- decompressor for lzip files
.SH SYNOPSIS
diff --git a/lzip.h b/lzip.h
index ff1ea4a..a8640bf 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 ) ); }
diff --git a/main.c b/main.c
index 6dcfcaf..1bf2fab 100644
--- a/main.c
+++ b/main.c
@@ -154,8 +154,7 @@ static int extension_index( const char * const name )
static int open_instream( const char * const name, struct stat * const in_statsp,
const bool testing, const bool to_stdout )
{
- int infd = -1;
- infd = open( name, O_RDONLY | o_binary );
+ int infd = open( name, O_RDONLY | o_binary );
if( infd < 0 )
{
if( verbosity >= 0 )