Mercurial > hg > forks > geeqie
comparison src/exiv2.cc @ 2888:f89d0a76c45b
fix build against exiv2-0.27.x
fixes #654
author | Rasmus Thomsen <rasmus.thomsen@protonmail.com> |
---|---|
date | Wed, 02 Jan 2019 01:04:45 +0100 |
parents | 4b8e42e226da |
children | f02e6b7c1336 |
comparison
equal
deleted
inserted
replaced
2860:b20a96b979a3 | 2888:f89d0a76c45b |
---|---|
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 | 22 |
23 #ifdef HAVE_EXIV2 | 23 #ifdef HAVE_EXIV2 |
24 | 24 |
25 #include <exiv2/image.hpp> | 25 // Don't include the <exiv2/version.hpp> file directly |
26 #include <exiv2/exif.hpp> | 26 // Early Exiv2 versions didn't have version.hpp and the macros. |
27 #include <exiv2/exiv2.hpp> | |
27 #include <iostream> | 28 #include <iostream> |
28 #include <string> | 29 #include <string> |
29 | 30 |
30 // EXIV2_TEST_VERSION is defined in Exiv2 0.15 and newer. | 31 // EXIV2_TEST_VERSION is defined in Exiv2 0.15 and newer. |
32 #ifdef EXIV2_VERSION | |
31 #ifndef EXIV2_TEST_VERSION | 33 #ifndef EXIV2_TEST_VERSION |
32 # define EXIV2_TEST_VERSION(major,minor,patch) \ | 34 #define EXIV2_TEST_VERSION(major,minor,patch) \ |
33 ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) ) | 35 ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) ) |
34 #endif | 36 #endif |
35 | 37 #else |
38 #define EXIV2_TEST_VERSION(major,minor,patch) (false) | |
39 #endif | |
40 | |
41 #if EXIV2_TEST_VERSION(0,27,0) | |
42 #define HAVE_EXIV2_ERROR_CODE | |
43 #endif | |
36 | 44 |
37 #include <sys/types.h> | 45 #include <sys/types.h> |
38 #include <sys/stat.h> | 46 #include <sys/stat.h> |
39 #include <unistd.h> | 47 #include <unistd.h> |
40 #include <fcntl.h> | 48 #include <fcntl.h> |
41 #include <sys/mman.h> | 49 #include <sys/mman.h> |
42 | 50 |
43 #if !EXIV2_TEST_VERSION(0,17,90) | 51 #if EXIV2_TEST_VERSION(0,27,0) |
44 #include <exiv2/tiffparser.hpp> | 52 #define EXV_PACKAGE "exiv2" |
45 #include <exiv2/tiffcomposite.hpp> | |
46 #include <exiv2/tiffvisitor.hpp> | |
47 #include <exiv2/tiffimage.hpp> | |
48 #include <exiv2/cr2image.hpp> | |
49 #include <exiv2/crwimage.hpp> | |
50 #if EXIV2_TEST_VERSION(0,16,0) | |
51 #include <exiv2/orfimage.hpp> | |
52 #endif | |
53 #if EXIV2_TEST_VERSION(0,13,0) | |
54 #include <exiv2/rafimage.hpp> | |
55 #endif | |
56 #include <exiv2/futils.hpp> | |
57 #else | |
58 #include <exiv2/preview.hpp> | |
59 #endif | |
60 | |
61 #if EXIV2_TEST_VERSION(0,17,0) | |
62 #include <exiv2/convert.hpp> | |
63 #include <exiv2/xmpsidecar.hpp> | |
64 #endif | 53 #endif |
65 | 54 |
66 extern "C" { | 55 extern "C" { |
67 #include <glib.h> | 56 #include <glib.h> |
68 | 57 |
372 | 361 |
373 copyXmpToExif(xmpData_, exifData_); | 362 copyXmpToExif(xmpData_, exifData_); |
374 #endif | 363 #endif |
375 Exiv2::Image *image = imageData_->image(); | 364 Exiv2::Image *image = imageData_->image(); |
376 | 365 |
366 #ifdef HAVE_EXIV2_ERROR_CODE | |
367 if (!image) throw Exiv2::Error(Exiv2::ErrorCode::kerInputDataReadFailed); | |
368 #else | |
377 if (!image) throw Exiv2::Error(21); | 369 if (!image) throw Exiv2::Error(21); |
370 #endif | |
378 image->setExifData(exifData_); | 371 image->setExifData(exifData_); |
379 image->setIptcData(iptcData_); | 372 image->setIptcData(iptcData_); |
380 #if EXIV2_TEST_VERSION(0,16,0) | 373 #if EXIV2_TEST_VERSION(0,16,0) |
381 image->setXmpData(xmpData_); | 374 image->setXmpData(xmpData_); |
382 #endif | 375 #endif |
392 g_free(pathl); | 385 g_free(pathl); |
393 | 386 |
394 sidecar->setXmpData(xmpData_); | 387 sidecar->setXmpData(xmpData_); |
395 sidecar->writeMetadata(); | 388 sidecar->writeMetadata(); |
396 #else | 389 #else |
390 #ifdef HAVE_EXIV2_ERROR_CODE | |
391 throw Exiv2::Error(Exiv2::ErrorCode::kerNotAnImage, "xmp"); | |
392 #else | |
397 throw Exiv2::Error(3, "xmp"); | 393 throw Exiv2::Error(3, "xmp"); |
394 #endif | |
398 #endif | 395 #endif |
399 } | 396 } |
400 } | 397 } |
401 | 398 |
402 virtual Exiv2::Image *image() | 399 virtual Exiv2::Image *image() |