summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
Diffstat (limited to 'lzip.h')
-rw-r--r--lzip.h44
1 files changed, 25 insertions, 19 deletions
diff --git a/lzip.h b/lzip.h
index 86f4d64..9de0962 100644
--- a/lzip.h
+++ b/lzip.h
@@ -321,15 +321,12 @@ struct Lzip_trailer
struct Cl_options // command-line options
{
- bool ignore_empty;
bool ignore_errors;
- bool ignore_nonzero;
bool ignore_trailing;
bool loose_trailing;
- Cl_options()
- : ignore_empty( false ), ignore_errors( false ), ignore_nonzero( false ),
- ignore_trailing( true ), loose_trailing( false ) {}
+ Cl_options() : ignore_errors( false ),
+ ignore_trailing( true ), loose_trailing( false ) {}
};
@@ -420,34 +417,44 @@ inline unsigned long long positive_diff( const unsigned long long x,
inline void set_retval( int & retval, const int new_val )
{ if( retval < new_val ) retval = new_val; }
+inline const char * printable_name( const std::string & filename,
+ const bool in = true )
+ {
+ if( filename.empty() || filename == "-" ) return in ? "(stdin)" : "(stdout)";
+ return filename.c_str();
+ }
+
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 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 nonzero_msg = "Nonzero first LZMA byte.";
const char * const short_file_msg = "Input file is too short.";
+const char * const trailing_msg = "Trailing data not allowed.";
+const char * const write_error_msg = "Write error";
// defined in alone_to_lz.cc
int alone_to_lz( const int infd, const Pretty_print & pp );
// defined in byte_repair.cc
+bool safe_seek( const int fd, const long long pos,
+ const std::string & filename );
long seek_write( const int fd, const uint8_t * const buf, const long size,
const long long pos );
uint8_t * read_member( const int infd, const long long mpos,
- const long long msize, const char * const filename );
+ const long long msize, const std::string & filename );
int byte_repair( const std::string & input_filename,
const std::string & default_output_filename,
const Cl_options & cl_opts,
const char terminator, const bool force );
-int debug_delay( const char * const input_filename,
+int debug_delay( const std::string & input_filename,
const Cl_options & cl_opts, Block range,
const char terminator );
-int debug_byte_repair( const char * const input_filename,
+int debug_byte_repair( const std::string & input_filename,
const Cl_options & cl_opts, const Bad_byte & bad_byte,
const char terminator );
-int debug_decompress( const char * const input_filename,
+int debug_decompress( const std::string & input_filename,
const Cl_options & cl_opts, const Bad_byte & bad_byte,
const bool show_packets );
@@ -470,9 +477,9 @@ int list_files( const std::vector< std::string > & filenames,
const Cl_options & cl_opts );
// defined in lunzcrash.cc
-int lunzcrash_bit( const char * const input_filename,
+int lunzcrash_bit( const std::string & input_filename,
const Cl_options & cl_opts );
-int lunzcrash_block( const char * const input_filename,
+int lunzcrash_block( const std::string & input_filename,
const Cl_options & cl_opts, const int sector_size );
int md5sum_files( const std::vector< std::string > & filenames );
@@ -509,10 +516,11 @@ void show_dprogress( const unsigned long long cfile_size = 0,
const Pretty_print * const p = 0 );
// defined in merge.cc
-bool copy_file( const int infd, const int outfd,
- const long long max_size = -1 );
+bool copy_file( const int infd, const int outfd, const std::string & iname,
+ const std::string & oname, const long long max_size = -1 );
int test_member_from_file( const int infd, const unsigned long long msize,
- long long * const failure_posp = 0 );
+ long long * const failure_posp = 0,
+ bool * const nonzerop = 0 );
int merge_files( const std::vector< std::string > & filenames,
const std::string & default_output_filename,
const Cl_options & cl_opts, const char terminator,
@@ -526,8 +534,6 @@ int print_nrep_stats( const std::vector< std::string > & filenames,
const char * format_num( unsigned long long num,
unsigned long long limit = -1ULL,
const int set_prefix = 0 );
-bool safe_seek( const int fd, const long long pos,
- const char * const filename );
int range_decompress( const std::string & input_filename,
const std::string & default_output_filename,
const Cl_options & cl_opts, Block range,
@@ -540,7 +546,7 @@ int reproduce_file( const std::string & input_filename,
const char * const reference_filename,
const Cl_options & cl_opts, const int lzip_level,
const char terminator, const bool force );
-int debug_reproduce_file( const char * const input_filename,
+int debug_reproduce_file( const std::string & input_filename,
const char * const lzip_name,
const char * const reference_filename,
const Cl_options & cl_opts, const Block & range,