Skip to content

Commit

Permalink
Avoid buffer reallocation
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Oct 25, 2022
1 parent fb6b769 commit 406d7d7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/bmffimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,8 @@ uint64_t BmffImage::boxHandler(std::ostream& out /* = std::cout*/, Exiv2::PrintS
Internal::TiffParserWorker::decode(exifData(), iptcData(), xmpData(), arr.c_data(offset), arr.size() - offset,
Internal::Tag::root, Internal::TiffMapping::findDecoder);
} else if (realType == TAG_xml) {
arr.resize(arr.size() + 1);
arr.write_uint8(arr.size() - 1, 0); // ensure xmp is null terminated!
try {
Exiv2::XmpParser::decode(xmpData(), std::string(arr.c_str()));
Exiv2::XmpParser::decode(xmpData(), std::string(arr.c_str(), arr.size()));
} catch (...) {
throw Error(ErrorCode::kerFailedToReadImageData);
}
Expand Down

0 comments on commit 406d7d7

Please sign in to comment.