summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2023-09-11 15:32:57 +0900
committerMichele Calgaro <[email protected]>2023-09-12 09:58:52 +0900
commit6b1a56ba8668bd33f04e18d884644d18f506b0f9 (patch)
tree3762e816b570a67168fbfe36e35bae4d9c601ebe
parente441ffca7fa7e6e08c77bb5b4063cf3d21d3c38e (diff)
downloadgwenview-6b1a56ba8668bd33f04e18d884644d18f506b0f9.tar.gz
gwenview-6b1a56ba8668bd33f04e18d884644d18f506b0f9.zip
Fix FTBFS when using libexiv2 0.28.0. This resolves issue #7.
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit bf65e56e9e228134f6e151f99afc6370825bae82)
-rw-r--r--src/imageutils/jpegcontent.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/imageutils/jpegcontent.cpp b/src/imageutils/jpegcontent.cpp
index 7efca9a..b4ad947 100644
--- a/src/imageutils/jpegcontent.cpp
+++ b/src/imageutils/jpegcontent.cpp
@@ -264,7 +264,11 @@ bool JPEGContent::loadFromData(const TQByteArray& data) {
if (!d->readSize()) return false;
+#if (EXIV2_TEST_VERSION(0,28,0))
+ Exiv2::Image::UniquePtr image;
+#else
Exiv2::Image::AutoPtr image;
+#endif
try {
image = Exiv2::ImageFactory::open((unsigned char*)data.data(), data.size());
image->readMetadata();
@@ -303,7 +307,11 @@ Orientation JPEGContent::orientation() const {
if (it == d->mExifData.end()) {
return NOT_AVAILABLE;
}
+#if (EXIV2_TEST_VERSION(0,28,0))
+ return Orientation( it->toInt64() );
+#else
return Orientation( it->toLong() );
+#endif
}
@@ -323,7 +331,11 @@ int JPEGContent::dotsPerMeter(const TQString& keyName) const {
if (it == d->mExifData.end()) {
return 0;
}
- int res = it->toLong();
+#if (EXIV2_TEST_VERSION(0,28,0))
+ int64_t res = it->toInt64();
+#else
+ long res = it->toLong();
+#endif
TQString keyVal = "Exif.Image." + keyName;
Exiv2::ExifKey keyResolution(keyVal.ascii());
it = d->mExifData.findKey(keyResolution);
@@ -604,7 +616,11 @@ TQImage JPEGContent::thumbnail() const {
if (!d->mExifData.empty()) {
Exiv2::ExifThumbC thumb(d->mExifData);
Exiv2::DataBuf const thumbnail = thumb.copy();
+#if (EXIV2_TEST_VERSION(0,28,0))
+ image.loadFromData(thumbnail.c_data(), thumbnail.size());
+#else
image.loadFromData(thumbnail.pData_, thumbnail.size_);
+#endif
}
return image;
}
@@ -652,7 +668,11 @@ bool JPEGContent::save(TQFile* file) {
d->mPendingTransformation = false;
}
+#if (EXIV2_TEST_VERSION(0,28,0))
+ Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open((unsigned char*)d->mRawData.data(), d->mRawData.size());
+#else
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((unsigned char*)d->mRawData.data(), d->mRawData.size());
+#endif
// Store Exif info
image->setExifData(d->mExifData);