@@ -626,12 +626,11 @@ Result<std::vector<uint8_t>> HeifFile::get_uncompressed_item_data(heif_item_id I
626
626
// --- decompress data
627
627
628
628
Error error;
629
- bool read_uncompressed = true ;
629
+
630
630
if (item_type == fourcc (" mime" )) {
631
631
std::string encoding = infe_box->get_content_encoding ();
632
632
if (encoding == " compress_zlib" ) {
633
633
#if HAVE_ZLIB
634
- read_uncompressed = false ;
635
634
std::vector<uint8_t > compressed_data;
636
635
error = m_iloc_box->read_data (ID, m_input_stream, m_idat_box, &compressed_data, m_limits);
637
636
if (error) {
@@ -647,7 +646,6 @@ Result<std::vector<uint8_t>> HeifFile::get_uncompressed_item_data(heif_item_id I
647
646
}
648
647
else if (encoding == " deflate" ) {
649
648
#if HAVE_ZLIB
650
- read_uncompressed = false ;
651
649
std::vector<uint8_t > compressed_data;
652
650
error = m_iloc_box->read_data (ID, m_input_stream, m_idat_box, &compressed_data, m_limits);
653
651
if (error) {
@@ -662,7 +660,6 @@ Result<std::vector<uint8_t>> HeifFile::get_uncompressed_item_data(heif_item_id I
662
660
}
663
661
else if (encoding == " br" ) {
664
662
#if HAVE_BROTLI
665
- read_uncompressed = false ;
666
663
std::vector<uint8_t > compressed_data;
667
664
error = m_iloc_box->read_data (ID, m_input_stream, m_idat_box, &compressed_data, m_limits);
668
665
if (error) {
@@ -675,20 +672,22 @@ Result<std::vector<uint8_t>> HeifFile::get_uncompressed_item_data(heif_item_id I
675
672
encoding);
676
673
#endif
677
674
}
678
- }
679
-
680
- if (read_uncompressed) {
681
- std::vector<uint8_t > data;
682
- Error error = m_iloc_box->read_data (ID, m_input_stream, m_idat_box, &data, m_limits);
683
- if (error) {
684
- return error;
685
- }
686
- else {
687
- return data;
675
+ else if (!encoding.empty ()) {
676
+ return Error (heif_error_Unsupported_feature, heif_suberror_Unsupported_codec);
688
677
}
689
678
}
690
679
691
- return Error (heif_error_Unsupported_feature, heif_suberror_Unsupported_codec);
680
+
681
+ // --- read uncompressed
682
+
683
+ std::vector<uint8_t > data;
684
+ error = m_iloc_box->read_data (ID, m_input_stream, m_idat_box, &data, m_limits);
685
+ if (error) {
686
+ return error;
687
+ }
688
+ else {
689
+ return data;
690
+ }
692
691
}
693
692
694
693
0 commit comments