summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-13 07:01:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-13 07:01:29 +0000
commitf2780f2544d654fa46ad91189c1636bd6f64605d (patch)
treef2762bc24207fc925eec55398803ee9981fb433c /decoder.h
parentReleasing debian version 1.19-4. (diff)
downloadlziprecover-f2780f2544d654fa46ad91189c1636bd6f64605d.tar.xz
lziprecover-f2780f2544d654fa46ad91189c1636bd6f64605d.zip
Merging upstream version 1.20.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'decoder.h')
-rw-r--r--decoder.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/decoder.h b/decoder.h
index cba634b..049328d 100644
--- a/decoder.h
+++ b/decoder.h
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for the lzip format
- Copyright (C) 2009-2017 Antonio Diaz Diaz.
+ Copyright (C) 2009-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
@@ -227,11 +227,7 @@ class LZ_decoder
bool verify_trailer( const Pretty_print & pp ) const;
uint8_t peek_prev() const
- {
- if( pos > 0 ) return buffer[pos-1];
- if( pos_wrapped ) return buffer[dictionary_size-1];
- return 0; // prev_byte of first byte
- }
+ { return buffer[((pos > 0) ? pos : dictionary_size)-1]; }
uint8_t peek( const unsigned distance ) const
{
@@ -296,7 +292,8 @@ public:
crc_( 0xFFFFFFFFU ),
outfd( ofd ),
pos_wrapped( false )
- {}
+ // prev_byte of first byte; also for peek( 0 ) on corrupt file
+ { buffer[dictionary_size-1] = 0; }
~LZ_decoder() { delete[] buffer; }