File Fix-build-with-exiv2_0.28.patch of Package krename4

From e7dd767a9a1068ee1fe1502c4d619b57d3b12add Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Fri, 26 May 2023 23:23:10 +0200
Subject: [PATCH] Fix build with >=exiv2-0.28, raise minimum to 0.27

- enables use of EXIV2_TEST_VERSION macro
- exiv2 headers cleanup

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 CMakeLists.txt         |  6 +-----
 config-krename.h.cmake |  3 ---
 src/exiv2plugin.cpp    | 17 +++++------------
 3 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bda8ac..72e7297 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,12 +29,9 @@
 ENDIF(TAGLIB_FOUND)
 
 # Find exiv2
-set(EXIV2_MIN_VERSION "0.13") # AccessMode was added in 0.13
+set(EXIV2_MIN_VERSION "0.27") # EXIV2_TEST_VERSION was added in 0.27
 macro_optional_find_package(Exiv2)
 macro_log_feature(EXIV2_FOUND "Exiv2" "A library to access image metadata" "http://www.exiv2.org" FALSE "")
-if (NOT EXIV2_VERSION VERSION_LESS "0.27")
-    set(HAVE_LIBEXIV2_0_27 TRUE)
-endif()
 
 IF(EXIV2_FOUND)
   ADD_DEFINITIONS( -DWITH_EXIV2 )
diff --git a/config-krename.h.cmake b/config-krename.h.cmake
index 76c3d30..862e40b 100644
--- a/config-krename.h.cmake
+++ b/config-krename.h.cmake
@@ -6,9 +6,6 @@
 /* have Exiv2 */
 #define HAVE_EXIV2 ${EXIV2_FOUND}
 
-/* Defined if we have libexiv2 >= 0.27 */
-#cmakedefine HAVE_LIBEXIV2_0_27
-
 /* have PoDoFo */
 #define HAVE_PODOFO 1
 
diff --git a/src/exiv2plugin.cpp b/src/exiv2plugin.cpp
index 5694d8c..25e8869 100644
--- a/src/exiv2plugin.cpp
+++ b/src/exiv2plugin.cpp
@@ -22,16 +22,7 @@
 
 #include <klocale.h>
 
-#include <exiv2/error.hpp>
-#include <exiv2/exif.hpp>
-#include <exiv2/image.hpp>
-#include <exiv2/iptc.hpp>
-#ifdef HAVE_LIBEXIV2_0_27
-    #include <exiv2/xmp_exiv2.hpp>
-#else
-    #include <exiv2/xmp.hpp>
-#endif
-#include <exiv2/tags.hpp>
+#include <exiv2/exiv2.hpp>
 
 #include "batchrenamer.h"
 #include "tokenhelpdialog.h"
@@ -398,7 +387,11 @@ QString Exiv2Plugin::processFile(BatchRenamer* b, int index, const QString & fil
 
     try 
     {
+#if EXIV2_TEST_VERSION(0,28,0)
+        Image::UniquePtr image = Exiv2::ImageFactory::open( strFilename );
+#else
         Image::AutoPtr image = Exiv2::ImageFactory::open( strFilename );
+#endif
         if( image.get() != NULL && image->good() )
         {
             image->readMetadata();
-- 
GitLab

openSUSE Build Service is sponsored by