summaryrefslogtreecommitdiffstats
path: root/reproduce.cc
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce.cc')
-rw-r--r--reproduce.cc29
1 files changed, 15 insertions, 14 deletions
diff --git a/reproduce.cc b/reproduce.cc
index 5ca91a7..ff7c654 100644
--- a/reproduce.cc
+++ b/reproduce.cc
@@ -440,7 +440,7 @@ int reproduce_member( uint8_t * const mbuffer, const long msize,
(const uint8_t *)mmap( 0, rsize, PROT_READ, MAP_PRIVATE, rfd, 0 );
close( rfd );
if( rbuf == MAP_FAILED )
- { show_file_error( reference_filename, "Can't mmap", errno );
+ { show_file_error( reference_filename, mmap_msg, errno );
return fatal( 1 ); }
const Lzip_header & header = *(const Lzip_header *)mbuffer;
@@ -457,8 +457,8 @@ int reproduce_member( uint8_t * const mbuffer, const long msize,
const long offset = match_file( *master, rbuf, rsize, reference_filename );
if( offset < 0 ) { delete master; return 2; } // no match
- // Reference data from offset must be at least as large as zeroed sector
- // minus member trailer if trailer is inside the zeroed sector.
+ /* Reference data from offset must be at least as large as zeroed sector
+ minus member trailer if trailer is inside the zeroed sector. */
const int t = ( begin + size >= msize ) ? 16 + Lzip_trailer::size : 0;
if( rsize - offset < size - t )
{ show_file_error( reference_filename, "Not enough reference data after match." );
@@ -567,7 +567,7 @@ int reproduce_file( const std::string & input_filename,
uint8_t * const mbuffer_base = (uint8_t *)mmap( 0, msize + mpos_rem,
PROT_READ | PROT_WRITE, MAP_PRIVATE, infd, mpos - mpos_rem );
if( mbuffer_base == MAP_FAILED )
- { show_file_error( filename, "Can't mmap", errno ); return 1; }
+ { show_file_error( filename, mmap_msg, errno ); return 1; }
uint8_t * const mbuffer = mbuffer_base + mpos_rem;
long size = 0;
uint8_t value = 0;
@@ -627,7 +627,8 @@ int reproduce_file( const std::string & input_filename,
std::fputs( "One member reproduced."
" Copy of input file still contains errors.\n", stdout );
else
- std::fputs( "Copy of input file reproduced successfully.\n", stdout );
+ std::printf( "Repaired copy of '%s' written to '%s'\n",
+ filename, output_filename.c_str() );
}
return 0;
}
@@ -686,7 +687,7 @@ int debug_reproduce_file( const char * const input_filename,
uint8_t * const mbuffer_base = (uint8_t *)mmap( 0, msize + mpos_rem,
PROT_READ | PROT_WRITE, MAP_PRIVATE, infd, mpos - mpos_rem );
if( mbuffer_base == MAP_FAILED )
- { show_file_error( input_filename, "Can't mmap", errno ); return 1; }
+ { show_file_error( input_filename, mmap_msg, errno ); return 1; }
uint8_t * const mbuffer = mbuffer_base + mpos_rem;
if( !md5_valid )
{
@@ -762,18 +763,18 @@ int debug_reproduce_file( const char * const input_filename,
done:
if( verbosity >= 0 )
{
- std::printf( "\n%9ld sectors tested"
- "\n%9ld reproductions returned with zero status",
- positions, successes );
+ std::printf( "\n%11s sectors tested"
+ "\n%11s reproductions returned with zero status",
+ format_num3( positions ), format_num3( successes ) );
if( successes > 0 )
{
if( failed_comparisons > 0 )
- std::printf( ", of which\n%9ld comparisons failed\n",
- failed_comparisons );
- else std::fputs( "\n all comparisons passed\n", stdout );
+ std::printf( ", of which\n%11s comparisons failed\n",
+ format_num3( failed_comparisons ) );
+ else std::fputs( "\n all comparisons passed\n", stdout );
if( alternative_reproductions > 0 )
- std::printf( "%9ld alternative reproductions found\n",
- alternative_reproductions );
+ std::printf( "%11s alternative reproductions found\n",
+ format_num3( alternative_reproductions ) );
}
else std::fputc( '\n', stdout );
if( fatal_retval )