summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
Diffstat (limited to 'lzip.h')
-rw-r--r--lzip.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/lzip.h b/lzip.h
index 440ce71..1c67344 100644
--- a/lzip.h
+++ b/lzip.h
@@ -60,6 +60,7 @@ enum {
min_dictionary_size = 1 << min_dictionary_bits,
max_dictionary_bits = 29,
max_dictionary_size = 1 << max_dictionary_bits,
+ min_member_size = 36,
literal_context_bits = 3,
pos_state_bits = 2,
pos_states = 1 << pos_state_bits,
@@ -128,6 +129,15 @@ public:
if( longest_name == 0 ) longest_name = stdin_name_len;
}
+ Pretty_print( const std::string & filename, const int v )
+ : stdin_name( "(stdin)" ), verbosity_( v ), first_post( false )
+ {
+ const unsigned int stdin_name_len = std::strlen( stdin_name );
+ longest_name = ( ( filename == "-" ) ? stdin_name_len : filename.size() );
+ if( longest_name == 0 ) longest_name = stdin_name_len;
+ set_name( filename );
+ }
+
void set_name( const std::string & filename )
{
if( filename.size() && filename != "-" ) name_ = filename;
@@ -288,12 +298,35 @@ struct Error
#endif
+class Block
+ {
+ long long pos_, size_; // pos + size <= LLONG_MAX
+
+public:
+ Block( const long long p, const long long s ) throw()
+ : pos_( p ), size_( s ) {}
+
+ long long pos() const throw() { return pos_; }
+ long long size() const throw() { return size_; }
+ long long end() const throw() { return pos_ + size_; }
+
+ void pos( const long long p ) throw() { pos_ = p; }
+ void size( const long long s ) throw() { size_ = s; }
+
+ bool overlaps( const Block & b ) const throw()
+ { return ( pos_ < b.end() && b.pos_ < end() ); }
+ void shift( Block & b ) throw() { ++size_; ++b.pos_; --b.size_; }
+ };
+
+
// defined in decoder.cc
int readblock( const int fd, uint8_t * const buf, const int size ) throw();
int writeblock( const int fd, const uint8_t * const buf, const int size ) throw();
// defined in main.cc
extern int verbosity;
+const char * format_num( long long num, long long limit = LLONG_MAX,
+ const int set_prefix = 0 ) throw();
int open_instream( const std::string & name, struct stat * const in_statsp,
const bool to_stdout, const bool reg_only = false ) throw();
int open_outstream_rw( const std::string & output_filename,
@@ -314,6 +347,13 @@ bool verify_single_member( const int fd, const long long file_size );
int merge_files( const std::vector< std::string > & filenames,
const std::string & output_filename, const bool force );
+// defined in range_dec.cc
+int list_file( const std::string & input_filename );
+int range_decompress( const std::string & input_filename,
+ const std::string & default_output_filename,
+ const std::string & range_string,
+ const bool to_stdout, const bool force );
+
// defined in repair.cc
int repair_file( const std::string & input_filename,
const std::string & output_filename, const bool force );