1
0
Fork 0

Merging upstream version 1.8.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-23 19:23:00 +01:00
parent 55505fb36f
commit 7756c69a94
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
13 changed files with 269 additions and 183 deletions

18
lzip.h
View file

@ -1,5 +1,5 @@
/* Pdlzip - LZMA lossless data compressor
Copyright (C) 2010-2016 Antonio Diaz Diaz.
Copyright (C) 2010-2017 Antonio Diaz Diaz.
This program is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided
@ -29,8 +29,10 @@ typedef int State;
enum {
min_dictionary_bits = 12,
min_dictionary_size = 1 << min_dictionary_bits,
max_dictionary_bits = 27, /* kDicLogSizeMaxCompress */
max_dictionary_bits = 29,
max_dictionary_size = 1 << max_dictionary_bits,
max_dictionary_bits_c = 27, /* kDicLogSizeMaxCompress */
max_dictionary_size_c = 1 << max_dictionary_bits_c,
literal_context_bits = 3,
literal_pos_state_bits = 0, /* not used */
pos_state_bits = 2,
@ -66,9 +68,9 @@ static inline void Pp_init( struct Pretty_print * const pp,
pp->stdin_name = "(stdin)";
pp->longest_name = 0;
pp->first_post = false;
stdin_name_len = strlen( pp->stdin_name );
if( verbosity <= 0 ) return;
stdin_name_len = strlen( pp->stdin_name );
for( i = 0; i < num_filenames; ++i )
{
const char * const s = filenames[i];
@ -114,8 +116,10 @@ static inline void CRC32_update_buf( uint32_t * const crc,
const int size )
{
int i;
uint32_t c = *crc;
for( i = 0; i < size; ++i )
*crc = crc32[(*crc^buffer[i])&0xFF] ^ ( *crc >> 8 );
c = crc32[(c^buffer[i])&0xFF] ^ ( c >> 8 );
*crc = c;
}
@ -175,7 +179,7 @@ static inline bool Fh_set_dictionary_size( File_header data, const unsigned sz )
{
const unsigned base_size = 1 << data[5];
const unsigned fraction = base_size / 16;
int i;
unsigned i;
for( i = 7; i >= 1; --i )
if( base_size - ( i * fraction ) >= sz )
{ data[5] |= ( i << 5 ); break; }
@ -222,6 +226,8 @@ static inline void Ft_set_member_size( File_trailer data, unsigned long long sz
{ int i; for( i = 12; i <= 19; ++i ) { data[i] = (uint8_t)sz; sz >>= 8; } }
static const char * const trailing_msg = "Trailing data not allowed.";
/* defined in main.c */
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 );
@ -230,6 +236,8 @@ int writeblock( const int fd, const uint8_t * const buf, const int size );
extern int verbosity;
void cleanup_and_fail( const int retval );
void show_error( const char * const msg, const int errcode, const bool help );
void show_file_error( const char * const filename, const char * const msg,
const int errcode );
void internal_error( const char * const msg );
#define SZ_OK 0