diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2023-09-03 13:45:47 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2023-09-03 14:18:07 +0200 |
commit | 7707a66f2b6329bed44fb75c9478cebac0888ce5 (patch) | |
tree | c4120eda2d18137b6010db51d02e5fd756527564 /media-gfx/nomacs | |
parent | media-gfx/nomacs: Drop IUSE jpeg (diff) | |
download | gentoo-7707a66f2b6329bed44fb75c9478cebac0888ce5.tar.gz gentoo-7707a66f2b6329bed44fb75c9478cebac0888ce5.tar.bz2 gentoo-7707a66f2b6329bed44fb75c9478cebac0888ce5.zip |
media-gfx/nomacs: Fix build with >=exiv2-0.28
Closes: https://bugs.gentoo.org/906488
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'media-gfx/nomacs')
-rw-r--r-- | media-gfx/nomacs/files/nomacs-3.16.224-exiv2-0.28.patch | 241 | ||||
-rw-r--r-- | media-gfx/nomacs/nomacs-3.16.224-r6.ebuild | 5 |
2 files changed, 245 insertions, 1 deletions
diff --git a/media-gfx/nomacs/files/nomacs-3.16.224-exiv2-0.28.patch b/media-gfx/nomacs/files/nomacs-3.16.224-exiv2-0.28.patch new file mode 100644 index 000000000000..280d7ec59e8b --- /dev/null +++ b/media-gfx/nomacs/files/nomacs-3.16.224-exiv2-0.28.patch @@ -0,0 +1,241 @@ +From 6785f15d9ed05ebc66ee200b3c94451c6c633646 Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner <asturm@gentoo.org> +Date: Sun, 3 Sep 2023 13:30:43 +0200 +Subject: [PATCH] Fix 3.16.224 build with exiv2-0.28 + +Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> +--- + ImageLounge/src/DkCore/DkMetaData.cpp | 59 ++++++++++++++++++--------- + ImageLounge/src/DkCore/DkMetaData.h | 4 +- + 2 files changed, 41 insertions(+), 22 deletions(-) + +diff --git a/ImageLounge/src/DkCore/DkMetaData.cpp b/ImageLounge/src/DkCore/DkMetaData.cpp +index bf1d111e..5eaeebf4 100644 +--- a/ImageLounge/src/DkCore/DkMetaData.cpp ++++ b/ImageLounge/src/DkCore/DkMetaData.cpp +@@ -73,8 +73,12 @@ void DkMetaDataT::readMetaData(const QString& filePath, QSharedPointer<QByteArra + mExifImg = Exiv2::ImageFactory::open(strFilePath); + } + else { ++#if EXIV2_TEST_VERSION(0, 28, 0) ++ mExifImg = Exiv2::ImageFactory::open((const byte *)ba->constData(), ba->size()); ++#else + Exiv2::BasicIo::AutoPtr exifBuffer(new Exiv2::MemIo((const byte*)ba->constData(), ba->size())); + mExifImg = Exiv2::ImageFactory::open(exifBuffer); ++#endif + } + } + catch (...) { +@@ -155,14 +159,18 @@ bool DkMetaDataT::saveMetaData(QSharedPointer<QByteArray>& ba, bool force) { + Exiv2::ExifData &exifData = mExifImg->exifData(); + Exiv2::XmpData &xmpData = mExifImg->xmpData(); + Exiv2::IptcData &iptcData = mExifImg->iptcData(); +- +- Exiv2::Image::AutoPtr exifImgN; ++ std::unique_ptr<Exiv2::Image> exifImgN; ++#if !EXIV2_TEST_VERSION(0, 28, 0) + Exiv2::MemIo::AutoPtr exifMem; ++#endif + + try { +- ++#if EXIV2_TEST_VERSION(0, 28, 0) ++ exifImgN = Exiv2::ImageFactory::open((byte *)ba->data(), ba->size()); ++#else + exifMem = Exiv2::MemIo::AutoPtr(new Exiv2::MemIo((byte*)ba->data(), ba->size())); + exifImgN = Exiv2::ImageFactory::open(exifMem); ++#endif + } + catch (...) { + +@@ -186,8 +194,13 @@ bool DkMetaDataT::saveMetaData(QSharedPointer<QByteArray>& ba, bool force) { + + // now get the data again + Exiv2::DataBuf exifBuf = exifImgN->io().read((long)exifImgN->io().size()); ++#if EXIV2_TEST_VERSION(0, 28, 0) ++ if (!exifBuf.empty()) { ++ QSharedPointer<QByteArray> tmp = QSharedPointer<QByteArray>(new QByteArray((const char *)exifBuf.c_data(), exifBuf.size())); ++#else + if (exifBuf.pData_) { + QSharedPointer<QByteArray> tmp = QSharedPointer<QByteArray>(new QByteArray((const char*)exifBuf.pData_, exifBuf.size_)); ++#endif + + if (tmp->size() > qRound(ba->size()*0.5f)) + ba = tmp; +@@ -197,7 +210,7 @@ bool DkMetaDataT::saveMetaData(QSharedPointer<QByteArray>& ba, bool force) { + else + return false; + +- mExifImg = exifImgN; ++ mExifImg.swap(exifImgN); + mExifState = loaded; + + return true; +@@ -250,7 +263,7 @@ int DkMetaDataT::getOrientationDegree() const { + + if (pos != exifData.end() && pos->count() != 0) { + +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + orientation = (int)pos->toFloat(); + + switch (orientation) { +@@ -315,7 +328,7 @@ int DkMetaDataT::getRating() const { + Exiv2::ExifData::iterator pos = exifData.findKey(key); + + if (pos != exifData.end() && pos->count() != 0) { +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + exifRating = v->toFloat(); + } + } +@@ -327,7 +340,7 @@ int DkMetaDataT::getRating() const { + + //xmp Rating tag + if (pos != xmpData.end() && pos->count() != 0) { +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + xmpRating = v->toFloat(); + } + +@@ -336,7 +349,7 @@ int DkMetaDataT::getRating() const { + key = Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating"); + pos = xmpData.findKey(key); + if (pos != xmpData.end() && pos->count() != 0) { +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + xmpRating = v->toFloat(); + } + } +@@ -399,7 +412,7 @@ QString DkMetaDataT::getNativeExifValue(const QString& key) const { + if (pos->count () < 2000) { // diem: this is about performance - adobe obviously embeds whole images into tiff exiv data + + //qDebug() << "pos count: " << pos->count(); +- //Exiv2::Value::AutoPtr v = pos->getValue(); ++ //std::unique_ptr<Exiv2::Value> v = pos->getValue(); + info = exiv2ToQString(pos->toString()); + + } +@@ -436,7 +449,7 @@ QString DkMetaDataT::getXmpValue(const QString& key) const { + } + + if (pos != xmpData.end() && pos->count() != 0) { +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + info = exiv2ToQString(pos->toString()); + } + } +@@ -478,7 +491,7 @@ QString DkMetaDataT::getExifValue(const QString& key) const { + } + + if (pos != exifData.end() && pos->count() != 0) { +- //Exiv2::Value::AutoPtr v = pos->getValue(); ++ //std::unique_ptr<Exiv2::Value> v = pos->getValue(); + info = exiv2ToQString(pos->toString()); + } + } +@@ -508,7 +521,7 @@ QString DkMetaDataT::getIptcValue(const QString& key) const { + } + + if (pos != iptcData.end() && pos->count() != 0) { +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + info = exiv2ToQString(pos->toString()); + } + } +@@ -653,8 +666,11 @@ QImage DkMetaDataT::getThumbnail() const { + try { + Exiv2::ExifThumb thumb(exifData); + Exiv2::DataBuf buffer = thumb.copy(); +- ++#if EXIV2_TEST_VERSION(0, 28, 0) ++ QByteArray ba = QByteArray((char *)buffer.c_data(), buffer.size()); ++#else + QByteArray ba = QByteArray((char*)buffer.pData_, buffer.size_); ++#endif + qThumb.loadFromData(ba); + } + catch (...) { +@@ -931,9 +947,12 @@ void DkMetaDataT::setThumbnail(QImage thumb) { + + try { + // whipe all exif data of the thumbnail ++#if EXIV2_TEST_VERSION(0, 28, 0) ++ Exiv2::Image::UniquePtr exifImgThumb = Exiv2::ImageFactory::open((const byte *)ba.constData(), ba.size()); ++#else + Exiv2::MemIo::AutoPtr exifBufferThumb(new Exiv2::MemIo((const byte*)ba.constData(), ba.size())); + Exiv2::Image::AutoPtr exifImgThumb = Exiv2::ImageFactory::open(exifBufferThumb); +- ++#endif + if (exifImgThumb.get() != 0 && exifImgThumb->good()) + exifImgThumb->clearExifData(); + } +@@ -1045,11 +1064,11 @@ void DkMetaDataT::setOrientation(int o) { + pos = exifData.findKey(key); + } + +- Exiv2::Value::AutoPtr v = pos->getValue(); ++ std::unique_ptr<Exiv2::Value> v = pos->getValue(); + Exiv2::UShortValue* prv = dynamic_cast<Exiv2::UShortValue*>(v.release()); + if (!prv) return; + +- Exiv2::UShortValue::AutoPtr rv = Exiv2::UShortValue::AutoPtr(prv); ++ std::unique_ptr<Exiv2::UShortValue> rv = std::unique_ptr<Exiv2::UShortValue>(prv); + if (rv->value_.empty()) return; + + orientation = (int) rv->value_[0]; +@@ -1110,7 +1129,7 @@ void DkMetaDataT::setRating(int r) { + exifData["Exif.Image.Rating"] = uint16_t(r); + exifData["Exif.Image.RatingPercent"] = uint16_t(r); + +- Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText); ++ std::unique_ptr<Exiv2::Value> v = Exiv2::Value::create(Exiv2::xmpText); + v->read(sRating); + xmpData.add(Exiv2::XmpKey("Xmp.xmp.Rating"), v.get()); + v->read(sRatingPercent); +@@ -1354,9 +1373,9 @@ DkRotatingRect DkMetaDataT::getXMPRect(const QSize& size) const { + return DkRotatingRect(rr); + } + +-Exiv2::Image::AutoPtr DkMetaDataT::loadSidecar(const QString& filePath) const { ++std::unique_ptr<Exiv2::Image> DkMetaDataT::loadSidecar(const QString& filePath) const { + +- Exiv2::Image::AutoPtr xmpImg; ++ std::unique_ptr<Exiv2::Image> xmpImg; + + //TODO: check if the file type supports xmp + +@@ -1409,7 +1428,7 @@ bool DkMetaDataT::setXMPValue(Exiv2::XmpData& xmpData, QString xmpKey, QString x + setXMPValueSuccessful = true; + } + else { +- Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText); ++ std::unique_ptr<Exiv2::Value> v = Exiv2::Value::create(Exiv2::xmpText); + if (!v->read(xmpValue.toStdString())) { + if (!xmpData.add(Exiv2::XmpKey(key), v.get())) + setXMPValueSuccessful = true; +diff --git a/ImageLounge/src/DkCore/DkMetaData.h b/ImageLounge/src/DkCore/DkMetaData.h +index c1f73c93..183a906a 100644 +--- a/ImageLounge/src/DkCore/DkMetaData.h ++++ b/ImageLounge/src/DkCore/DkMetaData.h +@@ -148,7 +148,7 @@ public: + + protected: + +- Exiv2::Image::AutoPtr loadSidecar(const QString& filePath) const; ++ std::unique_ptr<Exiv2::Image> loadSidecar(const QString& filePath) const; + + enum { + not_loaded, +@@ -157,7 +157,7 @@ protected: + dirty, + }; + +- Exiv2::Image::AutoPtr mExifImg; ++ std::unique_ptr<Exiv2::Image> mExifImg; + QString mFilePath; + QStringList mQtKeys; + QStringList mQtValues; +-- +2.42.0 + diff --git a/media-gfx/nomacs/nomacs-3.16.224-r6.ebuild b/media-gfx/nomacs/nomacs-3.16.224-r6.ebuild index d7020dcb57d8..ddfa980d7e71 100644 --- a/media-gfx/nomacs/nomacs-3.16.224-r6.ebuild +++ b/media-gfx/nomacs/nomacs-3.16.224-r6.ebuild @@ -48,7 +48,10 @@ BDEPEND=" DOCS=( src/changelog.txt ) -PATCHES=( "${FILESDIR}"/${P}-libdir.patch ) +PATCHES=( + "${FILESDIR}"/${P}-libdir.patch + "${FILESDIR}"/${P}-exiv2-0.28.patch # bug 906488 +) src_prepare() { if use plugins ; then |