diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-01-23 05:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-01-23 05:31:44 +0000 |
commit | 166ede1642869f46a0aae2df885772f7383e9ab2 (patch) | |
tree | e94c5a1aa65e2c1b2370656f0df107edd33700f7 /merge.cc | |
parent | Adding upstream version 1.24~pre1. (diff) | |
download | lziprecover-166ede1642869f46a0aae2df885772f7383e9ab2.tar.xz lziprecover-166ede1642869f46a0aae2df885772f7383e9ab2.zip |
Adding upstream version 1.24.upstream/1.24
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'merge.cc')
-rw-r--r-- | merge.cc | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,5 +1,5 @@ /* Lziprecover - Data recovery tool for the lzip format - Copyright (C) 2009-2023 Antonio Diaz Diaz. + Copyright (C) 2009-2024 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 @@ -549,7 +549,7 @@ int test_member_from_file( const int infd, const unsigned long long msize, { Range_decoder rdec( infd ); Lzip_header header; - rdec.read_data( header.data, Lzip_header::size ); + rdec.read_data( header.data, header.size ); const unsigned dictionary_size = header.dictionary_size(); bool done = false; if( !rdec.finished() && header.check_magic() && @@ -558,8 +558,7 @@ int test_member_from_file( const int infd, const unsigned long long msize, LZ_decoder decoder( rdec, dictionary_size, -1 ); const int saved_verbosity = verbosity; verbosity = -1; // suppress all messages - Pretty_print dummy_pp( "" ); - done = ( decoder.decode_member( dummy_pp ) == 0 ); + done = decoder.decode_member() == 0; verbosity = saved_verbosity; // restore verbosity level if( done && rdec.member_position() == msize ) return 0; } @@ -582,10 +581,11 @@ int merge_files( const std::vector< std::string > & filenames, if( retval >= 0 ) return retval; if( !safe_seek( infd_vector[0], 0, filenames[0].c_str() ) ) return 1; - output_filename = default_output_filename.empty() ? - insert_fixed( filenames[0] ) : default_output_filename; + const bool to_file = default_output_filename.size(); + output_filename = + to_file ? default_output_filename : insert_fixed( filenames[0] ); set_signal_handler(); - if( !open_outstream( force, true, true, false ) ) return 1; + if( !open_outstream( force, true, true, false, to_file ) ) return 1; if( !copy_file( infd_vector[0], outfd ) ) // copy whole file cleanup_and_fail( 1 ); @@ -651,7 +651,7 @@ int merge_files( const std::vector< std::string > & filenames, } } - if( close_outstream( &in_stats ) != 0 ) return 1; + if( !close_outstream( &in_stats ) ) return 1; if( verbosity >= 1 ) std::fputs( "Input files merged successfully.\n", stdout ); return 0; |