View | Details | Raw Unified | Return to bug 272311 | Differences between
and this patch

Collapse All | Expand All

(-)b/graphics/darktable/Makefile (-1 / +1 lines)
Lines 1-6 Link Here
1
PORTNAME=	darktable
1
PORTNAME=	darktable
2
PORTVERSION=	4.2.1
2
PORTVERSION=	4.2.1
3
PORTREVISION=	6
3
PORTREVISION=	7
4
CATEGORIES=	graphics
4
CATEGORIES=	graphics
5
MASTER_SITES=	https://github.com/darktable-org/${PORTNAME}/releases/download/release-${PORTVERSION:C/\.rc/rc/}/
5
MASTER_SITES=	https://github.com/darktable-org/${PORTNAME}/releases/download/release-${PORTVERSION:C/\.rc/rc/}/
6
6
(-)b/graphics/darktable/files/patch-src_common_exif.cc (-1 / +681 lines)
Added Link Here
0
- 
1
--- src/common/exif.cc.orig	2023-02-15 16:52:33 UTC
2
+++ src/common/exif.cc
3
@@ -287,7 +287,7 @@ void dt_exif_set_exiv2_taglist()
4
     _get_xmp_tags("expressionmedia", &exiv2_taglist);
5
     _get_xmp_tags("MicrosoftPhoto", &exiv2_taglist);
6
   }
7
-  catch (Exiv2::AnyError& e)
8
+  catch (Exiv2::Error& e)
9
   {
10
     std::string s(e.what());
11
     std::cerr << "[exiv2 taglist] " << s << std::endl;
12
@@ -408,7 +408,7 @@ static void dt_remove_exif_keys(Exiv2::ExifData &exif,
13
       while((pos = exif.findKey(Exiv2::ExifKey(keys[i]))) != exif.end())
14
         exif.erase(pos);
15
     }
16
-    catch(Exiv2::AnyError &e)
17
+    catch(Exiv2::Error &e)
18
     {
19
       // the only exception we may get is "invalid" tag, which is not
20
       // important enough to either stop the function, or even display
21
@@ -428,7 +428,7 @@ static void dt_remove_xmp_keys(Exiv2::XmpData &xmp, co
22
       while((pos = xmp.findKey(Exiv2::XmpKey(keys[i]))) != xmp.end())
23
         xmp.erase(pos);
24
     }
25
-    catch(Exiv2::AnyError &e)
26
+    catch(Exiv2::Error &e)
27
     {
28
       // the only exception we may get is "invalid" tag, which is not
29
       // important enough to either stop the function, or even display
30
@@ -444,7 +444,7 @@ static bool dt_exif_read_xmp_tag(Exiv2::XmpData &xmpDa
31
   {
32
     return (*pos = xmpData.findKey(Exiv2::XmpKey(key))) != xmpData.end() && (*pos)->size();
33
   }
34
-  catch(Exiv2::AnyError &e)
35
+  catch(Exiv2::Error &e)
36
   {
37
     std::string s(e.what());
38
     std::cerr << "[exiv2 read_xmp_tag] " << s << std::endl;
39
@@ -513,7 +513,7 @@ static bool _exif_decode_xmp_data(dt_image_t *img, Exi
40
 
41
     if(FIND_XMP_TAG("Xmp.xmp.Rating"))
42
     {
43
-      const int stars = pos->toLong();
44
+      const int stars = pos->toInt64();
45
       dt_image_set_xmp_rating(img, stars);
46
     }
47
     else
48
@@ -541,7 +541,7 @@ static bool _exif_decode_xmp_data(dt_image_t *img, Exi
49
       const int cnt = pos->count();
50
       for(int i = 0; i < cnt; i++)
51
       {
52
-        dt_colorlabels_set_label(img->id, pos->toLong(i));
53
+        dt_colorlabels_set_label(img->id, pos->toInt64(i));
54
       }
55
     }
56
 
57
@@ -610,7 +610,7 @@ static bool _exif_decode_xmp_data(dt_image_t *img, Exi
58
     imgs = NULL;
59
     return true;
60
   }
61
-  catch(Exiv2::AnyError &e)
62
+  catch(Exiv2::Error &e)
63
   {
64
     if(imgs) g_list_free(imgs);
65
     imgs = NULL;
66
@@ -626,7 +626,7 @@ static bool dt_exif_read_iptc_tag(Exiv2::IptcData &ipt
67
   {
68
     return (*pos = iptcData.findKey(Exiv2::IptcKey(key))) != iptcData.end() && (*pos)->size();
69
   }
70
-  catch(Exiv2::AnyError &e)
71
+  catch(Exiv2::Error &e)
72
   {
73
     std::string s(e.what());
74
     std::cerr << "[exiv2 read_iptc_tag] " << s << std::endl;
75
@@ -684,7 +684,7 @@ static bool _exif_decode_iptc_data(dt_image_t *img, Ex
76
 
77
     return true;
78
   }
79
-  catch(Exiv2::AnyError &e)
80
+  catch(Exiv2::Error &e)
81
   {
82
     std::string s(e.what());
83
     std::cerr << "[exiv2 _exif_decode_iptc_data] " << img->filename << ": " << s << std::endl;
84
@@ -698,7 +698,7 @@ static bool _exif_read_exif_tag(Exiv2::ExifData &exifD
85
   {
86
     return (*pos = exifData.findKey(Exiv2::ExifKey(key))) != exifData.end() && (*pos)->size();
87
   }
88
-  catch(Exiv2::AnyError &e)
89
+  catch(Exiv2::Error &e)
90
   {
91
     std::string s(e.what());
92
     std::cerr << "[exiv2 read_exif_tag] " << s << std::endl;
93
@@ -761,17 +761,17 @@ static gboolean _check_lens_correction_data(Exiv2::Exi
94
     && _exif_read_exif_tag(exifData, &posv, "Exif.SubImage1.VignettingCorrParams"))
95
   {
96
     // Validate
97
-    const int nc = posd->toLong(0);
98
-    if(nc <= 16 && 2*nc == posc->toLong(0) && nc == posv->toLong(0))
99
+    const int nc = posd->toInt64(0);
100
+    if(nc <= 16 && 2*nc == posc->toInt64(0) && nc == posv->toInt64(0))
101
     {
102
       img->exif_correction_type = CORRECTION_TYPE_SONY;
103
       img->exif_correction_data.sony.nc = nc;
104
       for(int i = 0; i < nc; i++)
105
       {
106
-        img->exif_correction_data.sony.distortion[i] = posd->toLong(i + 1);
107
-        img->exif_correction_data.sony.ca_r[i] = posc->toLong(i + 1);
108
-        img->exif_correction_data.sony.ca_b[i] = posc->toLong(nc + i + 1);
109
-        img->exif_correction_data.sony.vignetting[i] = posv->toLong(i + 1);
110
+        img->exif_correction_data.sony.distortion[i] = posd->toInt64(i + 1);
111
+        img->exif_correction_data.sony.ca_r[i] = posc->toInt64(i + 1);
112
+        img->exif_correction_data.sony.ca_b[i] = posc->toInt64(nc + i + 1);
113
+        img->exif_correction_data.sony.vignetting[i] = posv->toInt64(i + 1);
114
       }
115
     }
116
   }
117
@@ -807,7 +807,7 @@ static gboolean _check_lens_correction_data(Exiv2::Exi
118
       }
119
 
120
       // Account for the 1.25x crop modes in some Fuji cameras
121
-      if(FIND_EXIF_TAG("Exif.Fujifilm.CropMode") && (pos->toLong() == 2 || pos->toLong() == 4))
122
+      if(FIND_EXIF_TAG("Exif.Fujifilm.CropMode") && (pos->toInt64() == 2 || pos->toInt64() == 4))
123
         img->exif_correction_data.fuji.cropf = 1.25f;
124
       else
125
         img->exif_correction_data.fuji.cropf = 1;
126
@@ -833,7 +833,7 @@ void dt_exif_img_check_additional_tags(dt_image_t *img
127
     }
128
     return;
129
   }
130
-  catch(Exiv2::AnyError &e)
131
+  catch(Exiv2::Error &e)
132
   {
133
     std::string s(e.what());
134
     std::cerr << "[exiv2 reading DefaultUserCrop] " << filename << ": " << s << std::endl;
135
@@ -1110,11 +1110,11 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
136
      */
137
     if(FIND_EXIF_TAG("Exif.Image.Orientation"))
138
     {
139
-      img->orientation = dt_image_orientation_to_flip_bits(pos->toLong());
140
+      img->orientation = dt_image_orientation_to_flip_bits(pos->toInt64());
141
     }
142
     else if(FIND_EXIF_TAG("Exif.PanasonicRaw.Orientation"))
143
     {
144
-      img->orientation = dt_image_orientation_to_flip_bits(pos->toLong());
145
+      img->orientation = dt_image_orientation_to_flip_bits(pos->toInt64());
146
     }
147
 
148
     /* read gps location */
149
@@ -1163,9 +1163,9 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
150
 
151
     /* Read lens name */
152
     if((FIND_EXIF_TAG("Exif.CanonCs.LensType")
153
-        && pos->toLong() != 61182   // prefer the other tag for RF lenses
154
-        && pos->toLong() != 0
155
-        && pos->toLong() != 65535)
156
+        && pos->toInt64() != 61182   // prefer the other tag for RF lenses
157
+        && pos->toInt64() != 0
158
+        && pos->toInt64() != 65535)
159
        || FIND_EXIF_TAG("Exif.Canon.LensModel"))
160
     {
161
       dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
162
@@ -1203,7 +1203,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
163
         fprintf(stderr, "[exif] Warning: lens \"%s\" unknown as \"%s\"\n", img->exif_lens, lens.c_str());
164
       }
165
     }
166
-    else if(Exiv2::testVersion(0,27,4) && FIND_EXIF_TAG("Exif.NikonLd4.LensID") && pos->toLong() == 0)
167
+    else if(Exiv2::testVersion(0,27,4) && FIND_EXIF_TAG("Exif.NikonLd4.LensID") && pos->toInt64() == 0)
168
     {
169
       /* Z body w/ FTZ adapter or recent F body (e.g. D780, D6) detected.
170
        * Prioritize the legacy ID lookup instead of Exif.Photo.LensModel included
171
@@ -1295,12 +1295,12 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
172
     {
173
       if(FIND_EXIF_TAG("Exif.Image.Rating"))
174
       {
175
-        const int stars = pos->toLong();
176
+        const int stars = pos->toInt64();
177
         dt_image_set_xmp_rating(img, stars);
178
       }
179
       else if(FIND_EXIF_TAG("Exif.Image.RatingPercent"))
180
       {
181
-        const int stars = pos->toLong() * 5. / 100;
182
+        const int stars = pos->toInt64() * 5. / 100;
183
         dt_image_set_xmp_rating(img, stars);
184
       }
185
       else
186
@@ -1355,7 +1355,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
187
       {
188
         for(int i = 0; i < 9; i++) colmatrix[0][i] = cm1_pos->toFloat(i);
189
 
190
-        if(FIND_EXIF_TAG("Exif.Image.CalibrationIlluminant1")) illu[0] = (dt_dng_illuminant_t) pos->toLong();
191
+        if(FIND_EXIF_TAG("Exif.Image.CalibrationIlluminant1")) illu[0] = (dt_dng_illuminant_t) pos->toInt64();
192
       }
193
 
194
       Exiv2::ExifData::const_iterator cm2_pos = exifData.findKey(Exiv2::ExifKey("Exif.Image.ColorMatrix2"));
195
@@ -1363,7 +1363,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
196
       {
197
         for(int i = 0; i < 9; i++) colmatrix[1][i] = cm2_pos->toFloat(i);
198
 
199
-        if(FIND_EXIF_TAG("Exif.Image.CalibrationIlluminant2")) illu[1] = (dt_dng_illuminant_t) pos->toLong();
200
+        if(FIND_EXIF_TAG("Exif.Image.CalibrationIlluminant2")) illu[1] = (dt_dng_illuminant_t) pos->toInt64();
201
       }
202
 
203
       // So far the Exif.Image.CalibrationIlluminant3 tag and friends have not been implemented and there are no images to test
204
@@ -1373,7 +1373,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
205
       {
206
         for(int i = 0; i < 9; i++) colmatrix[2][i] = cm3_pos->toFloat(i);
207
 
208
-        if(FIND_EXIF_TAG("Exif.Image.CalibrationIlluminant3")) illu[2] = (dt_dng_illuminant_t) pos->toLong();
209
+        if(FIND_EXIF_TAG("Exif.Image.CalibrationIlluminant3")) illu[2] = (dt_dng_illuminant_t) pos->toInt64();
210
       }
211
 #endif
212
 
213
@@ -1494,18 +1494,18 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
214
       int phi = 0;
215
 
216
       if(FIND_EXIF_TAG("Exif.SubImage1.SampleFormat"))
217
-        format = pos->toLong();
218
+        format = pos->toInt64();
219
       else if(FIND_EXIF_TAG("Exif.Image.SampleFormat"))
220
-        format = pos->toLong();
221
+        format = pos->toInt64();
222
 
223
       if(FIND_EXIF_TAG("Exif.SubImage1.BitsPerSample"))
224
-        bps = pos->toLong();
225
+        bps = pos->toInt64();
226
 
227
       if(FIND_EXIF_TAG("Exif.SubImage1.SamplesPerPixel"))
228
-        spp = pos->toLong();
229
+        spp = pos->toInt64();
230
 
231
       if(FIND_EXIF_TAG("Exif.SubImage1.PhotometricInterpretation"))
232
-        phi = pos->toLong();
233
+        phi = pos->toInt64();
234
 
235
       if((format == 3) && (bps >= 16) && (((spp == 1) && (phi == 32803)) || ((spp == 3) && (phi == 34892)))) is_hdr = TRUE;
236
       if((format == 1) && (bps == 16) && (spp == 1) && (phi == 34892)) is_monochrome = TRUE;
237
@@ -1528,7 +1528,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
238
     //          + Exif.Iop.InteroperabilityIndex of 'R98' -> sRGB
239
     if(dt_image_is_ldr(img) && FIND_EXIF_TAG("Exif.Photo.ColorSpace"))
240
     {
241
-      int colorspace = pos->toLong();
242
+      int colorspace = pos->toInt64();
243
       if(colorspace == 0x01)
244
         img->colorspace = DT_IMAGE_COLORSPACE_SRGB;
245
       else if(colorspace == 0x02)
246
@@ -1547,7 +1547,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
247
     }
248
 
249
     // Improve lens detection for Sony SAL lenses.
250
-    if(FIND_EXIF_TAG("Exif.Sony2.LensID") && pos->toLong() != 65535 && pos->print().find('|') == std::string::npos)
251
+    if(FIND_EXIF_TAG("Exif.Sony2.LensID") && pos->toInt64() != 65535 && pos->print().find('|') == std::string::npos)
252
     {
253
       dt_strlcpy_to_utf8(img->exif_lens, sizeof(img->exif_lens), pos, exifData);
254
     }
255
@@ -1569,7 +1569,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Ex
256
     img->exif_inited = 1;
257
     return true;
258
   }
259
-  catch(Exiv2::AnyError &e)
260
+  catch(Exiv2::Error &e)
261
   {
262
     std::string s(e.what());
263
     std::cerr << "[exiv2 _exif_decode_exif_data] " << img->filename << ": " << s << std::endl;
264
@@ -1645,7 +1645,7 @@ int dt_exif_read_from_blob(dt_image_t *img, uint8_t *b
265
     dt_exif_apply_default_metadata(img);
266
     return res ? 0 : 1;
267
   }
268
-  catch(Exiv2::AnyError &e)
269
+  catch(Exiv2::Error &e)
270
   {
271
     std::string s(e.what());
272
     std::cerr << "[exiv2 dt_exif_read_from_blob] " << img->filename << ": " << s << std::endl;
273
@@ -1696,7 +1696,7 @@ int dt_exif_get_thumbnail(const char *path, uint8_t **
274
 
275
     return 0;
276
   }
277
-  catch(Exiv2::AnyError &e)
278
+  catch(Exiv2::Error &e)
279
   {
280
     std::string s(e.what());
281
     std::cerr << "[exiv2 dt_exif_get_thumbnail] " << path << ": " << s << std::endl;
282
@@ -1765,7 +1765,7 @@ int dt_exif_read(dt_image_t *img, const char *path)
283
 
284
     return res ? 0 : 1;
285
   }
286
-  catch(Exiv2::AnyError &e)
287
+  catch(Exiv2::Error &e)
288
   {
289
     std::string s(e.what());
290
     std::cerr << "[exiv2 dt_exif_read] " << path << ": " << s << std::endl;
291
@@ -1822,7 +1822,7 @@ int dt_exif_write_blob(uint8_t *blob, uint32_t size, c
292
     imgExifData.sortByTag();
293
     image->writeMetadata();
294
   }
295
-  catch(Exiv2::AnyError &e)
296
+  catch(Exiv2::Error &e)
297
   {
298
     std::string s(e.what());
299
     std::cerr << "[exiv2 dt_exif_write_blob] " << path << ": " << s << std::endl;
300
@@ -2151,7 +2151,7 @@ int dt_exif_read_blob(uint8_t **buf, const char *path,
301
     memcpy(*buf, &(blob[0]), length);
302
     return length;
303
   }
304
-  catch(Exiv2::AnyError &e)
305
+  catch(Exiv2::Error &e)
306
   {
307
     // std::cerr.rdbuf(savecerr);
308
     std::string s(e.what());
309
@@ -2662,16 +2662,16 @@ static GList *read_history_v2(Exiv2::XmpData &xmpData,
310
       }
311
       else if(g_str_has_prefix(key_iter, "darktable:num"))
312
       {
313
-        current_entry->num = history->value().toLong();
314
+        current_entry->num = history->value().toInt64();
315
       }
316
       else if(g_str_has_prefix(key_iter, "darktable:enabled"))
317
       {
318
-        current_entry->enabled = history->value().toLong() == 1;
319
+        current_entry->enabled = history->value().toInt64() == 1;
320
       }
321
       else if(g_str_has_prefix(key_iter, "darktable:modversion"))
322
       {
323
         current_entry->have_modversion = TRUE;
324
-        current_entry->modversion = history->value().toLong();
325
+        current_entry->modversion = history->value().toInt64();
326
       }
327
       else if(g_str_has_prefix(key_iter, "darktable:params"))
328
       {
329
@@ -2685,7 +2685,7 @@ static GList *read_history_v2(Exiv2::XmpData &xmpData,
330
       }
331
       else if(g_str_has_prefix(key_iter, "darktable:multi_priority"))
332
       {
333
-        current_entry->multi_priority = history->value().toLong();
334
+        current_entry->multi_priority = history->value().toInt64();
335
       }
336
       else if(g_str_has_prefix(key_iter, "darktable:iop_order"))
337
       {
338
@@ -2698,7 +2698,7 @@ static GList *read_history_v2(Exiv2::XmpData &xmpData,
339
       }
340
       else if(g_str_has_prefix(key_iter, "darktable:blendop_version"))
341
       {
342
-        current_entry->blendop_version = history->value().toLong();
343
+        current_entry->blendop_version = history->value().toInt64();
344
       }
345
       else if(g_str_has_prefix(key_iter, "darktable:blendop_params"))
346
       {
347
@@ -2772,22 +2772,22 @@ static GHashTable *read_masks(Exiv2::XmpData &xmpData,
348
         mask_entry_t *entry = (mask_entry_t *)calloc(1, sizeof(mask_entry_t));
349
 
350
         entry->version = version;
351
-        entry->mask_id = mask_id->toLong(i);
352
-        entry->mask_type = mask_type->toLong(i);
353
+        entry->mask_id = mask_id->toInt64(i);
354
+        entry->mask_type = mask_type->toInt64(i);
355
         std::string mask_name_str = mask_name->toString(i);
356
         if(mask_name_str.c_str() != NULL)
357
           entry->mask_name = g_strdup(mask_name_str.c_str());
358
         else
359
           entry->mask_name = g_strdup("form");
360
 
361
-        entry->mask_version = mask_version->toLong(i);
362
+        entry->mask_version = mask_version->toInt64(i);
363
 
364
         std::string mask_str = mask->toString(i);
365
         const char *mask_c = mask_str.c_str();
366
         const size_t mask_c_len = strlen(mask_c);
367
         entry->mask_points = dt_exif_xmp_decode(mask_c, mask_c_len, &entry->mask_points_len);
368
 
369
-        entry->mask_nb = mask_nb->toLong(i);
370
+        entry->mask_nb = mask_nb->toInt64(i);
371
 
372
         std::string mask_src_str = mask_src->toString(i);
373
         const char *mask_src_c = mask_src_str.c_str();
374
@@ -2858,15 +2858,15 @@ static GList *read_masks_v3(Exiv2::XmpData &xmpData, c
375
       // go on reading things into current_entry
376
       if(g_str_has_prefix(key_iter, "darktable:mask_num"))
377
       {
378
-        current_entry->mask_num = history->value().toLong();
379
+        current_entry->mask_num = history->value().toInt64();
380
       }
381
       else if(g_str_has_prefix(key_iter, "darktable:mask_id"))
382
       {
383
-        current_entry->mask_id = history->value().toLong();
384
+        current_entry->mask_id = history->value().toInt64();
385
       }
386
       else if(g_str_has_prefix(key_iter, "darktable:mask_type"))
387
       {
388
-        current_entry->mask_type = history->value().toLong();
389
+        current_entry->mask_type = history->value().toInt64();
390
       }
391
       else if(g_str_has_prefix(key_iter, "darktable:mask_name"))
392
       {
393
@@ -2874,7 +2874,7 @@ static GList *read_masks_v3(Exiv2::XmpData &xmpData, c
394
       }
395
       else if(g_str_has_prefix(key_iter, "darktable:mask_version"))
396
       {
397
-        current_entry->mask_version = history->value().toLong();
398
+        current_entry->mask_version = history->value().toInt64();
399
       }
400
       else if(g_str_has_prefix(key_iter, "darktable:mask_points"))
401
       {
402
@@ -2882,7 +2882,7 @@ static GList *read_masks_v3(Exiv2::XmpData &xmpData, c
403
       }
404
       else if(g_str_has_prefix(key_iter, "darktable:mask_nb"))
405
       {
406
-        current_entry->mask_nb = history->value().toLong();
407
+        current_entry->mask_nb = history->value().toInt64();
408
       }
409
       else if(g_str_has_prefix(key_iter, "darktable:mask_src"))
410
       {
411
@@ -3034,7 +3034,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
412
 
413
     int num_masks = 0;
414
     if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.xmp_version"))) != xmpData.end())
415
-      xmp_version = pos->toLong();
416
+      xmp_version = pos->toInt64();
417
 
418
     if(!history_only)
419
     {
420
@@ -3052,7 +3052,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
421
           int32_t in;
422
           dt_image_raw_parameters_t out;
423
       } raw_params;
424
-      raw_params.in = pos->toLong();
425
+      raw_params.in = pos->toInt64();
426
       const int32_t user_flip = raw_params.out.user_flip;
427
       img->legacy_flip.user_flip = user_flip;
428
       img->legacy_flip.legacy = 0;
429
@@ -3062,7 +3062,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
430
 
431
     if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.auto_presets_applied"))) != xmpData.end())
432
     {
433
-      preset_applied = pos->toLong();
434
+      preset_applied = pos->toInt64();
435
 
436
       // in any case, this is no legacy image.
437
       img->flags |= DT_IMAGE_NO_LEGACY_PRESETS;
438
@@ -3085,7 +3085,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
439
     {
440
       if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.iop_order_version"))) != xmpData.end())
441
       {
442
-        iop_order_version = (dt_iop_order_t)pos->toLong();
443
+        iop_order_version = (dt_iop_order_t)pos->toInt64();
444
       }
445
 
446
       if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.iop_order_list"))) != xmpData.end())
447
@@ -3103,7 +3103,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
448
       {
449
         //  All iop-order version before 3 are legacy one. Starting with version 3 we have the first
450
         //  attempts to propose the final v3 iop-order.
451
-        iop_order_version = pos->toLong() < 3 ? DT_IOP_ORDER_LEGACY : DT_IOP_ORDER_V30;
452
+        iop_order_version = pos->toInt64() < 3 ? DT_IOP_ORDER_LEGACY : DT_IOP_ORDER_V30;
453
         iop_order_list = dt_ioppr_get_iop_order_list_version(iop_order_version);
454
       }
455
       else
456
@@ -3355,7 +3355,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
457
     // we shouldn't change history_end when no history was read!
458
     if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.history_end"))) != xmpData.end() && num > 0)
459
     {
460
-      int history_end = MIN(pos->toLong(), num);
461
+      int history_end = MIN(pos->toInt64(), num);
462
       if(num_masks > 0) history_end++;
463
       if((history_end < 1) && preset_applied) preset_applied = -1;
464
       DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
465
@@ -3471,7 +3471,7 @@ int dt_exif_xmp_read(dt_image_t *img, const char *file
466
     }
467
 
468
   }
469
-  catch(Exiv2::AnyError &e)
470
+  catch(Exiv2::Error &e)
471
   {
472
     // actually nobody's interested in that if the file doesn't exist:
473
     // std::string s(e.what());
474
@@ -3677,23 +3677,23 @@ void read_xmp_timestamps(Exiv2::XmpData &xmpData, dt_i
475
   if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.change_timestamp"))) != xmpData.end())
476
   {
477
     if(xmp_version > 5)
478
-      img->change_timestamp = pos->toLong();
479
-    else if(pos->toLong() >= 1)
480
-      img->change_timestamp = _convert_unix_to_gtimespan(pos->toLong());
481
+      img->change_timestamp = pos->toInt64();
482
+    else if(pos->toInt64() >= 1)
483
+      img->change_timestamp = _convert_unix_to_gtimespan(pos->toInt64());
484
   }
485
   if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.export_timestamp"))) != xmpData.end())
486
   {
487
     if(xmp_version > 5)
488
-      img->export_timestamp = pos->toLong();
489
-    else if(pos->toLong() >= 1)
490
-      img->export_timestamp = _convert_unix_to_gtimespan(pos->toLong());
491
+      img->export_timestamp = pos->toInt64();
492
+    else if(pos->toInt64() >= 1)
493
+      img->export_timestamp = _convert_unix_to_gtimespan(pos->toInt64());
494
   }
495
   if((pos = xmpData.findKey(Exiv2::XmpKey("Xmp.darktable.print_timestamp"))) != xmpData.end())
496
   {
497
     if(xmp_version > 5)
498
-      img->print_timestamp = pos->toLong();
499
-    else if(pos->toLong() >= 1)
500
-      img->print_timestamp = _convert_unix_to_gtimespan(pos->toLong());
501
+      img->print_timestamp = pos->toInt64();
502
+    else if(pos->toInt64() >= 1)
503
+      img->print_timestamp = _convert_unix_to_gtimespan(pos->toInt64());
504
   }
505
 }
506
 
507
@@ -4060,7 +4060,7 @@ char *dt_exif_xmp_read_string(const int imgid)
508
       std::string xmpPacket;
509
 
510
       Exiv2::DataBuf buf = Exiv2::readFile(WIDEN(input_filename));
511
-      xmpPacket.assign(reinterpret_cast<char *>(buf.pData_), buf.size_);
512
+      xmpPacket.assign(reinterpret_cast<const char *>(buf.c_data()), buf.size());
513
       Exiv2::XmpParser::decode(xmpData, xmpPacket);
514
       // because XmpSeq or XmpBag are added to the list, we first have
515
       // to remove these so that we don't end up with a string of duplicates
516
@@ -4076,7 +4076,7 @@ char *dt_exif_xmp_read_string(const int imgid)
517
       std::string xmpPacket;
518
 
519
       Exiv2::DataBuf buf = Exiv2::readFile(WIDEN(input_filename));
520
-      xmpPacket.assign(reinterpret_cast<char *>(buf.pData_), buf.size_);
521
+      xmpPacket.assign(reinterpret_cast<const char *>(buf.c_data()), buf.size());
522
       Exiv2::XmpParser::decode(sidecarXmpData, xmpPacket);
523
 
524
       for(Exiv2::XmpData::const_iterator it = sidecarXmpData.begin(); it != sidecarXmpData.end(); ++it)
525
@@ -4098,7 +4098,7 @@ char *dt_exif_xmp_read_string(const int imgid)
526
     }
527
     return g_strdup(xmpPacket.c_str());
528
   }
529
-  catch(Exiv2::AnyError &e)
530
+  catch(Exiv2::Error &e)
531
   {
532
     std::cerr << "[xmp_read_blob] caught exiv2 exception '" << e << "'\n";
533
     return NULL;
534
@@ -4113,7 +4113,7 @@ static void dt_remove_xmp_key(Exiv2::XmpData &xmp, con
535
     if(pos != xmp.end())
536
       xmp.erase(pos);
537
   }
538
-  catch(Exiv2::AnyError &e)
539
+  catch(Exiv2::Error &e)
540
   {
541
   }
542
 }
543
@@ -4131,7 +4131,7 @@ static void _remove_xmp_keys(Exiv2::XmpData &xmpData, 
544
         ++i;
545
     }
546
   }
547
-  catch(Exiv2::AnyError &e)
548
+  catch(Exiv2::Error &e)
549
   {
550
   }
551
 }
552
@@ -4144,7 +4144,7 @@ static void dt_remove_exif_key(Exiv2::ExifData &exif, 
553
     if(pos != exif.end())
554
       exif.erase(pos);
555
   }
556
-  catch(Exiv2::AnyError &e)
557
+  catch(Exiv2::Error &e)
558
   {
559
   }
560
 }
561
@@ -4157,7 +4157,7 @@ static void dt_remove_iptc_key(Exiv2::IptcData &iptc, 
562
     while((pos = iptc.findKey(Exiv2::IptcKey(key))) != iptc.end())
563
       iptc.erase(pos);
564
   }
565
-  catch(Exiv2::AnyError &e)
566
+  catch(Exiv2::Error &e)
567
   {
568
   }
569
 }
570
@@ -4188,7 +4188,7 @@ int dt_exif_xmp_attach_export(const int imgid, const c
571
         img->setXmpData(input_image->xmpData());
572
       }
573
     }
574
-    catch(Exiv2::AnyError &e)
575
+    catch(Exiv2::Error &e)
576
     {
577
       std::cerr << "[xmp_attach] " << input_filename << ": caught exiv2 exception '" << e << "'\n";
578
     }
579
@@ -4204,7 +4204,7 @@ int dt_exif_xmp_attach_export(const int imgid, const c
580
       std::string xmpPacket;
581
 
582
       Exiv2::DataBuf buf = Exiv2::readFile(WIDEN(input_filename));
583
-      xmpPacket.assign(reinterpret_cast<char *>(buf.pData_), buf.size_);
584
+      xmpPacket.assign(reinterpret_cast<const char *>(buf.c_data()), buf.size());
585
       Exiv2::XmpParser::decode(sidecarXmpData, xmpPacket);
586
 
587
       for(Exiv2::XmpData::const_iterator it = sidecarXmpData.begin(); it != sidecarXmpData.end(); ++it)
588
@@ -4368,10 +4368,10 @@ int dt_exif_xmp_attach_export(const int imgid, const c
589
     {
590
       img->writeMetadata();
591
     }
592
-    catch(Exiv2::AnyError &e)
593
+    catch(Exiv2::Error &e)
594
     {
595
 #if EXIV2_TEST_VERSION(0,27,0)
596
-      if(e.code() == Exiv2::kerTooLargeJpegSegment)
597
+      if(e.code() == Exiv2::ErrorCode::kerTooLargeJpegSegment)
598
 #else
599
       if(e.code() == 37)
600
 #endif
601
@@ -4384,7 +4384,7 @@ int dt_exif_xmp_attach_export(const int imgid, const c
602
         {
603
           img->writeMetadata();
604
         }
605
-        catch(Exiv2::AnyError &e2)
606
+        catch(Exiv2::Error &e2)
607
         {
608
           std::cerr << "[dt_exif_xmp_attach_export] without history " << filename << ": caught exiv2 exception '" << e2 << "'\n";
609
           return -1;
610
@@ -4395,7 +4395,7 @@ int dt_exif_xmp_attach_export(const int imgid, const c
611
     }
612
     return 0;
613
   }
614
-  catch(Exiv2::AnyError &e)
615
+  catch(Exiv2::Error &e)
616
   {
617
     std::cerr << "[dt_exif_xmp_attach_export] " << filename << ": caught exiv2 exception '" << e << "'\n";
618
     return -1;
619
@@ -4437,7 +4437,7 @@ int dt_exif_xmp_write(const int imgid, const char *fil
620
       }
621
 
622
       Exiv2::DataBuf buf = Exiv2::readFile(WIDEN(filename));
623
-      xmpPacket.assign(reinterpret_cast<char *>(buf.pData_), buf.size_);
624
+      xmpPacket.assign(reinterpret_cast<const char *>(buf.c_data()), buf.size());
625
       Exiv2::XmpParser::decode(xmpData, xmpPacket);
626
       // because XmpSeq or XmpBag are added to the list, we first have
627
       // to remove these so that we don't end up with a string of duplicates
628
@@ -4492,7 +4492,7 @@ int dt_exif_xmp_write(const int imgid, const char *fil
629
 
630
     return 0;
631
   }
632
-  catch(Exiv2::AnyError &e)
633
+  catch(Exiv2::Error &e)
634
   {
635
     std::cerr << "[dt_exif_xmp_write] " << filename << ": caught exiv2 exception '" << e << "'\n";
636
     return -1;
637
@@ -4515,7 +4515,7 @@ dt_colorspaces_color_profile_type_t dt_exif_get_color_
638
     // clang-format on
639
     if((pos = exifData.findKey(Exiv2::ExifKey("Exif.Photo.ColorSpace"))) != exifData.end() && pos->size())
640
     {
641
-      int colorspace = pos->toLong();
642
+      int colorspace = pos->toInt64();
643
       if(colorspace == 0x01)
644
         return DT_COLORSPACE_SRGB;
645
       else if(colorspace == 0x02)
646
@@ -4536,7 +4536,7 @@ dt_colorspaces_color_profile_type_t dt_exif_get_color_
647
 
648
     return DT_COLORSPACE_DISPLAY; // nothing embedded
649
   }
650
-  catch(Exiv2::AnyError &e)
651
+  catch(Exiv2::Error &e)
652
   {
653
     std::string s(e.what());
654
     std::cerr << "[exiv2 dt_exif_get_color_space] " << s << std::endl;
655
@@ -4556,7 +4556,7 @@ void dt_exif_get_basic_data(const uint8_t *data, size_
656
     _find_datetime_taken(exifData, pos, basic_exif->datetime);
657
     _find_exif_makermodel(exifData, pos, basic_exif);
658
   }
659
-  catch(Exiv2::AnyError &e)
660
+  catch(Exiv2::Error &e)
661
   {
662
     std::string s(e.what());
663
     std::cerr << "[exiv2 dt_exif_get_basic_data] " << s << std::endl;
664
@@ -4590,7 +4590,7 @@ void dt_exif_init()
665
   {
666
     Exiv2::XmpProperties::propertyList("lr");
667
   }
668
-  catch(Exiv2::AnyError &e)
669
+  catch(Exiv2::Error &e)
670
   {
671
     // if lightroom is not known register it
672
     Exiv2::XmpProperties::registerNs("http://ns.adobe.com/lightroom/1.0/", "lr");
673
@@ -4599,7 +4599,7 @@ void dt_exif_init()
674
   {
675
     Exiv2::XmpProperties::propertyList("exifEX");
676
   }
677
-  catch(Exiv2::AnyError &e)
678
+  catch(Exiv2::Error &e)
679
   {
680
     // if exifEX is not known register it
681
     Exiv2::XmpProperties::registerNs("http://cipa.jp/exif/1.0/", "exifEX");

Return to bug 272311