diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-02-13 06:55:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-02-13 06:56:31 +0000 |
commit | c47aa7dfb21de77e630d5738d73a0f38204bfe0b (patch) | |
tree | 73bf32ded6d79f9d4876203cb922233e44f757c3 /decoder.h | |
parent | Releasing debian version 1.9-4. (diff) | |
download | clzip-c47aa7dfb21de77e630d5738d73a0f38204bfe0b.tar.xz clzip-c47aa7dfb21de77e630d5738d73a0f38204bfe0b.zip |
Merging upstream version 1.10.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | decoder.h | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2017 Antonio Diaz Diaz. + Copyright (C) 2010-2018 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 @@ -239,11 +239,7 @@ struct LZ_decoder void LZd_flush_data( struct LZ_decoder * const d ); static inline uint8_t LZd_peek_prev( const struct LZ_decoder * const d ) - { - if( d->pos > 0 ) return d->buffer[d->pos-1]; - if( d->pos_wrapped ) return d->buffer[d->dictionary_size-1]; - return 0; /* prev_byte of first byte */ - } + { return d->buffer[((d->pos > 0) ? d->pos : d->dictionary_size)-1]; } static inline uint8_t LZd_peek( const struct LZ_decoder * const d, const unsigned distance ) @@ -305,6 +301,8 @@ static inline bool LZd_init( struct LZ_decoder * const d, d->crc = 0xFFFFFFFFU; d->outfd = ofd; d->pos_wrapped = false; + /* prev_byte of first byte; also for LZd_peek( 0 ) on corrupt file */ + d->buffer[d->dictionary_size-1] = 0; return true; } |