Remove output to std::cerr

This commit is contained in:
Serge Lamikhov-Center 2022-11-11 01:09:12 +02:00
parent 705a91c568
commit 8409f20a7f

View File

@ -225,31 +225,19 @@ template <class T> class section_impl : public section
return false; return false;
} }
if ( ( get_flags() & SHF_RPX_DEFLATE ) || if ( ( ( get_flags() & SHF_RPX_DEFLATE ) ||
( get_flags() & SHF_COMPRESSED ) ) { ( get_flags() & SHF_COMPRESSED ) ) &&
if ( compression == nullptr ) { compression != nullptr ) {
std::cerr
<< "WARN: compressed section found but no "
"compression implementation provided. Skipping."
<< std::endl;
data = nullptr;
return false;
}
// at this point, data holds the whole compressed stream // at this point, data holds the whole compressed stream
Elf_Xword uncompressed_size = 0; Elf_Xword uncompressed_size = 0;
auto decompressed_data = compression->inflate( auto decompressed_data = compression->inflate(
data.get(), convertor, size, uncompressed_size ); data.get(), convertor, size, uncompressed_size );
if ( decompressed_data == nullptr ) { if ( decompressed_data != nullptr ) {
std::cerr << "Failed to decompress section data." set_size( uncompressed_size );
<< std::endl; data = std::move( decompressed_data );
data = nullptr;
return false;
} }
set_size( uncompressed_size );
data = std::move( decompressed_data );
} }
// refresh size because it may have changed if we had to decompress data // refresh size because it may have changed if we had to decompress data
size = get_size(); size = get_size();
data.get()[size] = data.get()[size] =