Skip to content

Commit 88afc6b

Browse files
author
Grok Compression
committed
IPTC: store as byte array
1 parent cffdf97 commit 88afc6b

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

src/lib/codec/formats/TIFFFormat.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -997,23 +997,7 @@ bool TIFFFormat<T>::writeHeader(TIFF* tif)
997997
TIFFSetField(tif, TIFFTAG_XMLPACKET, image_->meta->xmp_len, image_->meta->xmp_buf);
998998
if(image_->meta->iptc_buf && image_->meta->iptc_len)
999999
{
1000-
// length must be multiple of 4
1001-
auto iptc_len = image_->meta->iptc_len;
1002-
iptc_len += (4 - (iptc_len & 0x03));
1003-
if(iptc_len > image_->meta->iptc_len)
1004-
{
1005-
auto new_iptf_buf = new uint8_t[iptc_len];
1006-
memset(new_iptf_buf, 0, iptc_len);
1007-
memcpy(new_iptf_buf, image_->meta->iptc_buf, image_->meta->iptc_len);
1008-
delete[] image_->meta->iptc_buf;
1009-
image_->meta->iptc_buf = new_iptf_buf;
1010-
image_->meta->iptc_len = iptc_len;
1011-
}
1012-
// Tag is of type TIFF_LONG, so byte length is divided by four
1013-
if(TIFFIsByteSwapped(tif))
1014-
TIFFSwabArrayOfLong((uint32_t*)image_->meta->iptc_buf,
1015-
(tmsize_t)(image_->meta->iptc_len / 4));
1016-
TIFFSetField(tif, TIFFTAG_RICHTIFFIPTC, (uint32_t)(image_->meta->iptc_len / 4),
1000+
TIFFSetField(tif, TIFFTAG_RICHTIFFIPTC, (uint32_t)(image_->meta->iptc_len),
10171001
(void*)image_->meta->iptc_buf);
10181002
}
10191003
}

0 commit comments

Comments
 (0)