summaryrefslogtreecommitdiffstats
path: root/create_lz.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-13 08:59:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-13 08:59:14 +0000
commitbab86e3bc6fcc2b148d2a58247e27c765b2b1471 (patch)
treea21a640ddd20d20c6d01cfe1f13b5494722fcb1c /create_lz.cc
parentReleasing debian version 0.14-1. (diff)
downloadtarlz-bab86e3bc6fcc2b148d2a58247e27c765b2b1471.tar.xz
tarlz-bab86e3bc6fcc2b148d2a58247e27c765b2b1471.zip
Merging upstream version 0.15.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'create_lz.cc')
-rw-r--r--create_lz.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/create_lz.cc b/create_lz.cc
index e72839e..9cfdedd 100644
--- a/create_lz.cc
+++ b/create_lz.cc
@@ -83,13 +83,13 @@ public:
struct Ipacket // filename, file size and headers
{
- const unsigned long long file_size;
+ const long long file_size;
const std::string filename; // filename.empty() means end of lzip member
const Extended * const extended;
const uint8_t * const header;
Ipacket() : file_size( 0 ), extended( 0 ), header( 0 ) {}
- Ipacket( const char * const name, const unsigned long long s,
+ Ipacket( const char * const name, const long long s,
const Extended * const ext, const uint8_t * const head )
: file_size( s ), filename( name ), extended( ext ), header( head ) {}
};
@@ -260,8 +260,8 @@ public:
int add_member_lz( const char * const filename, const struct stat *,
const int flag, struct FTW * )
{
- if( Exclude::excluded( filename ) ) return 0; // skip excluded
- unsigned long long file_size = 0;
+ if( Exclude::excluded( filename ) ) return 0; // skip excluded files
+ long long file_size;
// metadata for extended records
Extended * const extended = new( std::nothrow ) Extended;
uint8_t * const header = extended ? new( std::nothrow ) Tar_header : 0;
@@ -315,7 +315,7 @@ extern "C" void * grouper( void * arg )
while( len > 1 && arg[len-1] == '/' ) --len;
if( len < arg.size() )
{ deslashed.assign( arg, 0, len ); filename = deslashed.c_str(); }
- if( Exclude::excluded( filename ) ) continue; // skip excluded
+ if( Exclude::excluded( filename ) ) continue; // skip excluded files
struct stat st;
if( lstat( filename, &st ) != 0 ) // filename from command line
{ show_file_error( filename, "Can't stat input file", errno );
@@ -463,12 +463,12 @@ extern "C" void * cworker( void * arg )
if( ipacket->file_size )
{
- enum { bufsize = 32 * header_size };
+ const long long bufsize = 32 * header_size;
uint8_t buf[bufsize];
- unsigned long long rest = ipacket->file_size;
+ long long rest = ipacket->file_size;
while( rest > 0 )
{
- int size = std::min( rest, (unsigned long long)bufsize );
+ int size = std::min( rest, bufsize );
const int rd = readblock( infd, buf, size );
rest -= rd;
if( rd != size )
@@ -521,10 +521,10 @@ void muxer( Packet_courier & courier, const int outfd )
// init the courier, then start the grouper and the workers and call the muxer
-int encode_lz( const Arg_parser & parser, const int dictionary_size,
- const int match_len_limit, const int num_workers,
- const int outfd, const int out_slots, const int debug_level,
- const bool dereference )
+int encode_lz( const char * const archive_namep, const Arg_parser & parser,
+ const int dictionary_size, const int match_len_limit,
+ const int num_workers, const int outfd, const int out_slots,
+ const int debug_level, const bool dereference )
{
const int in_slots = 65536; // max small files (<=512B) in 64 MiB
const int total_in_slots = ( INT_MAX / num_workers >= in_slots ) ?
@@ -579,7 +579,8 @@ int encode_lz( const Arg_parser & parser, const int dictionary_size,
int retval = !write_eof_records( outfd, true );
if( close( outfd ) != 0 && !retval )
- { show_error( "Error closing archive", errno ); retval = 1; }
+ { show_file_error( archive_namep, "Error closing archive", errno );
+ retval = 1; }
if( debug_level & 1 )
std::fprintf( stderr,