summaryrefslogtreecommitdiff
path: root/media-gfx/kphotoalbum/files/kphotoalbum-5.10.0-exiv2-0.28.patch
blob: 2eea9495b735de8981a8fe581646cf8a110d15b4 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
diff --git a/DB/FileInfo.cpp b/DB/FileInfo.cpp
index dc4c9819b62706c9c7bbfa21f3da7ef7d3f8b6d3..8b4e275c1765e718ed917cb41e7b221ed8d484ef 100644
--- a/DB/FileInfo.cpp
+++ b/DB/FileInfo.cpp
@@ -1,5 +1,6 @@
 // SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
 // SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
+// SPDX-FileCopyrightText: 2023 Tobias Leupold <tl at stonemx dot de>
 //
 // SPDX-License-Identifier: GPL-2.0-or-later
 
@@ -13,6 +14,8 @@
 #include <QFileInfo>
 #include <QRegularExpression>
 
+#include <exiv2/version.hpp>
+
 using namespace DB;
 
 FileInfo FileInfo::read(const DB::FileName &fileName, DB::ExifMode mode)
@@ -79,8 +82,14 @@ void DB::FileInfo::parseEXIV2(const DB::FileName &fileName)
         const Exiv2::Exifdatum &datum = m_exifMap["Exif.Image.Orientation"];
 
         int orientation = 0;
-        if (datum.count() > 0)
+        if (datum.count() > 0) {
+#if EXIV2_TEST_VERSION(0, 28, 0)
+            orientation = datum.toInt64();
+#else
             orientation = datum.toLong();
+#endif
+        }
+
         m_angle = orientationToAngle(orientation);
     }
 
diff --git a/lib/kpaexif/Database.cpp b/lib/kpaexif/Database.cpp
index 4d0e228c72f5747f9d5b2a4e15871e2a11de4ed9..985713ceb53e60c3c17de80632f902a07ba94b14 100644
--- a/lib/kpaexif/Database.cpp
+++ b/lib/kpaexif/Database.cpp
@@ -1,6 +1,6 @@
 // SPDX-FileCopyrightText: 2003-2020 The KPhotoAlbum Development Team
-// SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
-// SPDX-FileCopyrightText: 2022 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
+// SPDX-FileCopyrightText: 2021-2022 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
+// SPDX-FileCopyrightText: 2023 Tobias Leupold <tl at stonemx dot de>
 //
 // SPDX-License-Identifier: GPL-2.0-or-later
 
@@ -320,7 +320,7 @@ bool Exif::Database::add(const DB::FileName &fileName)
         return false;
 
     try {
-        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fileName.absolute().toLocal8Bit().data());
+        const auto image = Exiv2::ImageFactory::open(fileName.absolute().toLocal8Bit().data());
         Q_ASSERT(image.get() != nullptr);
         image->readMetadata();
         Exiv2::ExifData &exifData = image->exifData();
@@ -341,7 +341,7 @@ bool Exif::Database::add(const DB::FileNameList &list)
 
     for (const DB::FileName &fileName : list) {
         try {
-            Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fileName.absolute().toLocal8Bit().data());
+            const auto image = Exiv2::ImageFactory::open(fileName.absolute().toLocal8Bit().data());
             Q_ASSERT(image.get() != nullptr);
             image->readMetadata();
             map << DBExifInfo(fileName, image->exifData());
diff --git a/lib/kpaexif/DatabaseElement.cpp b/lib/kpaexif/DatabaseElement.cpp
index 4e7ba198e425e81c582c585bb184ec19c31d4985..3d5d56cfbe5028a8e148753979bdae3f0922008d 100644
--- a/lib/kpaexif/DatabaseElement.cpp
+++ b/lib/kpaexif/DatabaseElement.cpp
@@ -1,13 +1,15 @@
-/* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
+// SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
+// SPDX-FileCopyrightText: 2023 Tobias Leupold <tl at stonemx dot de>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
 
-   SPDX-License-Identifier: GPL-2.0-or-later
-*/
 #include "DatabaseElement.h"
 
 #include <kpabase/Logging.h>
 
 #include <QVariant>
 #include <exiv2/exif.hpp>
+#include <exiv2/version.hpp>
 
 static QString replaceDotWithUnderscore(const char *cstr)
 {
@@ -76,10 +78,15 @@ QString Exif::IntExifElement::queryString() const
 
 QVariant Exif::IntExifElement::valueFromExif(Exiv2::ExifData &data) const
 {
-    if (data[m_tag].count() > 0)
-        return QVariant { (int)data[m_tag].toLong() };
-    else
-        return QVariant { (int)0 };
+    if (data[m_tag].count() > 0) {
+#if EXIV2_TEST_VERSION(0, 28, 0)
+        return QVariant((int) data[m_tag].toInt64());
+#else
+        return QVariant((int) data[m_tag].toLong());
+#endif
+    } else {
+        return QVariant(0);
+    }
 }
 
 Exif::RationalExifElement::RationalExifElement(const char *tag)
diff --git a/lib/kpaexif/Info.cpp b/lib/kpaexif/Info.cpp
index 5f77fc8144516434465bd9f21ea2e885054aed37..162a05d14f3fbadd1d776d0eb10589a892bcf86c 100644
--- a/lib/kpaexif/Info.cpp
+++ b/lib/kpaexif/Info.cpp
@@ -1,5 +1,6 @@
 // SPDX-FileCopyrightText: 2003-2020 The KPhotoAlbum Development Team
 // SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
+// SPDX-FileCopyrightText: 2023 Tobias Leupold <tl at stonemx dot de>
 //
 // SPDX-License-Identifier: GPL-2.0-or-later
 
@@ -16,7 +17,6 @@
 #include <QTextCodec>
 #include <exiv2/exv_conf.h>
 #include <exiv2/image.hpp>
-#include <exiv2/version.hpp>
 
 using namespace Exif;
 
@@ -166,7 +166,7 @@ Info::Info()
 void Exif::writeExifInfoToFile(const DB::FileName &srcName, const QString &destName, const QString &imageDescription)
 {
     // Load Exif from source image
-    Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(QFile::encodeName(srcName.absolute()).data());
+    auto image = Exiv2::ImageFactory::open(QFile::encodeName(srcName.absolute()).data());
     image->readMetadata();
     Exiv2::ExifData data = image->exifData();
 
@@ -201,7 +201,7 @@ Exif::Metadata Exif::Info::metadata(const DB::FileName &fileName)
 {
     try {
         Exif::Metadata result;
-        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(QFile::encodeName(fileName.absolute()).data());
+        auto image = Exiv2::ImageFactory::open(QFile::encodeName(fileName.absolute()).data());
         Q_ASSERT(image.get() != nullptr);
         image->readMetadata();
         result.exif = image->exifData();