View | Details | Raw Unified | Return to bug 240191
Collapse All | Expand All

(-)files/patch-git_f9213c (-93 lines)
Lines 1-93 Link Here
1
From f9213c8ad796cf4571b2606435c32753040ec645 Mon Sep 17 00:00:00 2001
2
From: Rasmus Thomsen <Rasmus.thomsen@protonmail.com>
3
Date: Sun, 6 Jan 2019 17:40:31 +0000
4
Subject: [PATCH] Fix #654, 655: fix build against exiv2-0.27.x
5
6
https://github.com/BestImageViewer/geeqie/pull/655
7
--- src/exiv2.cc.orig	2017-12-31 12:31:21 UTC
8
+++ src/exiv2.cc
9
@@ -22,17 +22,25 @@
10
 
11
 #ifdef HAVE_EXIV2
12
 
13
-#include <exiv2/image.hpp>
14
-#include <exiv2/exif.hpp>
15
+// Don't include the <exiv2/version.hpp> file directly
16
+// Early Exiv2 versions didn't have version.hpp and the macros.
17
+#include <exiv2/exiv2.hpp>
18
 #include <iostream>
19
 #include <string>
20
 
21
 // EXIV2_TEST_VERSION is defined in Exiv2 0.15 and newer.
22
+#ifdef EXIV2_VERSION
23
 #ifndef EXIV2_TEST_VERSION
24
-# define EXIV2_TEST_VERSION(major,minor,patch) \
25
+#define EXIV2_TEST_VERSION(major,minor,patch) \
26
 	( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) )
27
 #endif
28
+#else
29
+#define EXIV2_TEST_VERSION(major,minor,patch) (false)
30
+#endif
31
 
32
+#if EXIV2_TEST_VERSION(0,27,0)
33
+#define HAVE_EXIV2_ERROR_CODE
34
+#endif
35
 
36
 #include <sys/types.h>
37
 #include <sys/stat.h>
38
@@ -40,29 +48,10 @@
39
 #include <fcntl.h>
40
 #include <sys/mman.h>
41
 
42
-#if !EXIV2_TEST_VERSION(0,17,90)
43
-#include <exiv2/tiffparser.hpp>
44
-#include <exiv2/tiffcomposite.hpp>
45
-#include <exiv2/tiffvisitor.hpp>
46
-#include <exiv2/tiffimage.hpp>
47
-#include <exiv2/cr2image.hpp>
48
-#include <exiv2/crwimage.hpp>
49
-#if EXIV2_TEST_VERSION(0,16,0)
50
-#include <exiv2/orfimage.hpp>
51
+#if EXIV2_TEST_VERSION(0,27,0)
52
+#define EXV_PACKAGE "exiv2"
53
 #endif
54
-#if EXIV2_TEST_VERSION(0,13,0)
55
-#include <exiv2/rafimage.hpp>
56
-#endif
57
-#include <exiv2/futils.hpp>
58
-#else
59
-#include <exiv2/preview.hpp>
60
-#endif
61
 
62
-#if EXIV2_TEST_VERSION(0,17,0)
63
-#include <exiv2/convert.hpp>
64
-#include <exiv2/xmpsidecar.hpp>
65
-#endif
66
-
67
 extern "C" {
68
 #include <glib.h>
69
 
70
@@ -374,7 +363,11 @@ struct _ExifDataProcessed : public _ExifData (public)
71
 #endif
72
 			Exiv2::Image *image = imageData_->image();
73
 
74
+#ifdef HAVE_EXIV2_ERROR_CODE
75
+			if (!image) throw Exiv2::Error(Exiv2::ErrorCode::kerInputDataReadFailed);
76
+#else
77
 			if (!image) Exiv2::Error(21);
78
+#endif
79
 			image->setExifData(exifData_);
80
 			image->setIptcData(iptcData_);
81
 #if EXIV2_TEST_VERSION(0,16,0)
82
@@ -394,7 +387,11 @@ struct _ExifDataProcessed : public _ExifData (public)
83
 			sidecar->setXmpData(xmpData_);
84
 			sidecar->writeMetadata();
85
 #else
86
+#ifdef HAVE_EXIV2_ERROR_CODE
87
+			throw Exiv2::Error(Exiv2::ErrorCode::kerNotAnImage, "xmp");
88
+#else
89
 			throw Exiv2::Error(3, "xmp");
90
+#endif
91
 #endif
92
 			}
93
 	}

Return to bug 240191