summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:45:12 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:45:12 +0000
commit2085b1344e4c2b3c4a3d21d4bc10227679a55507 (patch)
tree86328decac9bdf54fb41b6af1bd15b23fff1edd7 /lzip.h
parentAdding debian version 1.15-2. (diff)
downloadlziprecover-2085b1344e4c2b3c4a3d21d4bc10227679a55507.tar.xz
lziprecover-2085b1344e4c2b3c4a3d21d4bc10227679a55507.zip
Merging upstream version 1.16~pre1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lzip.h')
-rw-r--r--lzip.h30
1 files changed, 13 insertions, 17 deletions
diff --git a/lzip.h b/lzip.h
index bdc4c61..483835f 100644
--- a/lzip.h
+++ b/lzip.h
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for lzip files
- Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz.
+ Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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
@@ -40,7 +40,7 @@ public:
enum {
min_dictionary_bits = 12,
- min_dictionary_size = 1 << min_dictionary_bits,
+ min_dictionary_size = 1 << min_dictionary_bits, // >= modeled_distances
max_dictionary_bits = 29,
max_dictionary_size = 1 << max_dictionary_bits,
min_member_size = 36,
@@ -49,6 +49,7 @@ enum {
pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1,
+ len_states = 4,
dis_slot_bits = 6,
start_dis_model = 4,
end_dis_model = 14,
@@ -66,12 +67,10 @@ enum {
min_match_len = 2, // must be 2
max_match_len = min_match_len + max_len_symbols - 1, // 273
- min_match_len_limit = 5,
+ min_match_len_limit = 5 };
- dis_states = 4 };
-
-inline int get_dis_state( const int len )
- { return std::min( len - min_match_len, dis_states - 1 ); }
+inline int get_len_state( const int len )
+ { return std::min( len - min_match_len, len_states - 1 ); }
inline int get_lit_state( const uint8_t prev_byte )
{ return ( prev_byte >> ( 8 - literal_context_bits ) ); }
@@ -114,7 +113,7 @@ public:
for( unsigned i = 0; i < filenames.size(); ++i )
{
const std::string & s = filenames[i];
- const unsigned len = ( ( s == "-" ) ? stdin_name_len : s.size() );
+ const unsigned len = ( s == "-" ) ? stdin_name_len : s.size();
if( len > longest_name ) longest_name = len;
}
if( longest_name == 0 ) longest_name = stdin_name_len;
@@ -124,7 +123,7 @@ public:
: stdin_name( "(stdin)" ), verbosity_( v ), first_post( false )
{
const unsigned stdin_name_len = std::strlen( stdin_name );
- longest_name = ( ( filename == "-" ) ? stdin_name_len : filename.size() );
+ longest_name = ( filename == "-" ) ? stdin_name_len : filename.size();
if( longest_name == 0 ) longest_name = stdin_name_len;
set_name( filename );
}
@@ -253,9 +252,7 @@ struct File_trailer
}
void data_size( unsigned long long sz )
- {
- for( int i = 4; i <= 11; ++i ) { data[i] = (uint8_t)sz; sz >>= 8; }
- }
+ { for( int i = 4; i <= 11; ++i ) { data[i] = (uint8_t)sz; sz >>= 8; } }
unsigned long long member_size() const
{
@@ -265,9 +262,7 @@ struct File_trailer
}
void member_size( unsigned long long sz )
- {
- for( int i = 12; i <= 19; ++i ) { data[i] = (uint8_t)sz; sz >>= 8; }
- }
+ { for( int i = 12; i <= 19; ++i ) { data[i] = (uint8_t)sz; sz >>= 8; } }
};
@@ -288,12 +283,14 @@ 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 );
// defined in main.cc
-int open_instream( const std::string & name, struct stat * const in_statsp,
+int open_instream( const char * const name, struct stat * const in_statsp,
const bool no_ofile, const bool reg_only = false );
int open_outstream_rw( const std::string & output_filename, const bool force );
void show_header( const File_header & header );
void show_error( const char * const msg, const int errcode = 0,
const bool help = false );
+void show_error2( const char * const msg1, const char * const name,
+ const char * const msg2 );
void internal_error( const char * const msg );
// defined in merge.cc
@@ -303,7 +300,6 @@ bool copy_file( const int infd, const int outfd,
const long long max_size = -1 );
bool try_decompress_member( const int fd, const unsigned long long msize,
long long * failure_posp = 0 );
-bool verify_header( const File_header & header, const int verbosity );
int merge_files( const std::vector< std::string > & filenames,
const std::string & output_filename, const int verbosity,
const bool force );