summaryrefslogtreecommitdiffstats
path: root/list.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-02-21 16:13:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-02-21 16:13:20 +0000
commit83ee6131390406477f652741c1ebb25cc17e3181 (patch)
tree553f2f499192b3fa71f01f814120799aeab8a242 /list.cc
parentAdding upstream version 1.22. (diff)
downloadlziprecover-83ee6131390406477f652741c1ebb25cc17e3181.tar.xz
lziprecover-83ee6131390406477f652741c1ebb25cc17e3181.zip
Adding upstream version 1.23.upstream/1.23
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'list.cc')
-rw-r--r--list.cc67
1 files changed, 32 insertions, 35 deletions
diff --git a/list.cc b/list.cc
index 09366f1..6cc5aab 100644
--- a/list.cc
+++ b/list.cc
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for the lzip format
- Copyright (C) 2009-2021 Antonio Diaz Diaz.
+ Copyright (C) 2009-2022 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
@@ -76,47 +76,44 @@ int list_files( const std::vector< std::string > & filenames,
set_retval( retval, lzip_index.retval() );
continue;
}
- if( verbosity >= 0 )
+ if( verbosity < 0 ) continue;
+ const unsigned long long udata_size = lzip_index.udata_size();
+ const unsigned long long cdata_size = lzip_index.cdata_size();
+ total_comp += cdata_size; total_uncomp += udata_size; ++files;
+ const long members = lzip_index.members();
+ if( first_post )
{
- const unsigned long long udata_size = lzip_index.udata_size();
- const unsigned long long cdata_size = lzip_index.cdata_size();
- total_comp += cdata_size; total_uncomp += udata_size; ++files;
- const long members = lzip_index.members();
- if( first_post )
- {
- first_post = false;
- if( verbosity >= 1 ) std::fputs( " dict memb trail ", stdout );
- std::fputs( " uncompressed compressed saved name\n", stdout );
- }
- if( verbosity >= 1 )
- std::printf( "%s %5ld %6lld ",
- format_ds( lzip_index.dictionary_size() ), members,
- lzip_index.file_size() - cdata_size );
- list_line( udata_size, cdata_size, input_filename );
+ first_post = false;
+ if( verbosity >= 1 ) std::fputs( " dict memb trail ", stdout );
+ std::fputs( " uncompressed compressed saved name\n", stdout );
+ }
+ if( verbosity >= 1 )
+ std::printf( "%s %5ld %6lld ", format_ds( lzip_index.dictionary_size() ),
+ members, lzip_index.file_size() - cdata_size );
+ list_line( udata_size, cdata_size, input_filename );
- if( verbosity >= 2 && ( members > 1 ||
- ( members == 1 && lzip_index.mblock( 0 ).pos() > 0 ) ) )
+ if( verbosity >= 2 && ( members > 1 ||
+ ( members == 1 && lzip_index.mblock( 0 ).pos() > 0 ) ) )
+ {
+ std::fputs( " member data_pos data_size member_pos member_size\n", stdout );
+ long long prev_end = 0;
+ for( long i = 0, gaps = 0; i < members; ++i )
{
- std::fputs( " member data_pos data_size member_pos member_size\n", stdout );
- long long prev_end = 0;
- for( long i = 0, gaps = 0; i < members; ++i )
+ const Block & db = lzip_index.dblock( i );
+ const Block & mb = lzip_index.mblock( i );
+ if( mb.pos() > prev_end )
{
- const Block & db = lzip_index.dblock( i );
- const Block & mb = lzip_index.mblock( i );
- if( mb.pos() > prev_end )
- {
- std::printf( " gap - - %14llu %14llu\n",
- prev_end, mb.pos() - prev_end );
- ++gaps;
- }
- std::printf( "%6ld %14llu %14llu %14llu %14llu\n",
- i + gaps + 1, db.pos(), db.size(), mb.pos(), mb.size() );
- prev_end = mb.end();
+ std::printf( " gap - - %14llu %14llu\n",
+ prev_end, mb.pos() - prev_end );
+ ++gaps;
}
- first_post = true; // reprint heading after list of members
+ std::printf( "%6ld %14llu %14llu %14llu %14llu\n",
+ i + gaps + 1, db.pos(), db.size(), mb.pos(), mb.size() );
+ prev_end = mb.end();
}
- std::fflush( stdout );
+ first_post = true; // reprint heading after list of members
}
+ std::fflush( stdout );
}
if( verbosity >= 0 && files > 1 )
{