Commit c829a1ca for libheif
commit c829a1ca2429db5775dd0679c532e17089544a02
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Thu Aug 27 02:29:50 2026 +0200
fix clang-tidy performance-avoid-endl in unci decompression fallbacks
The three "compression not enabled" error paths in
unc_decoder::do_decompress_data() live in the #else branches of
HAVE_BROTLI / HAVE_ZLIB and therefore escaped the performance-*
clang-tidy sweep, which only sees the preprocessor branch enabled in the
compile database. The CI tidy runner has no brotli and flagged the first
one. The messages are constant strings, so pass them to Error() directly
instead of building them in a std::stringstream with std::endl.
diff --git a/libheif/codecs/uncompressed/unc_decoder.cc b/libheif/codecs/uncompressed/unc_decoder.cc
index cb0c6c44..c0726001 100644
--- a/libheif/codecs/uncompressed/unc_decoder.cc
+++ b/libheif/codecs/uncompressed/unc_decoder.cc
@@ -268,33 +268,27 @@ Result<std::vector<uint8_t> > unc_decoder::do_decompress_data(std::shared_ptr<co
#if HAVE_BROTLI
return decompress_brotli(compressed_data, limits);
#else
- std::stringstream sstr;
- sstr << "cannot decode unci item with brotli compression - not enabled" << std::endl;
return Error(heif_error_Unsupported_feature,
heif_suberror_Unsupported_generic_compression_method,
- sstr.str());
+ "cannot decode unci item with brotli compression - not enabled");
#endif
}
else if (cmpC_box->get_compression_type() == fourcc("zlib")) {
#if HAVE_ZLIB
return decompress_zlib(compressed_data, limits);
#else
- std::stringstream sstr;
- sstr << "cannot decode unci item with zlib compression - not enabled" << std::endl;
return Error(heif_error_Unsupported_feature,
heif_suberror_Unsupported_generic_compression_method,
- sstr.str());
+ "cannot decode unci item with zlib compression - not enabled");
#endif
}
else if (cmpC_box->get_compression_type() == fourcc("defl")) {
#if HAVE_ZLIB
return decompress_deflate(compressed_data, limits);
#else
- std::stringstream sstr;
- sstr << "cannot decode unci item with deflate compression - not enabled" << std::endl;
return Error(heif_error_Unsupported_feature,
heif_suberror_Unsupported_generic_compression_method,
- sstr.str());
+ "cannot decode unci item with deflate compression - not enabled");
#endif
}
else {