1
0
Fork 0

Merging upstream version 1.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 20:05:47 +01:00
parent 14c6cd47d9
commit ef2fe9ecc0
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
18 changed files with 733 additions and 665 deletions

27
clzip.h
View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
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
@ -108,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;
@ -122,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 );
@ -160,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;
}
@ -177,15 +177,10 @@ typedef uint8_t File_header[6]; /* 0-3 magic bytes */
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]; }