Source: phototonic
Version: 2.1-3
Severity: important
Tags: upstream patch ftbfs fixed-upstream

Hi,

phototonic fails to build with the new stable series of the Exiv2
library, i.e. 0.28.x; that version is available in experimental as of
this writing.

The compatibility was fixed upstream with the following two commits:
- 
https://github.com/oferkv/phototonic/commit/7de1014fd5e28cd1578847aa4847e463696938d9
- 
https://github.com/oferkv/phototonic/commit/2d1ab87c5f8a840a3db5c9f478a7d20dfca1ec1f

They do not apply cleanly, as there were lots of changes upstream since
the last release; hence, I applied the changes manually into a single
patch, which is attached, and which maintains the compatibility with
Exiv2 0.27.x. Would you please review this patch, and upload it so that
phototonic rebuilds cleanly once a newer Exiv2 is uploaded to unstable?

Side note: the upstream project was switched to read-only few months
ago, with a note in its README:
  "This project is unmaintained. See Geeqie for an alternative."

Thanks,
-- 
Pino
Author: Andreas Sturmlechner <ast...@gentoo.org>
Author: Pino Toscano <p...@debian.org>
Description: Fix build with exiv2-0.28
 Modelled after the upstream commits:
 - 
https://github.com/oferkv/phototonic/commit/7de1014fd5e28cd1578847aa4847e463696938d9
 - 
https://github.com/oferkv/phototonic/commit/2d1ab87c5f8a840a3db5c9f478a7d20dfca1ec1f
Origin: backport, 
https://github.com/oferkv/phototonic/commit/7de1014fd5e28cd1578847aa4847e463696938d9,
 
https://github.com/oferkv/phototonic/commit/2d1ab87c5f8a840a3db5c9f478a7d20dfca1ec1f
Last-Update: 2024-02-25

--- a/ImageViewer.cpp
+++ b/ImageViewer.cpp
@@ -945,7 +945,11 @@ void ImageViewer::keyMoveEvent(int direc
 }
 
 void ImageViewer::saveImage() {
+#if EXIV2_TEST_VERSION(0,28,0)
+    Exiv2::Image::UniquePtr image;
+#else
     Exiv2::Image::AutoPtr image;
+#endif
     bool exifError = false;
 
     if (newImage) {
@@ -985,8 +989,13 @@ void ImageViewer::saveImage() {
 }
 
 void ImageViewer::saveImageAs() {
+#if EXIV2_TEST_VERSION(0,28,0)
+    Exiv2::Image::UniquePtr exifImage;
+    Exiv2::Image::UniquePtr newExifImage;
+#else
     Exiv2::Image::AutoPtr exifImage;
     Exiv2::Image::AutoPtr newExifImage;
+#endif
     bool exifError = false;
 
     setCursorHiding(false);
--- a/MetadataCache.cpp
+++ b/MetadataCache.cpp
@@ -64,7 +64,11 @@ void MetadataCache::clear() {
 }
 
 bool MetadataCache::loadImageMetadata(const QString &imageFullPath) {
+#if EXIV2_TEST_VERSION(0,28,0)
+    Exiv2::Image::UniquePtr exifImage;
+#else
     Exiv2::Image::AutoPtr exifImage;
+#endif
     QSet<QString> tags;
     long orientation = 0;
 
@@ -78,7 +82,11 @@ bool MetadataCache::loadImageMetadata(co
     try {
         Exiv2::ExifData &exifData = exifImage->exifData();
         if (!exifData.empty()) {
+#if EXIV2_TEST_VERSION(0,28,0)
+            orientation = 
exifData["Exif.Image.Orientation"].value().toUint32();
+#else
             orientation = exifData["Exif.Image.Orientation"].value().toLong();
+#endif
         }
     } catch (Exiv2::Error &error) {
         qWarning() << "Failed to read Exif metadata";
--- a/Phototonic.cpp
+++ b/Phototonic.cpp
@@ -3151,7 +3151,11 @@ void Phototonic::removeMetadata() {
 
     if (ret == MessageBox::Yes) {
         for (int file = 0; file < fileList.size(); ++file) {
+#if EXIV2_TEST_VERSION(0,28,0)
+            Exiv2::Image::UniquePtr image;
+#else
             Exiv2::Image::AutoPtr image;
+#endif
             try {
                 image = 
Exiv2::ImageFactory::open(fileList[file].toStdString());
                 image->clearMetadata();
--- a/Tags.cpp
+++ b/Tags.cpp
@@ -136,7 +136,11 @@ void ImageTags::addTag(QString tagName,
 
 bool ImageTags::writeTagsToImage(QString &imageFileName, QSet<QString> 
&newTags) {
     QSet<QString> imageTags;
+#if EXIV2_TEST_VERSION(0,28,0)
+    Exiv2::Image::UniquePtr exifImage;
+#else
     Exiv2::Image::AutoPtr exifImage;
+#endif
 
     try {
         exifImage = Exiv2::ImageFactory::open(imageFileName.toStdString());
@@ -160,7 +164,11 @@ bool ImageTags::writeTagsToImage(QString
         QSetIterator<QString> newTagsIt(newTags);
         while (newTagsIt.hasNext()) {
             QString tag = newTagsIt.next();
+#if EXIV2_TEST_VERSION(0,28,0)
+            Exiv2::Value::UniquePtr value = 
Exiv2::Value::create(Exiv2::string);
+#else
             Exiv2::Value::AutoPtr value = Exiv2::Value::create(Exiv2::string);
+#endif
             value->read(tag.toStdString());
             Exiv2::IptcKey key("Iptc.Application2.Keywords");
             newIptcData.add(key, value.get());
--- a/ThumbsViewer.cpp
+++ b/ThumbsViewer.cpp
@@ -210,7 +210,11 @@ void ThumbsViewer::updateImageInfoViewer
         infoView->addEntry(key, val);
     }
 
+#if EXIV2_TEST_VERSION(0,28,0)
+    Exiv2::Image::UniquePtr exifImage;
+#else
     Exiv2::Image::AutoPtr exifImage;
+#endif
     try {
         exifImage = Exiv2::ImageFactory::open(imageFullPath.toStdString());
         exifImage->readMetadata();

Reply via email to