summaryrefslogtreecommitdiffstats
path: root/byte_repair.cc
diff options
context:
space:
mode:
Diffstat (limited to 'byte_repair.cc')
-rw-r--r--byte_repair.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/byte_repair.cc b/byte_repair.cc
index 370738b..d6b1782 100644
--- a/byte_repair.cc
+++ b/byte_repair.cc
@@ -69,10 +69,10 @@ int repair_dictionary_size( uint8_t * const mbuffer, const long msize )
const bool valid_ds = isvalid_ds( dictionary_size );
if( valid_ds && dictionary_size >= data_size ) return 0; // can't be bad
- const unsigned long long dictionary_size_9 = 1 << 25; // dict size of opt -9
- if( !valid_ds || dictionary_size < dictionary_size_9 )
+ const unsigned long long dict_size_9 = 1 << 25; // dict size of opt -9
+ if( !valid_ds || dictionary_size < dict_size_9 )
{
- dictionary_size = std::min( data_size, dictionary_size_9 );
+ dictionary_size = std::min( data_size, dict_size_9 );
if( dictionary_size < min_dictionary_size )
dictionary_size = min_dictionary_size;
LZ_mtester mtester( mbuffer, msize, dictionary_size );
@@ -82,7 +82,7 @@ int repair_dictionary_size( uint8_t * const mbuffer, const long msize )
if( result != 1 || mtester.max_distance() <= dictionary_size ||
mtester.max_distance() > max_dictionary_size ) return 0;
}
- if( data_size > dictionary_size_9 )
+ if( data_size > dict_size_9 )
{
dictionary_size =
std::min( data_size, (unsigned long long)max_dictionary_size );
@@ -174,7 +174,7 @@ uint8_t * read_member( const int infd, const long long mpos,
uint8_t * const buffer = new uint8_t[msize];
if( readblock( infd, buffer, msize ) != msize )
- { show_file_error( filename, "Error reading input file", errno );
+ { show_file_error( filename, read_error_msg, errno );
delete[] buffer; return 0; }
return buffer;
}
@@ -266,7 +266,8 @@ int byte_repair( const std::string & input_filename,
}
if( !close_outstream( &in_stats ) ) return 1;
if( verbosity >= 1 )
- std::fputs( "Copy of input file repaired successfully.\n", stdout );
+ std::printf( "Repaired copy of '%s' written to '%s'\n",
+ filename, output_filename.c_str() );
return 0;
}
@@ -287,7 +288,8 @@ int debug_delay( const char * const input_filename,
if( range.end() > lzip_index.cdata_size() )
range.size( std::max( 0LL, lzip_index.cdata_size() - range.pos() ) );
if( range.size() <= 0 )
- { show_file_error( input_filename, "Nothing to do." ); return 0; }
+ { show_file_error( input_filename, "Nothing to do; range is empty." );
+ return 0; }
for( long i = 0; i < lzip_index.members(); ++i )
{
@@ -370,7 +372,8 @@ int debug_byte_repair( const char * const input_filename,
for( ; idx < lzip_index.members(); ++idx )
if( lzip_index.mblock( idx ).includes( bad_byte.pos ) ) break;
if( idx >= lzip_index.members() )
- { show_file_error( input_filename, "Nothing to do." ); return 0; }
+ { show_file_error( input_filename, "Nothing to do; byte is beyond EOF." );
+ return 0; }
const long long mpos = lzip_index.mblock( idx ).pos();
const long long msize = lzip_index.mblock( idx ).size();