diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-01-08 17:20:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-01-08 17:20:05 +0000 |
commit | 8c5c614b4137a9c6d31d15dab679a9a83260ba4c (patch) | |
tree | 95c123a85cf741387920efd8c885ffb7539a7c2a /encoder_base.c | |
parent | Adding upstream version 1.10. (diff) | |
download | clzip-8c5c614b4137a9c6d31d15dab679a9a83260ba4c.tar.xz clzip-8c5c614b4137a9c6d31d15dab679a9a83260ba4c.zip |
Adding upstream version 1.11.upstream/1.11
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | encoder_base.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/encoder_base.c b/encoder_base.c index 019a162..41c7806 100644 --- a/encoder_base.c +++ b/encoder_base.c @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2018 Antonio Diaz Diaz. + Copyright (C) 2010-2019 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,8 @@ void Mb_normalize_pos( struct Matchfinder_base * const mb ) if( !mb->at_stream_end ) { int i; - const int offset = mb->pos - mb->before_size - mb->dictionary_size; + /* offset is int32_t for the min below */ + const int32_t offset = mb->pos - mb->before_size - mb->dictionary_size; const int size = mb->stream_pos - offset; memmove( mb->buffer, mb->buffer + offset, size ); mb->partial_data_pos += offset; @@ -110,7 +111,7 @@ bool Mb_init( struct Matchfinder_base * const mb, const int before_size, size = 1 << max( 16, real_bits( mb->dictionary_size - 1 ) - 2 ); if( mb->dictionary_size > 1 << 26 ) /* 64 MiB */ size >>= 1; - mb->key4_mask = size - 1; + mb->key4_mask = size - 1; /* increases with dictionary size */ size += num_prev_positions23; mb->num_prev_positions = size; @@ -171,15 +172,15 @@ void LZeb_full_flush( struct LZ_encoder_base * const eb, const State state ) { int i; const int pos_state = Mb_data_position( &eb->mb ) & pos_state_mask; - File_trailer trailer; + Lzip_trailer trailer; Re_encode_bit( &eb->renc, &eb->bm_match[state][pos_state], 1 ); Re_encode_bit( &eb->renc, &eb->bm_rep[state], 0 ); LZeb_encode_pair( eb, 0xFFFFFFFFU, min_match_len, pos_state ); Re_flush( &eb->renc ); - Ft_set_data_crc( trailer, LZeb_crc( eb ) ); - Ft_set_data_size( trailer, Mb_data_position( &eb->mb ) ); - Ft_set_member_size( trailer, Re_member_position( &eb->renc ) + Ft_size ); - for( i = 0; i < Ft_size; ++i ) + Lt_set_data_crc( trailer, LZeb_crc( eb ) ); + Lt_set_data_size( trailer, Mb_data_position( &eb->mb ) ); + Lt_set_member_size( trailer, Re_member_position( &eb->renc ) + Lt_size ); + for( i = 0; i < Lt_size; ++i ) Re_put_byte( &eb->renc, trailer[i] ); Re_flush_data( &eb->renc ); } |