public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/nomacs/files/, media-gfx/nomacs/
Date: Sun,  3 Sep 2023 12:19:41 +0000 (UTC)	[thread overview]
Message-ID: <1693743487.7707a66f2b6329bed44fb75c9478cebac0888ce5.asturm@gentoo> (raw)

commit:     7707a66f2b6329bed44fb75c9478cebac0888ce5
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  3 11:45:47 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Sep  3 12:18:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7707a66f

media-gfx/nomacs: Fix build with >=exiv2-0.28

Closes: https://bugs.gentoo.org/906488
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../nomacs/files/nomacs-3.16.224-exiv2-0.28.patch  | 241 +++++++++++++++++++++
 media-gfx/nomacs/nomacs-3.16.224-r6.ebuild         |   5 +-
 2 files changed, 245 insertions(+), 1 deletion(-)

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


             reply	other threads:[~2023-09-03 12:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03 12:19 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-07-18  8:41 [gentoo-commits] repo/gentoo:master commit in: media-gfx/nomacs/files/, media-gfx/nomacs/ Andreas Sturmlechner
2018-10-11 11:44 Michael Palimaka
2018-04-13 20:00 Andreas Sturmlechner
2017-08-30 13:40 Michael Palimaka
2016-10-23 16:59 Michael Palimaka
2016-01-14 16:04 Michael Palimaka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1693743487.7707a66f2b6329bed44fb75c9478cebac0888ce5.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox