Merging upstream version 1.11.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c1d97756f3
commit
d865a97d34
26 changed files with 1012 additions and 896 deletions
38
list.c
38
list.c
|
@ -1,5 +1,5 @@
|
|||
/* Clzip - LZMA lossless data compressor
|
||||
Copyright (C) 2010-2018 Antonio Diaz Diaz.
|
||||
Copyright (C) 2010-2019 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
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "lzip.h"
|
||||
#include "file_index.h"
|
||||
#include "lzip_index.h"
|
||||
|
||||
|
||||
static void list_line( const unsigned long long uncomp_size,
|
||||
|
@ -53,7 +53,7 @@ int list_files( const char * const filenames[], const int num_filenames,
|
|||
for( i = 0; i < num_filenames; ++i )
|
||||
{
|
||||
const char * input_filename;
|
||||
struct File_index file_index;
|
||||
struct Lzip_index lzip_index;
|
||||
struct stat in_stats; /* not used */
|
||||
int infd;
|
||||
const bool from_stdin = ( strcmp( filenames[i], "-" ) == 0 );
|
||||
|
@ -63,18 +63,18 @@ int list_files( const char * const filenames[], const int num_filenames,
|
|||
open_instream( input_filename, &in_stats, true, true );
|
||||
if( infd < 0 ) { if( retval < 1 ) retval = 1; continue; }
|
||||
|
||||
Fi_init( &file_index, infd, ignore_trailing, loose_trailing );
|
||||
Li_init( &lzip_index, infd, ignore_trailing, loose_trailing );
|
||||
close( infd );
|
||||
if( file_index.retval != 0 )
|
||||
if( lzip_index.retval != 0 )
|
||||
{
|
||||
show_file_error( input_filename, file_index.error, 0 );
|
||||
if( retval < file_index.retval ) retval = file_index.retval;
|
||||
Fi_free( &file_index ); continue;
|
||||
show_file_error( input_filename, lzip_index.error, 0 );
|
||||
if( retval < lzip_index.retval ) retval = lzip_index.retval;
|
||||
Li_free( &lzip_index ); continue;
|
||||
}
|
||||
if( verbosity >= 0 )
|
||||
{
|
||||
const unsigned long long udata_size = Fi_udata_size( &file_index );
|
||||
const unsigned long long cdata_size = Fi_cdata_size( &file_index );
|
||||
const unsigned long long udata_size = Li_udata_size( &lzip_index );
|
||||
const unsigned long long cdata_size = Li_cdata_size( &lzip_index );
|
||||
total_comp += cdata_size; total_uncomp += udata_size; ++files;
|
||||
if( first_post )
|
||||
{
|
||||
|
@ -87,23 +87,23 @@ int list_files( const char * const filenames[], const int num_filenames,
|
|||
long long trailing_size;
|
||||
unsigned dictionary_size = 0;
|
||||
long i;
|
||||
for( i = 0; i < file_index.members; ++i )
|
||||
for( i = 0; i < lzip_index.members; ++i )
|
||||
dictionary_size =
|
||||
max( dictionary_size, Fi_dictionary_size( &file_index, i ) );
|
||||
trailing_size = Fi_file_size( &file_index ) - cdata_size;
|
||||
max( dictionary_size, Li_dictionary_size( &lzip_index, i ) );
|
||||
trailing_size = Li_file_size( &lzip_index ) - cdata_size;
|
||||
printf( "%s %5ld %6lld ", format_ds( dictionary_size ),
|
||||
file_index.members, trailing_size );
|
||||
lzip_index.members, trailing_size );
|
||||
}
|
||||
list_line( udata_size, cdata_size, input_filename );
|
||||
|
||||
if( verbosity >= 2 && file_index.members > 1 )
|
||||
if( verbosity >= 2 && lzip_index.members > 1 )
|
||||
{
|
||||
long i;
|
||||
fputs( " member data_pos data_size member_pos member_size\n", stdout );
|
||||
for( i = 0; i < file_index.members; ++i )
|
||||
for( i = 0; i < lzip_index.members; ++i )
|
||||
{
|
||||
const struct Block * db = Fi_dblock( &file_index, i );
|
||||
const struct Block * mb = Fi_mblock( &file_index, i );
|
||||
const struct Block * db = Li_dblock( &lzip_index, i );
|
||||
const struct Block * mb = Li_mblock( &lzip_index, i );
|
||||
printf( "%5ld %15llu %15llu %15llu %15llu\n",
|
||||
i + 1, db->pos, db->size, mb->pos, mb->size );
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ int list_files( const char * const filenames[], const int num_filenames,
|
|||
}
|
||||
fflush( stdout );
|
||||
}
|
||||
Fi_free( &file_index );
|
||||
Li_free( &lzip_index );
|
||||
}
|
||||
if( verbosity >= 0 && files > 1 )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue