summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-05-25 16:01:59 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-05-25 16:02:34 +0000
commit33cffc3f05f0598c91c8b6b7909eb30bfa28ac0c (patch)
treec82234dd43652d896f1d1d708d84540cdde01623 /lzip.h
parentAdding debian version 1.8~pre1-1. (diff)
downloadlunzip-33cffc3f05f0598c91c8b6b7909eb30bfa28ac0c.tar.xz
lunzip-33cffc3f05f0598c91c8b6b7909eb30bfa28ac0c.zip
Merging upstream version 1.8.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--lzip.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/lzip.h b/lzip.h
index 8f4120a..2970cb3 100644
--- a/lzip.h
+++ b/lzip.h
@@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format
- Copyright (C) 2010-2015 Antonio Diaz Diaz.
+ Copyright (C) 2010-2016 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
@@ -50,6 +50,7 @@ enum {
max_dictionary_bits = 29,
max_dictionary_size = 1 << max_dictionary_bits,
literal_context_bits = 3,
+ literal_pos_state_bits = 0, /* not used */
pos_state_bits = 2,
pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1,
@@ -90,8 +91,8 @@ typedef int Bit_model;
static inline void Bm_init( Bit_model * const probability )
{ *probability = bit_model_total / 2; }
-static inline void Bm_array_init( Bit_model * const p, const int size )
- { int i = 0; while( i < size ) p[i++] = bit_model_total / 2; }
+static inline void Bm_array_init( Bit_model bm[], const int size )
+ { int i; for( i = 0; i < size; ++i ) Bm_init( &bm[i] ); }
struct Len_model
{
@@ -121,7 +122,8 @@ struct Pretty_print
};
static inline void Pp_init( struct Pretty_print * const pp,
- const char * const filenames[], const int num_filenames )
+ const char * const filenames[],
+ const int num_filenames, const int verbosity )
{
unsigned stdin_name_len;
int i;
@@ -131,6 +133,7 @@ static inline void Pp_init( struct Pretty_print * const pp,
pp->first_post = false;
stdin_name_len = strlen( pp->stdin_name );
+ if( verbosity <= 0 ) return;
for( i = 0; i < num_filenames; ++i )
{
const char * const s = filenames[i];
@@ -191,6 +194,14 @@ enum { Fh_size = 6 };
static inline bool Fh_verify_magic( const File_header data )
{ return ( memcmp( data, magic_string, 4 ) == 0 ); }
+/* detect truncated header */
+static inline bool Fh_verify_prefix( const File_header data, const int size )
+ {
+ int i; for( i = 0; i < size && i < 4; ++i )
+ if( data[i] != magic_string[i] ) return false;
+ return ( size > 0 );
+ }
+
static inline uint8_t Fh_version( const File_header data )
{ return data[4]; }