Merging upstream version 1.25~pre1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
8062cdcacd
commit
3e4c2fba01
60 changed files with 5261 additions and 1250 deletions
44
lzip.h
44
lzip.h
|
@ -98,9 +98,6 @@ struct Len_model
|
|||
};
|
||||
|
||||
|
||||
// defined in main.cc
|
||||
extern int verbosity;
|
||||
|
||||
class Pretty_print // requires global var 'int verbosity'
|
||||
{
|
||||
std::string name_;
|
||||
|
@ -154,13 +151,17 @@ class CRC32
|
|||
uint32_t data[256]; // Table of CRCs of all 8-bit messages.
|
||||
|
||||
public:
|
||||
CRC32()
|
||||
explicit CRC32( const bool castagnoli = false )
|
||||
{
|
||||
const unsigned cpol = 0x82F63B78U; // CRC32-C Castagnoli polynomial
|
||||
const unsigned ipol = 0xEDB88320U; // IEEE 802.3 Ethernet polynomial
|
||||
const unsigned poly = castagnoli ? cpol : ipol;
|
||||
|
||||
for( unsigned n = 0; n < 256; ++n )
|
||||
{
|
||||
unsigned c = n;
|
||||
for( int k = 0; k < 8; ++k )
|
||||
{ if( c & 1 ) c = 0xEDB88320U ^ ( c >> 1 ); else c >>= 1; }
|
||||
{ if( c & 1 ) c = poly ^ ( c >> 1 ); else c >>= 1; }
|
||||
data[n] = c;
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +180,15 @@ public:
|
|||
c = data[(c^buffer[i])&0xFF] ^ ( c >> 8 );
|
||||
crc = c;
|
||||
}
|
||||
|
||||
uint32_t compute_crc( const uint8_t * const buffer,
|
||||
const unsigned long size ) const
|
||||
{
|
||||
uint32_t crc = 0xFFFFFFFFU;
|
||||
for( unsigned long i = 0; i < size; ++i )
|
||||
crc = data[(crc^buffer[i])&0xFF] ^ ( crc >> 8 );
|
||||
return crc ^ 0xFFFFFFFFU;
|
||||
}
|
||||
};
|
||||
|
||||
extern const CRC32 crc32;
|
||||
|
@ -313,12 +323,12 @@ struct Cl_options // command-line options
|
|||
{
|
||||
bool ignore_empty;
|
||||
bool ignore_errors;
|
||||
bool ignore_marking;
|
||||
bool ignore_nonzero;
|
||||
bool ignore_trailing;
|
||||
bool loose_trailing;
|
||||
|
||||
Cl_options()
|
||||
: ignore_empty( true ), ignore_errors( false ), ignore_marking( true ),
|
||||
: ignore_empty( false ), ignore_errors( false ), ignore_nonzero( false ),
|
||||
ignore_trailing( true ), loose_trailing( false ) {}
|
||||
};
|
||||
|
||||
|
@ -333,6 +343,8 @@ class Block
|
|||
|
||||
public:
|
||||
Block( const long long p, const long long s ) : pos_( p ), size_( s ) {}
|
||||
Block & assign( const long long p, const long long s )
|
||||
{ pos_ = p; size_ = s; return *this; }
|
||||
|
||||
long long pos() const { return pos_; }
|
||||
long long size() const { return size_; }
|
||||
|
@ -354,6 +366,8 @@ public:
|
|||
{ return pos_ < b.end() && b.pos_ < end(); }
|
||||
bool overlaps( const long long pos, const long long size ) const
|
||||
{ return pos_ < pos + size && pos < end(); }
|
||||
bool touches( const Block & b ) const // blocks are mergeable
|
||||
{ return pos_ <= b.end() && b.pos_ <= end(); }
|
||||
|
||||
Block split( const long long pos );
|
||||
};
|
||||
|
@ -410,8 +424,10 @@ const char * const bad_magic_msg = "Bad magic number (file not in lzip format)."
|
|||
const char * const bad_dict_msg = "Invalid dictionary size in member header.";
|
||||
const char * const corrupt_mm_msg = "Corrupt header in multimember file.";
|
||||
const char * const empty_msg = "Empty member not allowed.";
|
||||
const char * const marking_msg = "Marking data not allowed.";
|
||||
const char * const nonzero_msg = "Nonzero first LZMA byte.";
|
||||
const char * const trailing_msg = "Trailing data not allowed.";
|
||||
const char * const mmap_msg = "Can't mmap";
|
||||
const char * const short_file_msg = "Input file is too short.";
|
||||
|
||||
// defined in alone_to_lz.cc
|
||||
int alone_to_lz( const int infd, const Pretty_print & pp );
|
||||
|
@ -446,17 +462,13 @@ int dump_members( const std::vector< std::string > & filenames,
|
|||
const bool force, const bool strip, const bool to_stdout );
|
||||
int remove_members( const std::vector< std::string > & filenames,
|
||||
const Cl_options & cl_opts, const Member_list & member_list );
|
||||
int clear_marking( const std::vector< std::string > & filenames,
|
||||
const Cl_options & cl_opts );
|
||||
int nonzero_repair( const std::vector< std::string > & filenames,
|
||||
const Cl_options & cl_opts );
|
||||
|
||||
// defined in list.cc
|
||||
int list_files( const std::vector< std::string > & filenames,
|
||||
const Cl_options & cl_opts );
|
||||
|
||||
// defined in lzip_index.cc
|
||||
int seek_read( const int fd, uint8_t * const buf, const int size,
|
||||
const long long pos );
|
||||
|
||||
// defined in lunzcrash.cc
|
||||
int lunzcrash_bit( const char * const input_filename,
|
||||
const Cl_options & cl_opts );
|
||||
|
@ -483,9 +495,11 @@ bool open_outstream( const bool force, const bool protect,
|
|||
bool output_file_exists();
|
||||
void cleanup_and_fail( const int retval );
|
||||
bool check_tty_out();
|
||||
void format_trailing_bytes( const uint8_t * const data, const int size,
|
||||
std::string & msg );
|
||||
void set_signal_handler();
|
||||
bool close_outstream( const struct stat * const in_statsp );
|
||||
std::string insert_fixed( std::string name );
|
||||
std::string insert_fixed( std::string name, const bool append_lz = true );
|
||||
void show_2file_error( const char * const msg1, const char * const name1,
|
||||
const char * const name2, const char * const msg2 );
|
||||
class Range_decoder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue