summaryrefslogtreecommitdiffstats
path: root/repair.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--repair.cc42
1 files changed, 20 insertions, 22 deletions
diff --git a/repair.cc b/repair.cc
index 3048987..7b23843 100644
--- a/repair.cc
+++ b/repair.cc
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for the lzip format
- Copyright (C) 2009-2017 Antonio Diaz Diaz.
+ Copyright (C) 2009-2018 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
@@ -107,7 +107,7 @@ int repair_dictionary_size( const long long msize, uint8_t * const mbuffer )
// Return value: -1 = master failed, 0 = begin reached, >0 = repaired pos
long repair_member( const long long mpos, const long long msize,
uint8_t * const mbuffer, const long begin, const long end,
- const unsigned dictionary_size, const int verbosity )
+ const unsigned dictionary_size )
{
for( long pos = end; pos >= begin && pos > end - 50000; )
{
@@ -140,14 +140,14 @@ long repair_member( const long long mpos, const long long msize,
int repair_file( const std::string & input_filename,
const std::string & default_output_filename,
- const int verbosity, const bool force )
+ const bool force )
{
struct stat in_stats;
const int infd = open_instream( input_filename.c_str(), &in_stats, true, true );
if( infd < 0 ) return 1;
- Pretty_print pp( input_filename, verbosity );
- const File_index file_index( infd, true, true );
+ Pretty_print pp( input_filename );
+ const File_index file_index( infd, true, true, true );
if( file_index.retval() != 0 )
{ show_file_error( input_filename.c_str(), file_index.error().c_str() );
return file_index.retval(); }
@@ -186,10 +186,10 @@ int repair_file( const std::string & input_filename,
pos = repair_dictionary_size( msize, mbuffer );
if( pos == 0 )
pos = repair_member( mpos, msize, mbuffer, File_header::size + 1,
- File_header::size + 5, dictionary_size, verbosity );
+ File_header::size + 5, dictionary_size );
if( pos == 0 )
pos = repair_member( mpos, msize, mbuffer, File_header::size + 6,
- failure_pos, dictionary_size, verbosity );
+ failure_pos, dictionary_size );
print_pending_newline();
}
if( pos < 0 )
@@ -228,15 +228,14 @@ int repair_file( const std::string & input_filename,
}
-int debug_delay( const std::string & input_filename, Block range,
- const int verbosity )
+int debug_delay( const std::string & input_filename, Block range )
{
struct stat in_stats; // not used
const int infd = open_instream( input_filename.c_str(), &in_stats, true, true );
if( infd < 0 ) return 1;
- Pretty_print pp( input_filename, verbosity );
- const File_index file_index( infd, false, true );
+ Pretty_print pp( input_filename );
+ const File_index file_index( infd, false, true, true );
if( file_index.retval() != 0 )
{ show_file_error( input_filename.c_str(), file_index.error().c_str() );
return file_index.retval(); }
@@ -244,7 +243,7 @@ int debug_delay( const std::string & input_filename, Block range,
if( range.end() > file_index.cdata_size() )
range.size( std::max( 0LL, file_index.cdata_size() - range.pos() ) );
if( range.size() <= 0 )
- { if( verbosity >= 0 ) pp( "Nothing to do." ); return 0; }
+ { pp( "Nothing to do." ); return 0; }
for( long i = 0; i < file_index.members(); ++i )
{
@@ -309,14 +308,14 @@ int debug_delay( const std::string & input_filename, Block range,
int debug_repair( const std::string & input_filename,
- const Bad_byte & bad_byte, const int verbosity )
+ const Bad_byte & bad_byte )
{
struct stat in_stats; // not used
const int infd = open_instream( input_filename.c_str(), &in_stats, true, true );
if( infd < 0 ) return 1;
- Pretty_print pp( input_filename, verbosity );
- const File_index file_index( infd, false, true );
+ Pretty_print pp( input_filename );
+ const File_index file_index( infd, false, true, true );
if( file_index.retval() != 0 )
{ show_file_error( input_filename.c_str(), file_index.error().c_str() );
return file_index.retval(); }
@@ -325,7 +324,7 @@ int debug_repair( const std::string & input_filename,
for( ; idx < file_index.members(); ++idx )
if( file_index.mblock( idx ).includes( bad_byte.pos ) ) break;
if( idx >= file_index.members() )
- { if( verbosity >= 0 ) pp( "Nothing to do." ); return 0; }
+ { pp( "Nothing to do." ); return 0; }
const long long mpos = file_index.mblock( idx ).pos();
const long long msize = file_index.mblock( idx ).size();
@@ -377,10 +376,10 @@ int debug_repair( const std::string & input_filename,
long pos = repair_dictionary_size( msize, mbuffer );
if( pos == 0 )
pos = repair_member( mpos, msize, mbuffer, File_header::size + 1,
- File_header::size + 5, dictionary_size, verbosity );
+ File_header::size + 5, dictionary_size );
if( pos == 0 )
pos = repair_member( mpos, msize, mbuffer, File_header::size + 6,
- failure_pos, dictionary_size, verbosity );
+ failure_pos, dictionary_size );
print_pending_newline();
delete[] mbuffer;
if( pos < 0 )
@@ -393,15 +392,14 @@ int debug_repair( const std::string & input_filename,
int debug_decompress( const std::string & input_filename,
- const Bad_byte & bad_byte, const int verbosity,
- const bool show_packets )
+ const Bad_byte & bad_byte, const bool show_packets )
{
struct stat in_stats;
const int infd = open_instream( input_filename.c_str(), &in_stats, true, true );
if( infd < 0 ) return 1;
- Pretty_print pp( input_filename, verbosity );
- const File_index file_index( infd, false, true );
+ Pretty_print pp( input_filename );
+ const File_index file_index( infd, false, true, true );
if( file_index.retval() != 0 )
{ show_file_error( input_filename.c_str(), file_index.error().c_str() );
return file_index.retval(); }