summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2017-05-07 15:54:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2017-05-07 15:54:26 +0000
commitffb72eea1f5e6cbe9f524460eb39d51c69999005 (patch)
tree882ece74433a537d100e9738bef59ad4479519b1 /lzip.h
parentReleasing debian version 1.7-5. (diff)
downloadpdlzip-ffb72eea1f5e6cbe9f524460eb39d51c69999005.tar.xz
pdlzip-ffb72eea1f5e6cbe9f524460eb39d51c69999005.zip
Merging upstream version 1.8.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lzip.h')
-rw-r--r--lzip.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/lzip.h b/lzip.h
index f84c53c..631599d 100644
--- a/lzip.h
+++ b/lzip.h
@@ -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