Added
Link Here
|
0 |
- |
1 |
From e7bf1f0d299c4f7c6529438059d14e7a99907066 Mon Sep 17 00:00:00 2001 |
|
|
2 |
From: Antonio Rojas <arojas@archlinux.org> |
3 |
Date: Sun, 4 Jun 2023 18:04:59 +0200 |
4 |
Subject: [PATCH] Fix build with exiv2 0.28 |
5 |
|
6 |
--- |
7 |
plugins/impex/jpeg/kis_jpeg_converter.cc | 8 ++ |
8 |
plugins/impex/tiff/kis_tiff_export.cc | 9 +++ |
9 |
plugins/impex/tiff/kis_tiff_import.cc | 9 +++ |
10 |
plugins/metadata/common/KisExiv2IODevice.cpp | 36 +++++++++ |
11 |
plugins/metadata/common/KisExiv2IODevice.h | 23 ++++++ |
12 |
plugins/metadata/common/kis_exiv2_common.h | 20 +++++ |
13 |
plugins/metadata/exif/kis_exif_io.cpp | 79 +++++++++++++++++++- |
14 |
plugins/metadata/iptc/kis_iptc_io.cpp | 12 +++ |
15 |
plugins/metadata/xmp/kis_xmp_io.cpp | 9 ++- |
16 |
9 files changed, 200 insertions(+), 5 deletions(-) |
17 |
|
18 |
diff --git ./plugins/impex/jpeg/kis_jpeg_converter.cc ./plugins/impex/jpeg/kis_jpeg_converter.cc |
19 |
index 3364ae6eda7..476151e1234 100644 |
20 |
--- ./plugins/impex/jpeg/kis_jpeg_converter.cc |
21 |
+++ ./plugins/impex/jpeg/kis_jpeg_converter.cc |
22 |
@@ -20,6 +20,10 @@ extern "C" { |
23 |
} |
24 |
|
25 |
#include <exiv2/jpgimage.hpp> |
26 |
+#include <exiv2/version.hpp> |
27 |
+#if EXIV2_TEST_VERSION(0,28,0) |
28 |
+#include <exiv2/photoshop.hpp> |
29 |
+#endif |
30 |
|
31 |
#include <QFile> |
32 |
#include <QBuffer> |
33 |
@@ -376,7 +380,11 @@ KisImportExportErrorCode KisJPEGConverter::decode(QIODevice *io) |
34 |
uint32_t sizeHdr = 0; |
35 |
// Find actual Iptc data within the APP13 segment |
36 |
if (!Exiv2::Photoshop::locateIptcIrb((Exiv2::byte*)(marker->data + 14), |
37 |
+#if EXIV2_TEST_VERSION(0,28,0) |
38 |
+ marker->data_length - 14, &record, sizeHdr, sizeIptc)) { |
39 |
+#else |
40 |
marker->data_length - 14, &record, &sizeHdr, &sizeIptc)) { |
41 |
+#endif |
42 |
if (sizeIptc) { |
43 |
// Decode the IPTC data |
44 |
QByteArray byteArray((const char*)(record + sizeHdr), sizeIptc); |
45 |
diff --git ./plugins/impex/tiff/kis_tiff_export.cc ./plugins/impex/tiff/kis_tiff_export.cc |
46 |
index 8c8f71d7c08..69cbda63033 100644 |
47 |
--- ./plugins/impex/tiff/kis_tiff_export.cc |
48 |
+++ ./plugins/impex/tiff/kis_tiff_export.cc |
49 |
@@ -206,7 +206,11 @@ KisImportExportErrorCode KisTIFFExport::convert(KisDocument *document, QIODevice |
50 |
try { |
51 |
KisExiv2IODevice::ptr_type basicIoDevice(new KisExiv2IODevice(filename())); |
52 |
|
53 |
+#if EXIV2_TEST_VERSION(0,28,0) |
54 |
+ const std::unique_ptr<Exiv2::Image> img = Exiv2::ImageFactory::open(std::move(basicIoDevice)); |
55 |
+#else |
56 |
const std::unique_ptr<Exiv2::Image> img(Exiv2::ImageFactory::open(basicIoDevice).release()); |
57 |
+#endif |
58 |
|
59 |
img->readMetadata(); |
60 |
|
61 |
@@ -241,9 +245,14 @@ KisImportExportErrorCode KisTIFFExport::convert(KisDocument *document, QIODevice |
62 |
} |
63 |
// Write metadata |
64 |
img->writeMetadata(); |
65 |
+#if EXIV2_TEST_VERSION(0,28,0) |
66 |
+ } catch (Exiv2::Error &e) { |
67 |
+ errFile << "Failed injecting TIFF metadata:" << Exiv2::Error(e.code()).what(); |
68 |
+#else |
69 |
} catch (Exiv2::AnyError &e) { |
70 |
errFile << "Failed injecting TIFF metadata:" << e.code() |
71 |
<< e.what(); |
72 |
+#endif |
73 |
} |
74 |
} |
75 |
return ImportExportCodes::OK; |
76 |
diff --git ./plugins/impex/tiff/kis_tiff_import.cc ./plugins/impex/tiff/kis_tiff_import.cc |
77 |
index e6d408e923b..5be62bbbf51 100644 |
78 |
--- ./plugins/impex/tiff/kis_tiff_import.cc |
79 |
+++ ./plugins/impex/tiff/kis_tiff_import.cc |
80 |
@@ -1842,7 +1842,11 @@ KisTIFFImport::convert(KisDocument *document, |
81 |
try { |
82 |
KisExiv2IODevice::ptr_type basicIoDevice(new KisExiv2IODevice(filename())); |
83 |
|
84 |
+#if EXIV2_TEST_VERSION(0,28,0) |
85 |
+ const std::unique_ptr<Exiv2::Image> readImg = Exiv2::ImageFactory::open(std::move(basicIoDevice)); |
86 |
+#else |
87 |
const std::unique_ptr<Exiv2::Image> readImg(Exiv2::ImageFactory::open(basicIoDevice).release()); |
88 |
+#endif |
89 |
|
90 |
readImg->readMetadata(); |
91 |
|
92 |
@@ -1910,8 +1914,13 @@ KisTIFFImport::convert(KisDocument *document, |
93 |
|
94 |
// Inject the data as any other IOBackend |
95 |
io->loadFrom(layer->metaData(), &ioDevice); |
96 |
+#if EXIV2_TEST_VERSION(0,28,0) |
97 |
+ } catch (Exiv2::Error &e) { |
98 |
+ errFile << "Failed metadata import:" << Exiv2::Error(e.code()).what(); |
99 |
+#else |
100 |
} catch (Exiv2::AnyError &e) { |
101 |
errFile << "Failed metadata import:" << e.code() << e.what(); |
102 |
+#endif |
103 |
} |
104 |
} |
105 |
|
106 |
diff --git ./plugins/metadata/common/KisExiv2IODevice.cpp ./plugins/metadata/common/KisExiv2IODevice.cpp |
107 |
index c62e2d15ae9..bf5cdc2bd63 100644 |
108 |
--- ./plugins/metadata/common/KisExiv2IODevice.cpp |
109 |
+++ ./plugins/metadata/common/KisExiv2IODevice.cpp |
110 |
@@ -39,7 +39,11 @@ int KisExiv2IODevice::close() |
111 |
return 0; |
112 |
} |
113 |
|
114 |
+#if EXIV2_TEST_VERSION(0,28,0) |
115 |
+size_t KisExiv2IODevice::write(const Exiv2::byte *data, size_t wcount) |
116 |
+#else |
117 |
long KisExiv2IODevice::write(const Exiv2::byte *data, long wcount) |
118 |
+#endif |
119 |
{ |
120 |
if (!m_file.isWritable()) { |
121 |
qWarning() << "KisExiv2IODevice: File not open for writing."; |
122 |
@@ -53,7 +57,11 @@ long KisExiv2IODevice::write(const Exiv2::byte *data, long wcount) |
123 |
return 0; |
124 |
} |
125 |
|
126 |
+#if EXIV2_TEST_VERSION(0,28,0) |
127 |
+size_t KisExiv2IODevice::write(Exiv2::BasicIo &src) |
128 |
+#else |
129 |
long KisExiv2IODevice::write(Exiv2::BasicIo &src) |
130 |
+#endif |
131 |
{ |
132 |
if (static_cast<BasicIo *>(this) == &src) { |
133 |
return 0; |
134 |
@@ -88,15 +96,28 @@ int KisExiv2IODevice::putb(Exiv2::byte data) |
135 |
} |
136 |
} |
137 |
|
138 |
+#if EXIV2_TEST_VERSION(0,28,0) |
139 |
+Exiv2::DataBuf KisExiv2IODevice::read(size_t rcount) |
140 |
+#else |
141 |
Exiv2::DataBuf KisExiv2IODevice::read(long rcount) |
142 |
+#endif |
143 |
{ |
144 |
Exiv2::DataBuf buf(rcount); |
145 |
+#if EXIV2_TEST_VERSION(0,28,0) |
146 |
+ const size_t readCount = read(buf.data(), buf.size()); |
147 |
+ buf.resize(readCount); |
148 |
+#else |
149 |
const long readCount = read(buf.pData_, buf.size_); |
150 |
buf.size_ = readCount; |
151 |
+#endif |
152 |
return buf; |
153 |
} |
154 |
|
155 |
+#if EXIV2_TEST_VERSION(0,28,0) |
156 |
+size_t KisExiv2IODevice::read(Exiv2::byte *buf, size_t rcount) |
157 |
+#else |
158 |
long KisExiv2IODevice::read(Exiv2::byte *buf, long rcount) |
159 |
+#endif |
160 |
{ |
161 |
const qint64 bytesRead = m_file.read(reinterpret_cast<char *>(buf), rcount); |
162 |
if (bytesRead > 0) { |
163 |
@@ -202,7 +223,18 @@ int KisExiv2IODevice::munmap() |
164 |
return 0; |
165 |
} |
166 |
|
167 |
+#if EXIV2_TEST_VERSION(0,28,0) |
168 |
+void KisExiv2IODevice::populateFakeData() |
169 |
+{ |
170 |
+ return; |
171 |
+} |
172 |
+#endif |
173 |
+ |
174 |
+#if EXIV2_TEST_VERSION(0,28,0) |
175 |
+size_t KisExiv2IODevice::tell() const |
176 |
+#else |
177 |
long KisExiv2IODevice::tell() const |
178 |
+#endif |
179 |
{ |
180 |
return m_file.pos(); |
181 |
} |
182 |
@@ -231,7 +263,11 @@ bool KisExiv2IODevice::eof() const |
183 |
return m_file.atEnd(); |
184 |
} |
185 |
|
186 |
+#if EXIV2_TEST_VERSION(0,28,0) |
187 |
+const std::string& KisExiv2IODevice::path() const noexcept |
188 |
+#else |
189 |
std::string KisExiv2IODevice::path() const |
190 |
+#endif |
191 |
{ |
192 |
return filePathQString().toStdString(); |
193 |
} |
194 |
diff --git ./plugins/metadata/common/KisExiv2IODevice.h ./plugins/metadata/common/KisExiv2IODevice.h |
195 |
index d90831e8325..27f5f8d5fc4 100644 |
196 |
--- ./plugins/metadata/common/KisExiv2IODevice.h |
197 |
+++ ./plugins/metadata/common/KisExiv2IODevice.h |
198 |
@@ -18,18 +18,30 @@ |
199 |
class KRITAEXIFCOMMON_EXPORT KisExiv2IODevice : public Exiv2::BasicIo |
200 |
{ |
201 |
public: |
202 |
+#if EXIV2_TEST_VERSION(0,28,0) |
203 |
+ using ptr_type = Exiv2::BasicIo::UniquePtr; |
204 |
+#else |
205 |
using ptr_type = Exiv2::BasicIo::AutoPtr; |
206 |
+#endif |
207 |
|
208 |
KisExiv2IODevice(QString path); |
209 |
~KisExiv2IODevice() override; |
210 |
|
211 |
int open() override; |
212 |
int close() override; |
213 |
+#if EXIV2_TEST_VERSION(0,28,0) |
214 |
+ size_t write(const Exiv2::byte *data, size_t wcount) override; |
215 |
+ size_t write(Exiv2::BasicIo &src) override; |
216 |
+ int putb(Exiv2::byte data) override; |
217 |
+ Exiv2::DataBuf read(size_t rcount) override; |
218 |
+ size_t read(Exiv2::byte *buf, size_t rcount) override; |
219 |
+#else |
220 |
long write(const Exiv2::byte *data, long wcount) override; |
221 |
long write(Exiv2::BasicIo &src) override; |
222 |
int putb(Exiv2::byte data) override; |
223 |
Exiv2::DataBuf read(long rcount) override; |
224 |
long read(Exiv2::byte *buf, long rcount) override; |
225 |
+#endif |
226 |
int getb() override; |
227 |
void transfer(BasicIo &src) override; |
228 |
#if defined(_MSC_VER) |
229 |
@@ -39,13 +51,24 @@ public: |
230 |
#endif |
231 |
|
232 |
Exiv2::byte *mmap(bool isWriteable = false) override; |
233 |
+#if EXIV2_TEST_VERSION(0,28,0) |
234 |
+ void populateFakeData() override; |
235 |
+#endif |
236 |
int munmap() override; |
237 |
+#if EXIV2_TEST_VERSION(0,28,0) |
238 |
+ size_t tell() const override; |
239 |
+#else |
240 |
long tell() const override; |
241 |
+#endif |
242 |
size_t size() const override; |
243 |
bool isopen() const override; |
244 |
int error() const override; |
245 |
bool eof() const override; |
246 |
+#if EXIV2_TEST_VERSION(0,28,0) |
247 |
+ const std::string& path() const noexcept override; |
248 |
+#else |
249 |
std::string path() const override; |
250 |
+#endif |
251 |
|
252 |
private: |
253 |
bool open(QFile::OpenMode mode); |
254 |
--- ./plugins/metadata/common/kis_exiv2_common.h |
255 |
+++ ./plugins/metadata/common/kis_exiv2_common.h |
256 |
@@ -19,9 +19,13 @@ |
257 |
|
258 |
// Convert an exiv value to a KisMetaData value |
259 |
inline KisMetaData::Value |
260 |
+#if EXIV2_TEST_VERSION(0,28,0) |
261 |
+exivValueToKMDValue(const Exiv2::Value::UniquePtr &value, bool forceSeq, KisMetaData::Value::ValueType arrayType = KisMetaData::Value::UnorderedArray) |
262 |
+#else |
263 |
exivValueToKMDValue(const Exiv2::Value::AutoPtr value, |
264 |
bool forceSeq, |
265 |
KisMetaData::Value::ValueType arrayType = KisMetaData::Value::UnorderedArray) |
266 |
+#endif |
267 |
{ |
268 |
switch (value->typeId()) { |
269 |
case Exiv2::signedByte: |
270 |
@@ -42,11 +46,19 @@ |
271 |
case Exiv2::signedShort: |
272 |
case Exiv2::signedLong: { |
273 |
if (value->count() == 1 && !forceSeq) { |
274 |
+#if EXIV2_TEST_VERSION(0,28,0) |
275 |
+ return {static_cast<int>(value->toUint32())}; |
276 |
+#else |
277 |
return KisMetaData::Value((int)value->toLong()); |
278 |
+#endif |
279 |
} else { |
280 |
QList<KisMetaData::Value> array; |
281 |
for (int i = 0; i < value->count(); i++) |
282 |
+#if EXIV2_TEST_VERSION(0,28,0) |
283 |
+ array.push_back({static_cast<int>(value->toUint32(i))}); |
284 |
+#else |
285 |
array.push_back(KisMetaData::Value((int)value->toLong(i))); |
286 |
+#endif |
287 |
return KisMetaData::Value(array, arrayType); |
288 |
} |
289 |
} |
290 |
@@ -63,7 +75,11 @@ |
291 |
return {KisMetaData::Rational(value->toRational().first, value->toRational().second)}; |
292 |
} else { |
293 |
QList<KisMetaData::Value> array; |
294 |
+#if EXIV2_TEST_VERSION(0,28,0) |
295 |
+ for (size_t i = 0; i < value->count(); i++) { |
296 |
+#else |
297 |
for (long i = 0; i < value->count(); i++) { |
298 |
+#endif |
299 |
array.push_back(KisMetaData::Rational(value->toRational(i).first, value->toRational(i).second)); |
300 |
} |
301 |
return KisMetaData::Value(array, arrayType); |
302 |
@@ -77,7 +93,11 @@ |
303 |
return KisMetaData::Value(KisMetaData::Rational(value->toRational().first, value->toRational().second)); |
304 |
} else { |
305 |
QList<KisMetaData::Value> array; |
306 |
+#if EXIV2_TEST_VERSION(0,28,0) |
307 |
+ for (size_t i = 0; i < value->count(); i++) { |
308 |
+#else |
309 |
for (long i = 0; i < value->count(); i++) { |
310 |
+#endif |
311 |
array.push_back(KisMetaData::Rational(value->toRational(i).first, value->toRational(i).second)); |
312 |
} |
313 |
return KisMetaData::Value(array, arrayType); |
314 |
diff --git ./plugins/metadata/exif/kis_exif_io.cpp ./plugins/metadata/exif/kis_exif_io.cpp |
315 |
index a3ee6927fca..a3b903afcb5 100644 |
316 |
--- ./plugins/metadata/exif/kis_exif_io.cpp |
317 |
+++ ./plugins/metadata/exif/kis_exif_io.cpp |
318 |
@@ -31,7 +31,11 @@ |
319 |
// ---- Exception conversion functions ---- // |
320 |
|
321 |
// convert ExifVersion and FlashpixVersion to a KisMetaData value |
322 |
+#if EXIV2_TEST_VERSION(0,28,0) |
323 |
+KisMetaData::Value exifVersionToKMDValue(const Exiv2::Value::UniquePtr value) |
324 |
+#else |
325 |
KisMetaData::Value exifVersionToKMDValue(const Exiv2::Value::AutoPtr value) |
326 |
+#endif |
327 |
{ |
328 |
const Exiv2::DataValue *dvalue = dynamic_cast<const Exiv2::DataValue *>(&*value); |
329 |
if (dvalue) { |
330 |
@@ -55,13 +59,22 @@ Exiv2::Value *kmdValueToExifVersion(const KisMetaData::Value &value) |
331 |
} |
332 |
|
333 |
// Convert an exif array of integer string to a KisMetaData array of integer |
334 |
+#if EXIV2_TEST_VERSION(0,28,0) |
335 |
+KisMetaData::Value exifArrayToKMDIntOrderedArray(const Exiv2::Value::UniquePtr value) |
336 |
+#else |
337 |
KisMetaData::Value exifArrayToKMDIntOrderedArray(const Exiv2::Value::AutoPtr value) |
338 |
+#endif |
339 |
{ |
340 |
QList<KisMetaData::Value> v; |
341 |
const Exiv2::DataValue *dvalue = dynamic_cast<const Exiv2::DataValue *>(&*value); |
342 |
if (dvalue) { |
343 |
+#if EXIV2_TEST_VERSION(0,28,0) |
344 |
+ for (size_t i = 0; i < dvalue->count(); i++) { |
345 |
+ v.push_back({(int)dvalue->toUint32(i)}); |
346 |
+#else |
347 |
for (long i = 0; i < dvalue->count(); i++) { |
348 |
v.push_back({(int)dvalue->toLong(i)}); |
349 |
+#endif |
350 |
} |
351 |
} else { |
352 |
Q_ASSERT(value->typeId() == Exiv2::asciiString); |
353 |
@@ -81,7 +94,11 @@ Exiv2::Value *kmdIntOrderedArrayToExifArray(const KisMetaData::Value &value) |
354 |
return new Exiv2::DataValue(v.data(), static_cast<long>(v.size())); |
355 |
} |
356 |
|
357 |
+#if EXIV2_TEST_VERSION(0,28,0) |
358 |
+QDateTime exivValueToDateTime(const Exiv2::Value::UniquePtr value) |
359 |
+#else |
360 |
QDateTime exivValueToDateTime(const Exiv2::Value::AutoPtr value) |
361 |
+#endif |
362 |
{ |
363 |
return QDateTime::fromString(value->toString().c_str(), Qt::ISODate); |
364 |
} |
365 |
@@ -115,7 +132,11 @@ Exiv2::ByteOrder invertByteOrder(Exiv2::ByteOrder order) |
366 |
return Exiv2::invalidByteOrder; |
367 |
} |
368 |
|
369 |
+#if EXIV2_TEST_VERSION(0,28,0) |
370 |
+KisMetaData::Value exifOECFToKMDOECFStructure(const Exiv2::Value::UniquePtr value, Exiv2::ByteOrder order) |
371 |
+#else |
372 |
KisMetaData::Value exifOECFToKMDOECFStructure(const Exiv2::Value::AutoPtr value, Exiv2::ByteOrder order) |
373 |
+#endif |
374 |
{ |
375 |
QMap<QString, KisMetaData::Value> oecfStructure; |
376 |
const Exiv2::DataValue *dvalue = dynamic_cast<const Exiv2::DataValue *>(&*value); |
377 |
@@ -123,22 +144,39 @@ KisMetaData::Value exifOECFToKMDOECFStructure(const Exiv2::Value::AutoPtr value, |
378 |
QByteArray array(dvalue->count(), 0); |
379 |
|
380 |
dvalue->copy((Exiv2::byte *)array.data()); |
381 |
+#if EXIV2_TEST_VERSION(0,28,0) |
382 |
+ size_t columns = fixEndianess<qsizetype>((reinterpret_cast<qsizetype *>(array.data()))[0], order); |
383 |
+ size_t rows = fixEndianess<qsizetype>((reinterpret_cast<qsizetype *>(array.data()))[1], order); |
384 |
+#else |
385 |
int columns = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[0], order); |
386 |
int rows = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[1], order); |
387 |
+#endif |
388 |
|
389 |
if ((columns * rows + 4) |
390 |
> dvalue->count()) { // Sometime byteOrder get messed up (especially if metadata got saved with kexiv2 library, |
391 |
// or any library that doesn't save back with the same byte order as the camera) |
392 |
order = invertByteOrder(order); |
393 |
+#if EXIV2_TEST_VERSION(0,28,0) |
394 |
+ columns = fixEndianess<qsizetype>((reinterpret_cast<qsizetype *>(array.data()))[0], order); |
395 |
+ rows = fixEndianess<qsizetype>((reinterpret_cast<qsizetype *>(array.data()))[1], order); |
396 |
+#else |
397 |
columns = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[0], order); |
398 |
rows = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[1], order); |
399 |
+#endif |
400 |
Q_ASSERT((columns * rows + 4) > dvalue->count()); |
401 |
} |
402 |
- oecfStructure["Columns"] = KisMetaData::Value(columns); |
403 |
- oecfStructure["Rows"] = KisMetaData::Value(rows); |
404 |
+ QVariant qcolumns, qrows; |
405 |
+ qcolumns.setValue(columns); |
406 |
+ qrows.setValue(rows); |
407 |
+ oecfStructure["Columns"] = KisMetaData::Value(qcolumns); |
408 |
+ oecfStructure["Rows"] = KisMetaData::Value(qrows); |
409 |
int index = 4; |
410 |
QList<KisMetaData::Value> names; |
411 |
+#if EXIV2_TEST_VERSION(0,28,0) |
412 |
+ for (size_t i = 0; i < columns; i++) { |
413 |
+#else |
414 |
for (int i = 0; i < columns; i++) { |
415 |
+#endif |
416 |
int lastIndex = array.indexOf((char)0, index); |
417 |
QString name = array.mid(index, lastIndex - index); |
418 |
if (index != lastIndex) { |
419 |
@@ -153,8 +191,13 @@ KisMetaData::Value exifOECFToKMDOECFStructure(const Exiv2::Value::AutoPtr value, |
420 |
oecfStructure["Names"] = KisMetaData::Value(names, KisMetaData::Value::OrderedArray); |
421 |
QList<KisMetaData::Value> values; |
422 |
qint32 *dataIt = reinterpret_cast<qint32 *>(array.data() + index); |
423 |
+#if EXIV2_TEST_VERSION(0,28,0) |
424 |
+ for (size_t i = 0; i < columns; i++) { |
425 |
+ for (size_t j = 0; j < rows; j++) { |
426 |
+#else |
427 |
for (int i = 0; i < columns; i++) { |
428 |
for (int j = 0; j < rows; j++) { |
429 |
+#endif |
430 |
values.append(KisMetaData::Value( |
431 |
KisMetaData::Rational(fixEndianess<qint32>(dataIt[0], order), fixEndianess<qint32>(dataIt[1], order)))); |
432 |
dataIt += 2; |
433 |
@@ -202,7 +245,11 @@ Exiv2::Value *kmdOECFStructureToExifOECF(const KisMetaData::Value &value) |
434 |
return new Exiv2::DataValue((const Exiv2::byte *)array.data(), array.size()); |
435 |
} |
436 |
|
437 |
+#if EXIV2_TEST_VERSION(0,28,0) |
438 |
+KisMetaData::Value deviceSettingDescriptionExifToKMD(const Exiv2::Value::UniquePtr value) |
439 |
+#else |
440 |
KisMetaData::Value deviceSettingDescriptionExifToKMD(const Exiv2::Value::AutoPtr value) |
441 |
+#endif |
442 |
{ |
443 |
QMap<QString, KisMetaData::Value> deviceSettingStructure; |
444 |
QByteArray array; |
445 |
@@ -258,15 +305,24 @@ Exiv2::Value *deviceSettingDescriptionKMDToExif(const KisMetaData::Value &value) |
446 |
return new Exiv2::DataValue((const Exiv2::byte *)array.data(), array.size()); |
447 |
} |
448 |
|
449 |
+#if EXIV2_TEST_VERSION(0,28,0) |
450 |
+KisMetaData::Value cfaPatternExifToKMD(const Exiv2::Value::UniquePtr value, Exiv2::ByteOrder order) |
451 |
+#else |
452 |
KisMetaData::Value cfaPatternExifToKMD(const Exiv2::Value::AutoPtr value, Exiv2::ByteOrder order) |
453 |
+#endif |
454 |
{ |
455 |
QMap<QString, KisMetaData::Value> cfaPatternStructure; |
456 |
const Exiv2::DataValue *dvalue = dynamic_cast<const Exiv2::DataValue *>(&*value); |
457 |
Q_ASSERT(dvalue); |
458 |
QByteArray array(dvalue->count(), 0); |
459 |
dvalue->copy((Exiv2::byte *)array.data()); |
460 |
+#if EXIV2_TEST_VERSION(0,28,0) |
461 |
+ size_t columns = fixEndianess<qsizetype>((reinterpret_cast<qsizetype *>(array.data()))[0], order); |
462 |
+ size_t rows = fixEndianess<qsizetype>((reinterpret_cast<qsizetype *>(array.data()))[1], order); |
463 |
+#else |
464 |
int columns = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[0], order); |
465 |
int rows = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[1], order); |
466 |
+#endif |
467 |
if ((columns * rows + 4) |
468 |
!= dvalue->count()) { // Sometime byteOrder get messed up (especially if metadata got saved with kexiv2 library, |
469 |
// or any library that doesn't save back with the same byte order as the camera) |
470 |
@@ -275,8 +331,11 @@ KisMetaData::Value cfaPatternExifToKMD(const Exiv2::Value::AutoPtr value, Exiv2: |
471 |
rows = fixEndianess<quint16>((reinterpret_cast<quint16 *>(array.data()))[1], order); |
472 |
Q_ASSERT((columns * rows + 4) == dvalue->count()); |
473 |
} |
474 |
- cfaPatternStructure["Columns"] = KisMetaData::Value(columns); |
475 |
- cfaPatternStructure["Rows"] = KisMetaData::Value(rows); |
476 |
+ QVariant qcolumns, qrows; |
477 |
+ qcolumns.setValue(columns); |
478 |
+ qrows.setValue(rows); |
479 |
+ cfaPatternStructure["Columns"] = KisMetaData::Value(qcolumns); |
480 |
+ cfaPatternStructure["Rows"] = KisMetaData::Value(qrows); |
481 |
QList<KisMetaData::Value> values; |
482 |
int index = 4; |
483 |
for (int i = 0; i < columns * rows; i++) { |
484 |
@@ -310,9 +369,17 @@ Exiv2::Value *cfaPatternKMDToExif(const KisMetaData::Value &value) |
485 |
|
486 |
// Read and write Flash // |
487 |
|
488 |
+#if EXIV2_TEST_VERSION(0,28,0) |
489 |
+KisMetaData::Value flashExifToKMD(const Exiv2::Value::UniquePtr value) |
490 |
+#else |
491 |
KisMetaData::Value flashExifToKMD(const Exiv2::Value::AutoPtr value) |
492 |
+#endif |
493 |
{ |
494 |
+#if EXIV2_TEST_VERSION(0,28,0) |
495 |
+ const uint16_t v = static_cast<uint16_t>(value->toUint32()); |
496 |
+#else |
497 |
const uint16_t v = static_cast<uint16_t>(value->toLong()); |
498 |
+#endif |
499 |
QMap<QString, KisMetaData::Value> flashStructure; |
500 |
bool fired = (v & 0x01); // bit 1 is whether flash was fired or not |
501 |
flashStructure["Fired"] = QVariant(fired); |
502 |
@@ -465,7 +532,11 @@ bool KisExifIO::saveTo(const KisMetaData::Store *store, QIODevice *ioDevice, Hea |
503 |
<< exivKey; // << " of KMD value" << entry.value(); |
504 |
} |
505 |
} |
506 |
+#if EXIV2_TEST_VERSION(0,28,0) |
507 |
+ } catch (Exiv2::Error &e) { |
508 |
+#else |
509 |
} catch (Exiv2::AnyError &e) { |
510 |
+#endif |
511 |
dbgMetaData << "exiv error " << e.what(); |
512 |
} |
513 |
} |
514 |
diff --git ./plugins/metadata/iptc/kis_iptc_io.cpp ./plugins/metadata/iptc/kis_iptc_io.cpp |
515 |
index 9e85624644d..88d80b38b8d 100644 |
516 |
--- ./plugins/metadata/iptc/kis_iptc_io.cpp |
517 |
+++ ./plugins/metadata/iptc/kis_iptc_io.cpp |
518 |
@@ -109,7 +109,11 @@ bool KisIptcIO::saveTo(const KisMetaData::Store *store, QIODevice *ioDevice, Hea |
519 |
if (v && v->typeId() != Exiv2::invalidTypeId) { |
520 |
iptcData.add(iptcKey, v); |
521 |
} |
522 |
+#if EXIV2_TEST_VERSION(0,28,0) |
523 |
+ } catch (Exiv2::Error &e) { |
524 |
+#else |
525 |
} catch (Exiv2::AnyError &e) { |
526 |
+#endif |
527 |
dbgMetaData << "exiv error " << e.what(); |
528 |
} |
529 |
} |
530 |
@@ -127,7 +131,11 @@ bool KisIptcIO::saveTo(const KisMetaData::Store *store, QIODevice *ioDevice, Hea |
531 |
header.append(photoshopBimId_); |
532 |
header.append(photoshopIptc_); |
533 |
header.append(QByteArray(2, 0)); |
534 |
+#if EXIV2_TEST_VERSION(0, 28, 0) |
535 |
+ qint32 size = rawData.size(); |
536 |
+#else |
537 |
qint32 size = rawData.size_; |
538 |
+#endif |
539 |
QByteArray sizeArray(4, 0); |
540 |
sizeArray[0] = (char)((size & 0xff000000) >> 24); |
541 |
sizeArray[1] = (char)((size & 0x00ff0000) >> 16); |
542 |
@@ -137,7 +145,11 @@ bool KisIptcIO::saveTo(const KisMetaData::Store *store, QIODevice *ioDevice, Hea |
543 |
ioDevice->write(header); |
544 |
} |
545 |
|
546 |
+#if EXIV2_TEST_VERSION(0, 28, 0) |
547 |
+ ioDevice->write((const char *)rawData.data(), rawData.size()); |
548 |
+#else |
549 |
ioDevice->write((const char *)rawData.pData_, rawData.size_); |
550 |
+#endif |
551 |
ioDevice->close(); |
552 |
return true; |
553 |
} |
554 |
diff --git ./plugins/metadata/xmp/kis_xmp_io.cpp ./plugins/metadata/xmp/kis_xmp_io.cpp |
555 |
index a1003175455..927abe8dddf 100644 |
556 |
--- ./plugins/metadata/xmp/kis_xmp_io.cpp |
557 |
+++ ./plugins/metadata/xmp/kis_xmp_io.cpp |
558 |
@@ -249,8 +249,11 @@ bool KisXMPIO::loadFrom(KisMetaData::Store *store, QIODevice *ioDevice) const |
559 |
Q_ASSERT(schema); |
560 |
} |
561 |
} |
562 |
+#if EXIV2_TEST_VERSION(0,28,0) |
563 |
+ const Exiv2::Value::UniquePtr value = it->getValue(); |
564 |
+#else |
565 |
const Exiv2::Value::AutoPtr value = it->getValue(); |
566 |
- |
567 |
+#endif |
568 |
QString structName; |
569 |
int arrayIndex = -1; |
570 |
QString tagName; |
571 |
@@ -279,7 +282,11 @@ bool KisXMPIO::loadFrom(KisMetaData::Store *store, QIODevice *ioDevice) const |
572 |
const Exiv2::XmpArrayValue *xav = dynamic_cast<const Exiv2::XmpArrayValue *>(value.get()); |
573 |
Q_ASSERT(xav); |
574 |
QList<KisMetaData::Value> array; |
575 |
+#if EXIV2_TEST_VERSION(0,28,0) |
576 |
+ for (size_t i = 0; i < xav->count(); ++i) { |
577 |
+#else |
578 |
for (int i = 0; i < xav->count(); ++i) { |
579 |
+#endif |
580 |
QString value = QString::fromStdString(xav->toString(i)); |
581 |
if (parser) { |
582 |
array.push_back(parser->parse(value)); |