1 From 0417f60c7e760e1ebc6acd3dc23818b38c3929e7 Mon Sep 17 00:00:00 2001
2 From: Weijia Wang <contact@weijia.wang>
3 Date: Mon, 7 Aug 2023 21:51:30 +0200
4 Subject: [PATCH] Fix build with Exiv2 0.28
7 src/gcm-helper-exiv.cpp | 20 ++++++++++++++++++--
8 1 file changed, 18 insertions(+), 2 deletions(-)
10 diff --git a/src/gcm-helper-exiv.cpp b/src/gcm-helper-exiv.cpp
11 index 7ec69948..23c8b320 100644
12 --- a/src/gcm-helper-exiv.cpp
13 +++ b/src/gcm-helper-exiv.cpp
15 #include <exiv2/image.hpp>
16 #include <exiv2/exif.hpp>
18 +#if EXIV2_MAJOR_VERSION >= 1 || (EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION >= 28)
19 +#define HAVE_EXIV2_0_28
22 #if EXIV2_MAJOR_VERSION >= 1 || (EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION >= 27)
23 #define HAVE_EXIV2_ERROR_CODE
24 #include <exiv2/error.hpp>
27 main (int argc, char* const argv[])
29 +#ifdef HAVE_EXIV2_0_28
30 + Exiv2::Image::UniquePtr image;
32 Exiv2::Image::AutoPtr image;
34 Exiv2::ExifData exifData;
37 @@ -57,7 +65,9 @@ main (int argc, char* const argv[])
41 -#ifdef HAVE_EXIV2_ERROR_CODE
42 +#ifdef HAVE_EXIV2_0_28
43 + throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, "No filename specified");
44 +#elif defined(HAVE_EXIV2_ERROR_CODE)
45 throw Exiv2::Error(Exiv2::kerErrorMessage, "No filename specified");
47 throw Exiv2::Error(1, "No filename specified");
48 @@ -70,7 +80,9 @@ main (int argc, char* const argv[])
49 if (exifData.empty()) {
50 std::string error(argv[1]);
51 error += ": No Exif data found in the file";
52 -#ifdef HAVE_EXIV2_ERROR_CODE
53 +#ifdef HAVE_EXIV2_0_28
54 + throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, error);
55 +#elif defined(HAVE_EXIV2_ERROR_CODE)
56 throw Exiv2::Error(Exiv2::kerErrorMessage, error);
58 throw Exiv2::Error(1, error);
59 @@ -89,7 +101,11 @@ main (int argc, char* const argv[])
60 std::cout << model << "\n";
61 std::cout << make << "\n";
62 std::cout << serial << "\n";
63 +#ifdef HAVE_EXIV2_0_28
64 + } catch (Exiv2::Error& e) {
66 } catch (Exiv2::AnyError& e) {
68 std::cout << "Failed to load: " << e << "\n";
72 2.39.2 (Apple Git-143)