summaryrefslogtreecommitdiffstats
path: root/encoder_base.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-01-08 17:20:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-01-08 17:20:09 +0000
commit60c137851b77ab48cc741c4722a8a3178609fa47 (patch)
treef08557f4a92ed5f2b8a9871859deabae4a24e64a /encoder_base.c
parentReleasing debian version 1.10-3. (diff)
downloadclzip-60c137851b77ab48cc741c4722a8a3178609fa47.tar.xz
clzip-60c137851b77ab48cc741c4722a8a3178609fa47.zip
Merging upstream version 1.11.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'encoder_base.c')
-rw-r--r--encoder_base.c17
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 );
}