summarylogtreecommitdiffstats
path: root/geeqie-exiv2_0.28.patch
blob: 88f4c1c08f673a3ac981d7146a08f47db0173a92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
diff -Naur geeqie-1.5.orig/src/exiv2.cc geeqie-1.5/src/exiv2.cc
--- geeqie-1.5.orig/src/exiv2.cc	2019-07-26 12:19:11.000000000 -0600
+++ geeqie-1.5/src/exiv2.cc	2024-12-29 12:39:47.638050433 -0700
@@ -52,6 +52,11 @@
 #define EXV_PACKAGE "exiv2"
 #endif
 
+#if EXIV2_TEST_VERSION(0,28,0)
+#define AnyError Error
+#define AutoPtr UniquePtr
+#endif
+
 extern "C" {
 #include <glib.h>
 
@@ -176,7 +181,7 @@
 	{
 		cp_data_ = NULL;
 		cp_length_ = 0;
-		image_ = image;
+		image_ = std::move(image);
 		valid_ = TRUE;
 	}
 
@@ -364,7 +369,11 @@
 			Exiv2::Image *image = imageData_->image();
 
 #ifdef HAVE_EXIV2_ERROR_CODE
+#  if EXIV2_TEST_VERSION(0,28,0)
+			throw Exiv2::Error(Exiv2::ErrorCode::kerInputDataReadFailed);
+#  else
 			if (!image) throw Exiv2::Error(Exiv2::kerInputDataReadFailed);
+#  endif
 #else
 			if (!image) throw Exiv2::Error(21);
 #endif
@@ -836,7 +845,11 @@
 {
 	try {
 		if (!item || exif_item_get_elements(item) == 0) return 0;
+#if EXIV2_TEST_VERSION(0,28,0)
+		*value = ((Exiv2::Metadatum *)item)->toInt64();
+#else
 		*value = ((Exiv2::Metadatum *)item)->toLong();
+#endif
 		return 1;
 	}
 	catch (Exiv2::AnyError& e) {
@@ -1059,7 +1072,11 @@
 	else
 		{
 		/* read as a list */
+#if EXIV2_TEST_VERSION(0,28,0)
+		size_t i;
+#else
 		gint i;
+#endif
 		for (i = 0; i < item.count(); i++)
 			list = g_list_append(list, utf8_validate_or_convert(item.toString(i).c_str()));
 		}
@@ -1220,11 +1237,21 @@
 
 			Exiv2::PreviewImage image = pm.getPreviewImage(*pos);
 
+#if EXIV2_TEST_VERSION(0,28,0)
+			// Let's not touch data_len until we finish copy.
+			// Just in case we run into OOM.
+			size_t img_sz = image.size();
+			auto* b = new Exiv2::byte[img_sz];
+			std::copy_n(image.pData(), img_sz, b);
+			*data_len = img_sz;
+			return b;
+#else
 			Exiv2::DataBuf buf = image.copy();
 			std::pair<Exiv2::byte*, long> p = buf.release();
 
 			*data_len = p.second;
 			return p.first;
+#endif
 			}
 		return NULL;
 	}