summaryrefslogtreecommitdiff
blob: fb58db6a5283d9456559620c044880e2745254b9 (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
From 0b044d1d685307e5755917e31d56a1a3104cd505 Mon Sep 17 00:00:00 2001
From: David Kalnischkies <david@kalnischkies.de>
Date: Fri, 27 May 2016 12:04:40 +0100
Subject: [PATCH] Work around changed c++11 std::string implementation

Bug was already partly fixed by 96db62d but there was even more
positions that was unseen by Solomon.

The patch is originally from Debian bug report #800350.

Signed-off-by: Klaus Ethgen <Klaus@Ethgen.de>
---
 src/exiv2.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/exiv2.cc b/src/exiv2.cc
index 1dbe118..49b8e07 100644
--- a/src/exiv2.cc
+++ b/src/exiv2.cc
@@ -25,6 +25,7 @@
 #include <exiv2/image.hpp>
 #include <exiv2/exif.hpp>
 #include <iostream>
+#include <string>
 
 // EXIV2_TEST_VERSION is defined in Exiv2 0.15 and newer.
 #ifndef EXIV2_TEST_VERSION
@@ -1140,8 +1141,9 @@ guchar *exif_get_preview(ExifData *exif, guint *data_len, gint requested_width,
 
 	if (!exif->image()) return NULL;
 
+	std::string const path = exif->image()->io().path();
 	/* given image pathname, first do simple (and fast) file extension test */
-	gboolean is_raw = filter_file_class(exif->image()->io().path().c_str(), FORMAT_CLASS_RAWIMAGE);
+	gboolean is_raw = filter_file_class(path.c_str(), FORMAT_CLASS_RAWIMAGE);
 
 	if (!is_raw && requested_width == 0) return NULL;
 
@@ -1241,10 +1243,10 @@ extern "C" guchar *exif_get_preview(ExifData *exif, guint *data_len, gint reques
 	if (!exif) return NULL;
 	if (!exif->image()) return NULL;
 
-	const char* path = exif->image()->io().path().c_str();
+	std::string const path = exif->image()->io().path();
 
 	/* given image pathname, first do simple (and fast) file extension test */
-	if (!filter_file_class(path, FORMAT_CLASS_RAWIMAGE)) return NULL;
+	if (!filter_file_class(path.c_str(), FORMAT_CLASS_RAWIMAGE)) return NULL;
 
 	try {
 		struct stat st;
@@ -1255,9 +1257,9 @@ extern "C" guchar *exif_get_preview(ExifData *exif, guint *data_len, gint reques
 
 		RawFile rf(exif->image()->io());
 		offset = rf.preview_offset();
-		DEBUG_1("%s: offset %lu", path, offset);
+		DEBUG_1("%s: offset %lu", path.c_str(), offset);
 
-		fd = open(path, O_RDONLY);
+		fd = open(path.c_str(), O_RDONLY);
 		if (fd == -1)
 			{
 			return NULL;