summaryrefslogtreecommitdiffstats
path: root/lunzip.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 13:15:12 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 13:15:12 +0000
commitaf0ac2217d1005ad32420a31414182b14ed54b4f (patch)
tree6387958c45b0614c2d02c0cfdecc1222771403aa /lunzip.h
parentAdding upstream version 1.0. (diff)
downloadlunzip-af0ac2217d1005ad32420a31414182b14ed54b4f.tar.xz
lunzip-af0ac2217d1005ad32420a31414182b14ed54b4f.zip
Adding upstream version 1.1.upstream/1.1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lunzip.h')
-rw-r--r--lunzip.h32
1 files changed, 13 insertions, 19 deletions
diff --git a/lunzip.h b/lunzip.h
index a2209b4..e9a9ea2 100644
--- a/lunzip.h
+++ b/lunzip.h
@@ -1,5 +1,5 @@
/* Lunzip - Decompressor for lzip files
- Copyright (C) 2010, 2011 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011, 2012 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
@@ -56,6 +56,7 @@ static inline void St_set_short_rep( State * const st )
*st = next[*st];
}
+
enum {
min_dictionary_bits = 12,
min_dictionary_size = 1 << min_dictionary_bits,
@@ -107,7 +108,7 @@ static inline void Bm_init( Bit_model * const probability )
struct Pretty_print
{
- const char * name_;
+ const char * name;
const char * stdin_name;
int longest_name;
int verbosity;
@@ -121,13 +122,13 @@ static inline void Pp_set_name( struct Pretty_print * const pp,
const char * const filename )
{
if( filename && filename[0] && strcmp( filename, "-" ) )
- pp->name_ = filename;
- else pp->name_ = pp->stdin_name;
+ pp->name = filename;
+ else pp->name = pp->stdin_name;
pp->first_post = true;
}
static inline void Pp_reset( struct Pretty_print * const pp )
- { if( pp->name_ && pp->name_[0] ) pp->first_post = true; }
+ { if( pp->name && pp->name[0] ) pp->first_post = true; }
void Pp_show_msg( struct Pretty_print * const pp, const char * const msg );
@@ -159,11 +160,11 @@ static inline void CRC32_update_buf( uint32_t * crc, const uint8_t * const buffe
}
-static inline int real_bits( const int value )
+static inline int real_bits( const unsigned int value )
{
- int bits = 0, i, mask;
- for( i = 1, mask = 1; mask > 0; ++i, mask <<= 1 )
- if( value & mask ) bits = i;
+ int bits = 0, i = 1;
+ unsigned int mask = 1;
+ for( ; mask > 0; ++i, mask <<= 1 ) if( value & mask ) bits = i;
return bits;
}
@@ -172,19 +173,14 @@ static const uint8_t magic_string[4] = { 'L', 'Z', 'I', 'P' };
typedef uint8_t File_header[6]; /* 0-3 magic bytes */
/* 4 version */
- /* 5 coded_dict_size; */
+ /* 5 coded_dict_size */
enum { Fh_size = 6 };
static inline void Fh_set_magic( File_header data )
- {
- memcpy( data, magic_string, 4 );
- data[4] = 1;
- }
+ { memcpy( data, magic_string, 4 ); data[4] = 1; }
static inline bool Fh_verify_magic( const File_header data )
- {
- return ( memcmp( data, magic_string, 4 ) == 0 );
- }
+ { return ( memcmp( data, magic_string, 4 ) == 0 ); }
static inline uint8_t Fh_version( const File_header data )
{ return data[4]; }
@@ -276,5 +272,3 @@ static inline void Ft_set_member_size( File_trailer data, long long sz )
/* defined in main.c */
void cleanup_and_fail( const int retval );
void show_error( const char * const msg, const int errcode, const bool help );
-int readblock( const int fd, uint8_t * const buf, const int size );
-int writeblock( const int fd, const uint8_t * const buf, const int size );