MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / syncExifWithXmp

Method syncExifWithXmp

src/convert.cpp:1292–1321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1290}
1291
1292void Converter::syncExifWithXmp() {
1293 auto td = xmpData_->findKey(XmpKey("Xmp.tiff.NativeDigest"));
1294 auto ed = xmpData_->findKey(XmpKey("Xmp.exif.NativeDigest"));
1295 if (td != xmpData_->end() && ed != xmpData_->end()) {
1296 if (td->value().toString() == computeExifDigest(true) && ed->value().toString() == computeExifDigest(false)) {
1297 // We have both digests and the values match
1298 // XMP is up-to-date, we should update Exif
1299 setOverwrite(true);
1300 setErase(false);
1301
1302 cnvFromXmp();
1303 writeExifDigest();
1304 return;
1305 }
1306 // We have both digests and the values do not match
1307 // Exif was modified after XMP, we should update XMP
1308 setOverwrite(true);
1309 setErase(false);
1310
1311 cnvToXmp();
1312 writeExifDigest();
1313 return;
1314 }
1315 // We don't have both digests, it is probably the first conversion to XMP
1316 setOverwrite(false); // to be safe
1317 setErase(false);
1318
1319 cnvToXmp();
1320 writeExifDigest();
1321}
1322
1323// *************************************************************************
1324// free functions

Callers 1

syncExifWithXmpFunction · 0.80

Calls 4

XmpKeyClass · 0.85
findKeyMethod · 0.45
endMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected