Support Exiv2 >= v0.28.0

The various Datum classes no longer have the toLong method and must be
replaced with toInt64.
ErrorCode is an enum class instead of an enum.
Error classes are reduced to Exiv2::Error.
This commit is contained in:
Lawrence Lee
2023-05-13 15:31:14 -07:00
parent e4690e73a3
commit 0ac49e4d9a
3 changed files with 83 additions and 33 deletions

View File

@@ -86,6 +86,19 @@ FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname)
return f;
}
template <typename Iterator, typename Integer = std::size_t>
auto to_long(const Iterator &iter, Integer n = Integer{0}) -> decltype(
#if EXIV2_TEST_VERSION(0,28,0)
iter->toInt64()
) {
return iter->toInt64(n);
#else
iter->toLong()
) {
return iter->toLong(n);
#endif
}
}
void ImageIO::setMetadata(Exiv2Metadata info)
@@ -1185,7 +1198,7 @@ int ImageIO::saveTIFF (
}
it = exif.findKey(Exiv2::ExifKey("Exif.Image.ResolutionUnit"));
if (it != exif.end()) {
res_unit = it->toLong();
res_unit = to_long(it);
}
}
TIFFSetField(out, TIFFTAG_XRESOLUTION, x_res);