Fix FTBFS when using libexiv2 0.28.0. This resolves issue #7.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit bf65e56e9e)
pull/34/head
Michele Calgaro 1 year ago
parent e441ffca7f
commit 6b1a56ba86
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -264,7 +264,11 @@ bool JPEGContent::loadFromData(const TQByteArray& data) {
if (!d->readSize()) return false; if (!d->readSize()) return false;
#if (EXIV2_TEST_VERSION(0,28,0))
Exiv2::Image::UniquePtr image;
#else
Exiv2::Image::AutoPtr image; Exiv2::Image::AutoPtr image;
#endif
try { try {
image = Exiv2::ImageFactory::open((unsigned char*)data.data(), data.size()); image = Exiv2::ImageFactory::open((unsigned char*)data.data(), data.size());
image->readMetadata(); image->readMetadata();
@ -303,7 +307,11 @@ Orientation JPEGContent::orientation() const {
if (it == d->mExifData.end()) { if (it == d->mExifData.end()) {
return NOT_AVAILABLE; return NOT_AVAILABLE;
} }
#if (EXIV2_TEST_VERSION(0,28,0))
return Orientation( it->toInt64() );
#else
return Orientation( it->toLong() ); return Orientation( it->toLong() );
#endif
} }
@ -323,7 +331,11 @@ int JPEGContent::dotsPerMeter(const TQString& keyName) const {
if (it == d->mExifData.end()) { if (it == d->mExifData.end()) {
return 0; 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; TQString keyVal = "Exif.Image." + keyName;
Exiv2::ExifKey keyResolution(keyVal.ascii()); Exiv2::ExifKey keyResolution(keyVal.ascii());
it = d->mExifData.findKey(keyResolution); it = d->mExifData.findKey(keyResolution);
@ -604,7 +616,11 @@ TQImage JPEGContent::thumbnail() const {
if (!d->mExifData.empty()) { if (!d->mExifData.empty()) {
Exiv2::ExifThumbC thumb(d->mExifData); Exiv2::ExifThumbC thumb(d->mExifData);
Exiv2::DataBuf const thumbnail = thumb.copy(); 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_); image.loadFromData(thumbnail.pData_, thumbnail.size_);
#endif
} }
return image; return image;
} }
@ -652,7 +668,11 @@ bool JPEGContent::save(TQFile* file) {
d->mPendingTransformation = false; 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()); Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((unsigned char*)d->mRawData.data(), d->mRawData.size());
#endif
// Store Exif info // Store Exif info
image->setExifData(d->mExifData); image->setExifData(d->mExifData);

Loading…
Cancel
Save