summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:06:49 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:06:49 +0000
commit38911c04adbe853acb3d534e1853a8a0ffce88bd (patch)
tree77e6c7cdc56b911b917f20219c93423641d959a3 /lzip.h
parentAdding debian version 1.7~pre1-1. (diff)
downloadlzlib-38911c04adbe853acb3d534e1853a8a0ffce88bd.tar.xz
lzlib-38911c04adbe853acb3d534e1853a8a0ffce88bd.zip
Merging upstream version 1.7~rc1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lzip.h')
-rw-r--r--lzip.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/lzip.h b/lzip.h
index 1edcaa9..9ef5913 100644
--- a/lzip.h
+++ b/lzip.h
@@ -226,10 +226,10 @@ static inline bool Fh_set_dictionary_size( File_header data, const unsigned sz )
if( sz > min_dictionary_size )
{
const unsigned base_size = 1 << data[5];
- const unsigned wedge = base_size / 16;
+ const unsigned fraction = base_size / 16;
int i;
for( i = 7; i >= 1; --i )
- if( base_size - ( i * wedge ) >= sz )
+ if( base_size - ( i * fraction ) >= sz )
{ data[5] |= ( i << 5 ); break; }
}
return true;
@@ -239,9 +239,13 @@ static inline bool Fh_set_dictionary_size( File_header data, const unsigned sz )
static inline bool Fh_verify( const File_header data )
{
- return ( Fh_verify_magic( data ) && Fh_verify_version( data ) &&
- Fh_get_dictionary_size( data ) >= min_dictionary_size &&
- Fh_get_dictionary_size( data ) <= max_dictionary_size );
+ if( Fh_verify_magic( data ) && Fh_verify_version( data ) )
+ {
+ const unsigned dictionary_size = Fh_get_dictionary_size( data );
+ return ( dictionary_size >= min_dictionary_size &&
+ dictionary_size <= max_dictionary_size );
+ }
+ return false;
}