summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-02 07:58:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-02 07:58:50 +0000
commitdbb626a17cceeca84102d7d7eebf7218d4471375 (patch)
treebf76e46a6dba453e188a4be02c053d6b0a462b99 /decoder.h
parentReleasing debian version 1.13-6. (diff)
downloadclzip-dbb626a17cceeca84102d7d7eebf7218d4471375.tar.xz
clzip-dbb626a17cceeca84102d7d7eebf7218d4471375.zip
Merging upstream version 1.14~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'decoder.h')
-rw-r--r--decoder.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/decoder.h b/decoder.h
index 2823d46..3b52eee 100644
--- a/decoder.h
+++ b/decoder.h
@@ -1,5 +1,5 @@
/* Clzip - LZMA lossless data compressor
- Copyright (C) 2010-2022 Antonio Diaz Diaz.
+ Copyright (C) 2010-2023 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
@@ -79,13 +79,16 @@ static inline int Rd_read_data( struct Range_decoder * const rdec,
return sz;
}
-static inline void Rd_load( struct Range_decoder * const rdec )
+static inline bool Rd_load( struct Range_decoder * const rdec,
+ const bool ignore_marking )
{
int i;
rdec->code = 0;
- for( i = 0; i < 5; ++i ) rdec->code = (rdec->code << 8) | Rd_get_byte( rdec );
rdec->range = 0xFFFFFFFFU;
- rdec->code &= rdec->range; /* make sure that first byte is discarded */
+ /* check and discard first byte of the LZMA stream */
+ if( Rd_get_byte( rdec ) != 0 && !ignore_marking ) return false;
+ for( i = 0; i < 4; ++i ) rdec->code = (rdec->code << 8) | Rd_get_byte( rdec );
+ return true;
}
static inline void Rd_normalize( struct Range_decoder * const rdec )
@@ -360,4 +363,5 @@ LZd_data_position( const struct LZ_decoder * const d )
{ return d->partial_data_pos + d->pos; }
int LZd_decode_member( struct LZ_decoder * const d,
+ const struct Cl_options * const cl_opts,
struct Pretty_print * const pp );