Adding upstream version 0.19.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
739f200278
commit
7bf1f2e322
28 changed files with 926 additions and 616 deletions
28
extended.cc
28
extended.cc
|
@ -1,5 +1,5 @@
|
|||
/* Tarlz - Archiver with multimember lzip compression
|
||||
Copyright (C) 2013-2020 Antonio Diaz Diaz.
|
||||
Copyright (C) 2013-2021 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
|
||||
|
@ -24,16 +24,17 @@
|
|||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <pthread.h>
|
||||
#include <pthread.h> // for tarlz.h
|
||||
#include <stdint.h>
|
||||
|
||||
#include "tarlz.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
const CRC32 crc32c( true );
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
unsigned decimal_digits( unsigned long long value )
|
||||
{
|
||||
unsigned digits = 1;
|
||||
|
@ -132,6 +133,7 @@ bool print_record( char * const buf, const int size,
|
|||
} // end namespace
|
||||
|
||||
|
||||
std::vector< std::string > Extended::unknown_keywords;
|
||||
const std::string Extended::crc_record( "22 GNU.crc32=00000000\n" );
|
||||
|
||||
void Extended::calculate_sizes() const
|
||||
|
@ -147,6 +149,22 @@ void Extended::calculate_sizes() const
|
|||
}
|
||||
|
||||
|
||||
// print a diagnostic for each unknown keyword once per keyword
|
||||
void Extended::unknown_keyword( const char * const buf,
|
||||
const unsigned long long size ) const
|
||||
{
|
||||
unsigned long long eq_pos = 0; // position of '=' in buf
|
||||
while( eq_pos < size && buf[eq_pos] != '=' ) ++eq_pos;
|
||||
const std::string keyword( buf, eq_pos );
|
||||
for( unsigned i = 0; i < unknown_keywords.size(); ++i )
|
||||
if( keyword == unknown_keywords[i] ) return;
|
||||
unknown_keywords.push_back( keyword );
|
||||
std::string msg( "Ignoring unknown extended header keyword '" );
|
||||
msg += keyword; msg += '\'';
|
||||
show_error( msg.c_str() );
|
||||
}
|
||||
|
||||
|
||||
// Returns the extended block size, or -1 if error.
|
||||
long long Extended::format_block( Resizable_buffer & rbuf ) const
|
||||
{
|
||||
|
@ -239,6 +257,8 @@ bool Extended::parse( const char * const buf, const unsigned long long edsize,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if( ( rest < 8 || std::memcmp( tail, "comment=", 8 ) != 0 ) &&
|
||||
verbosity >= 1 ) unknown_keyword( tail, rest );
|
||||
pos += rsize;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue