]>
Commit | Line | Data |
---|---|---|
8bd363b5 JR |
1 | X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=blobdiff_plain;f=src%2Fexiv2.cc;h=2992740c497825f790d6be617f04f4729df7f8cd;hp=b3c806572b87998d6d047a12ac69520ca58760ab;hb=d309cc7c217eeb187ce59b7d5c9145112048182b;hpb=eedf0ad8550ad5ed95a48d9770669b80bde66b5d |
2 | ||
3 | diff --git a/src/exiv2.cc b/src/exiv2.cc | |
4 | index b3c80657..2992740c 100644 | |
5 | --- a/src/exiv2.cc | |
6 | +++ b/src/exiv2.cc | |
7 | @@ -22,17 +22,25 @@ | |
8 | ||
9 | #ifdef HAVE_EXIV2 | |
10 | ||
11 | -#include <exiv2/image.hpp> | |
12 | -#include <exiv2/exif.hpp> | |
13 | +// Don't include the <exiv2/version.hpp> file directly | |
14 | +// Early Exiv2 versions didn't have version.hpp and the macros. | |
15 | +#include <exiv2/exiv2.hpp> | |
16 | #include <iostream> | |
17 | #include <string> | |
18 | ||
19 | // EXIV2_TEST_VERSION is defined in Exiv2 0.15 and newer. | |
20 | +#ifdef EXIV2_VERSION | |
21 | #ifndef EXIV2_TEST_VERSION | |
22 | -# define EXIV2_TEST_VERSION(major,minor,patch) \ | |
23 | +#define EXIV2_TEST_VERSION(major,minor,patch) \ | |
24 | ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) ) | |
25 | #endif | |
26 | +#else | |
27 | +#define EXIV2_TEST_VERSION(major,minor,patch) (false) | |
28 | +#endif | |
29 | ||
30 | +#if EXIV2_TEST_VERSION(0,27,0) | |
31 | +#define HAVE_EXIV2_ERROR_CODE | |
32 | +#endif | |
33 | ||
34 | #include <sys/types.h> | |
35 | #include <sys/stat.h> | |
36 | @@ -40,27 +48,8 @@ | |
37 | #include <fcntl.h> | |
38 | #include <sys/mman.h> | |
39 | ||
40 | -#if !EXIV2_TEST_VERSION(0,17,90) | |
41 | -#include <exiv2/tiffparser.hpp> | |
42 | -#include <exiv2/tiffcomposite.hpp> | |
43 | -#include <exiv2/tiffvisitor.hpp> | |
44 | -#include <exiv2/tiffimage.hpp> | |
45 | -#include <exiv2/cr2image.hpp> | |
46 | -#include <exiv2/crwimage.hpp> | |
47 | -#if EXIV2_TEST_VERSION(0,16,0) | |
48 | -#include <exiv2/orfimage.hpp> | |
49 | -#endif | |
50 | -#if EXIV2_TEST_VERSION(0,13,0) | |
51 | -#include <exiv2/rafimage.hpp> | |
52 | -#endif | |
53 | -#include <exiv2/futils.hpp> | |
54 | -#else | |
55 | -#include <exiv2/preview.hpp> | |
56 | -#endif | |
57 | - | |
58 | -#if EXIV2_TEST_VERSION(0,17,0) | |
59 | -#include <exiv2/convert.hpp> | |
60 | -#include <exiv2/xmpsidecar.hpp> | |
61 | +#if EXIV2_TEST_VERSION(0,27,0) | |
62 | +#define EXV_PACKAGE "exiv2" | |
63 | #endif | |
64 | ||
65 | extern "C" { | |
66 | @@ -374,7 +363,11 @@ public: | |
67 | #endif | |
68 | Exiv2::Image *image = imageData_->image(); | |
69 | ||
70 | +#ifdef HAVE_EXIV2_ERROR_CODE | |
71 | + if (!image) throw Exiv2::Error(Exiv2::ErrorCode::kerInputDataReadFailed); | |
72 | +#else | |
73 | if (!image) Exiv2::Error(21); | |
74 | +#endif | |
75 | image->setExifData(exifData_); | |
76 | image->setIptcData(iptcData_); | |
77 | #if EXIV2_TEST_VERSION(0,16,0) | |
78 | @@ -394,8 +387,12 @@ public: | |
79 | sidecar->setXmpData(xmpData_); | |
80 | sidecar->writeMetadata(); | |
81 | #else | |
82 | +#ifdef HAVE_EXIV2_ERROR_CODE | |
83 | + throw Exiv2::Error(Exiv2::ErrorCode::kerNotAnImage, "xmp"); | |
84 | +#else | |
85 | throw Exiv2::Error(3, "xmp"); | |
86 | #endif | |
87 | +#endif | |
88 | } | |
89 | } | |
90 |