summaryrefslogtreecommitdiffstats
path: root/encoder_base.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-06-01 14:10:15 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-06-01 14:10:32 +0000
commitfca77b8fe5d1873634032206272a4ecf67434e4c (patch)
tree0f29e18c7457ef87a740354fd691750ecf489ea2 /encoder_base.c
parentReleasing debian version 1.7-2. (diff)
downloadlzlib-fca77b8fe5d1873634032206272a4ecf67434e4c.tar.xz
lzlib-fca77b8fe5d1873634032206272a4ecf67434e4c.zip
Merging upstream version 1.8.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'encoder_base.c')
-rw-r--r--encoder_base.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/encoder_base.c b/encoder_base.c
index b62ab98..ee7e0bb 100644
--- a/encoder_base.c
+++ b/encoder_base.c
@@ -1,5 +1,5 @@
/* Lzlib - Compression library for the lzip format
- Copyright (C) 2009-2015 Antonio Diaz Diaz.
+ Copyright (C) 2009-2016 Antonio Diaz Diaz.
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -91,7 +91,7 @@ static bool Mb_init( struct Matchfinder_base * const mb,
}
-static void Mb_adjust_distionary_size( struct Matchfinder_base * const mb )
+static void Mb_adjust_dictionary_size( struct Matchfinder_base * const mb )
{
if( mb->stream_pos < mb->dictionary_size )
{
@@ -133,7 +133,7 @@ static bool LZeb_full_flush( struct LZ_encoder_base * const eb )
const State state = eb->state;
File_trailer trailer;
if( eb->member_finished ||
- Cb_free_bytes( &eb->renc.cb ) < max_marker_size + Ft_size )
+ Cb_free_bytes( &eb->renc.cb ) < max_marker_size + eb->renc.ff_count + Ft_size )
return false;
Re_encode_bit( &eb->renc, &eb->bm_match[state][pos_state], 1 );
Re_encode_bit( &eb->renc, &eb->bm_rep[state], 0 );
@@ -154,7 +154,8 @@ static bool LZeb_sync_flush( struct LZ_encoder_base * const eb )
int i;
const int pos_state = Mb_data_position( &eb->mb ) & pos_state_mask;
const State state = eb->state;
- if( eb->member_finished || Cb_free_bytes( &eb->renc.cb ) < 2 * max_marker_size )
+ if( eb->member_finished ||
+ Cb_free_bytes( &eb->renc.cb ) < (2 * max_marker_size) + eb->renc.ff_count )
return false;
for( i = 0; i < 2; ++i ) /* 2 consecutive markers guarantee decoding */
{