evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / gn / gnome-color-manager / 0001-Fix-build-with-Exiv2-0.28.patch
blob96688c8d808672014bad9bbec47ef8492a094438
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
6 ---
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
14 @@ -22,6 +22,10 @@
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
20 +#endif
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>
25 @@ -33,7 +37,11 @@
26 int
27 main (int argc, char* const argv[])
29 +#ifdef HAVE_EXIV2_0_28
30 + Exiv2::Image::UniquePtr image;
31 +#else
32 Exiv2::Image::AutoPtr image;
33 +#endif
34 Exiv2::ExifData exifData;
35 std::string filename;
36 std::string make;
37 @@ -57,7 +65,9 @@ main (int argc, char* const argv[])
38 if (argc == 2)
39 filename = argv[1];
40 if (filename.empty())
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");
46 #else
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);
57 #else
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) {
65 +#else
66 } catch (Exiv2::AnyError& e) {
67 +#endif
68 std::cout << "Failed to load: " << e << "\n";
69 retval = -1;
71 --
72 2.39.2 (Apple Git-143)