summaryrefslogtreecommitdiffstats
path: root/encoder_base.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-13 07:03:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-13 07:03:42 +0000
commit07a9feadab39c03c44ce074320b90f75e232c511 (patch)
treefe7fb3cc84a73bc6cbda192ced4414ff80c3322f /encoder_base.h
parentAdding upstream version 1.9. (diff)
downloadlzlib-07a9feadab39c03c44ce074320b90f75e232c511.tar.xz
lzlib-07a9feadab39c03c44ce074320b90f75e232c511.zip
Adding upstream version 1.10.upstream/1.10
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'encoder_base.h')
-rw-r--r--encoder_base.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/encoder_base.h b/encoder_base.h
index c4cfcca..ddba7e6 100644
--- a/encoder_base.h
+++ b/encoder_base.h
@@ -1,5 +1,5 @@
/* Lzlib - Compression library for the lzip format
- Copyright (C) 2009-2017 Antonio Diaz Diaz.
+ Copyright (C) 2009-2018 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided
@@ -238,16 +238,16 @@ struct Matchfinder_base
int num_prev_positions23;
int num_prev_positions; /* size of prev_positions */
int pos_array_size;
+ int saved_dictionary_size; /* dictionary_size restored by Mb_reset */
bool at_stream_end; /* stream_pos shows real end of file */
bool flushing;
};
static bool Mb_normalize_pos( struct Matchfinder_base * const mb );
-static bool Mb_init( struct Matchfinder_base * const mb,
- const int before, const int dict_size,
- const int after_size, const int dict_factor,
- const int num_prev_positions23,
+static bool Mb_init( struct Matchfinder_base * const mb, const int before_size,
+ const int dict_size, const int after_size,
+ const int dict_factor, const int num_prev_positions23,
const int pos_array_factor );
static inline void Mb_free( struct Matchfinder_base * const mb )
@@ -339,7 +339,8 @@ static inline void Re_shift_low( struct Range_encoder * const renc )
renc->low = ( renc->low & 0x00FFFFFFU ) << 8;
}
-static inline void Re_reset( struct Range_encoder * const renc )
+static inline void Re_reset( struct Range_encoder * const renc,
+ const unsigned dictionary_size )
{
int i;
Cb_reset( &renc->cb );
@@ -348,6 +349,7 @@ static inline void Re_reset( struct Range_encoder * const renc )
renc->range = 0xFFFFFFFFU;
renc->ff_count = 0;
renc->cache = 0;
+ Fh_set_dictionary_size( renc->header, dictionary_size );
for( i = 0; i < Fh_size; ++i )
Cb_put_byte( &renc->cb, renc->header[i] );
}
@@ -359,8 +361,7 @@ static inline bool Re_init( struct Range_encoder * const renc,
if( !Cb_init( &renc->cb, 65536 + min_free_bytes ) ) return false;
renc->min_free_bytes = min_free_bytes;
Fh_set_magic( renc->header );
- Fh_set_dictionary_size( renc->header, dictionary_size );
- Re_reset( renc );
+ Re_reset( renc, dictionary_size );
return true;
}
@@ -544,14 +545,14 @@ static void LZeb_reset( struct LZ_encoder_base * const eb,
const unsigned long long member_size );
static inline bool LZeb_init( struct LZ_encoder_base * const eb,
- const int before, const int dict_size,
+ const int before_size, const int dict_size,
const int after_size, const int dict_factor,
const int num_prev_positions23,
const int pos_array_factor,
const unsigned min_free_bytes,
const unsigned long long member_size )
{
- if( !Mb_init( &eb->mb, before, dict_size, after_size, dict_factor,
+ if( !Mb_init( &eb->mb, before_size, dict_size, after_size, dict_factor,
num_prev_positions23, pos_array_factor ) ) return false;
if( !Re_init( &eb->renc, eb->mb.dictionary_size, min_free_bytes ) )
return false;