Source: lomiri-gallery-app
Version: 3.0.2-1
Severity: important
Tags: upstream patch ftbfs
X-Debbugs-Cc: sunwea...@debian.org
Control: forwarded -1 
https://gitlab.com/ubports/development/apps/lomiri-gallery-app/-/issues/123

Hi,

lomiri-gallery-app 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.

I reported this upstream a while ago [1], and provided also a MR fixing
this [2], which was already merged. I extracted the patch/commit from
it, and verified that it builds fine with both Exiv2 0.27 and Exiv2
0.28; you can find it attached to this bug. Would you review this patch,
and upload it so that lomiri-gallery-app rebuilds cleanly once a newer
Exiv2 is uploaded to unstable?

An alternative may be a new upstream release, which would be even
nicer :)

[1] https://gitlab.com/ubports/development/apps/lomiri-gallery-app/-/issues/123
[2] 
https://gitlab.com/ubports/development/apps/lomiri-gallery-app/-/merge_requests/144

Thanks,
-- 
Pino
>From be63c6d3497ece568f1d8a3629e6e48006129e4f Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.p...@tiscali.it>
Date: Thu, 14 Mar 2024 07:16:37 +0100
Subject: [PATCH] Support Exiv2 0.28+

Use the new types for the image pointer and exception class, and the
different method for the EXIF_ORIENTATION_KEY exif metadata, as
available in the new Exiv2 version, keeping the support for older
versions.

Fixes #123
---
 src/photo/photo-metadata.cpp | 16 ++++++++++++++++
 src/photo/photo-metadata.h   |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/src/photo/photo-metadata.cpp b/src/photo/photo-metadata.cpp
index ac4a0b05..dd6e1907 100644
--- a/src/photo/photo-metadata.cpp
+++ b/src/photo/photo-metadata.cpp
@@ -134,7 +134,11 @@ PhotoMetadata* PhotoMetadata::fromFile(const char* 
filepath)
             result->m_keysPresent.insert(QString(i->key().c_str()));
 
         return result;
+#if EXIV2_TEST_VERSION(0,28,0)
+    } catch (Exiv2::Error& e) {
+#else
     } catch (Exiv2::AnyError& e) {
+#endif
         qDebug("Error loading image metadata: %s", e.what());
         delete result;
         return NULL;
@@ -165,7 +169,11 @@ Orientation PhotoMetadata::orientation() const
     if (m_keysPresent.find(EXIF_ORIENTATION_KEY) == m_keysPresent.end())
         return DEFAULT_ORIENTATION;
 
+#if EXIV2_TEST_VERSION(0,28,0)
+    uint32_t orientation_code = exif_data[EXIF_ORIENTATION_KEY].toUint32();
+#else
     long orientation_code = exif_data[EXIF_ORIENTATION_KEY].toLong();
+#endif
     if (orientation_code < MIN_ORIENTATION || orientation_code > 
MAX_ORIENTATION)
         return DEFAULT_ORIENTATION;
 
@@ -244,7 +252,11 @@ void PhotoMetadata::setDateTimeDigitized(const QDateTime& 
digitized)
         if (!m_keysPresent.contains(EXIF_DATETIMEDIGITIZED_KEY))
             m_keysPresent.insert(EXIF_DATETIMEDIGITIZED_KEY);
  
+#if EXIV2_TEST_VERSION(0,28,0)
+    } catch (Exiv2::Error& e) {
+#else
     } catch (Exiv2::AnyError& e) {
+#endif
         qDebug("Do not set DateTimeDigitized, error reading image metadata; 
%s", e.what());
         return;
     }
@@ -259,7 +271,11 @@ bool PhotoMetadata::save() const
     try {
         m_image->writeMetadata();
         return true;
+#if EXIV2_TEST_VERSION(0,28,0)
+    } catch (Exiv2::Error& e) {
+#else
     } catch (Exiv2::AnyError& e) {
+#endif
         return false;
     }
 }
diff --git a/src/photo/photo-metadata.h b/src/photo/photo-metadata.h
index a2687b8d..daf2ee49 100644
--- a/src/photo/photo-metadata.h
+++ b/src/photo/photo-metadata.h
@@ -59,7 +59,11 @@ public:
 private:
     PhotoMetadata(const char* filepath);
     
+#if EXIV2_TEST_VERSION(0,28,0)
+    Exiv2::Image::UniquePtr m_image;
+#else
     Exiv2::Image::AutoPtr m_image;
+#endif
     QSet<QString> m_keysPresent;
     QFileInfo m_fileSourceInfo;
 };
-- 
2.43.0

Reply via email to