graphics/viewnior: Fix for -current.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-10-30 22:06:46 -04:00 committed by Willy Sudiarto Raharjo
parent efa1f0993f
commit 3d1f84d4d7
No known key found for this signature in database
GPG key ID: 3F617144D7238786
2 changed files with 155 additions and 1 deletions

View file

@ -0,0 +1,145 @@
From b6bb81a1b46e911d15bbf9a730972523de177705 Mon Sep 17 00:00:00 2001
From: tastytea <tastytea@tastytea.de>
Date: Tue, 16 May 2023 10:54:40 +0200
Subject: [PATCH 1/2] change exiv2 AutoPtr to unique_ptr
exiv2-0.28.0 removed Exiv2::Image::AutoPtr and added
Exiv2::Image::UniquePtr instead. since it's a typedef for
std::unique_ptr<Image>, i'm using that directly instead of adding a
condition on the exiv2 version.
---
src/uni-exiv2.cpp | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/uni-exiv2.cpp b/src/uni-exiv2.cpp
index 0d14b9f..77064c2 100644
--- a/src/uni-exiv2.cpp
+++ b/src/uni-exiv2.cpp
@@ -22,12 +22,13 @@
#include <exiv2/exiv2.hpp>
#include <iostream>
+#include <memory>
#include "uni-exiv2.hpp"
#define ARRAY_SIZE(array) (sizeof array/sizeof(array[0]))
-static Exiv2::Image::AutoPtr cached_image;
+static std::unique_ptr<Exiv2::Image> cached_image;
extern "C"
void
@@ -35,8 +36,8 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const char*, const char*, v
{
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
try {
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri);
- if ( image.get() == 0 ) {
+ std::unique_ptr<Exiv2::Image> image = Exiv2::ImageFactory::open(uri);
+ if (image == nullptr) {
return;
}
@@ -91,14 +92,14 @@ uni_read_exiv2_to_cache(const char *uri)
{
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
- if ( cached_image.get() != NULL ) {
+ if (cached_image != nullptr) {
cached_image->clearMetadata();
- cached_image.reset(NULL);
+ cached_image.reset(nullptr);
}
try {
cached_image = Exiv2::ImageFactory::open(uri);
- if ( cached_image.get() == 0 ) {
+ if (cached_image == nullptr) {
return 1;
}
@@ -116,13 +117,13 @@ uni_write_exiv2_from_cache(const char *uri)
{
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
- if ( cached_image.get() == NULL ) {
+ if (cached_image == nullptr) {
return 1;
}
try {
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri);
- if ( image.get() == 0 ) {
+ std::unique_ptr<Exiv2::Image> image = Exiv2::ImageFactory::open(uri);
+ if (image == nullptr) {
return 2;
}
@@ -130,7 +131,7 @@ uni_write_exiv2_from_cache(const char *uri)
image->writeMetadata();
cached_image->clearMetadata();
- cached_image.reset(NULL);
+ cached_image.reset(nullptr);
return 0;
} catch (Exiv2::AnyError& e) {
From 47d0b98cb46526aa8aa035bebcabc14a11fa57ee Mon Sep 17 00:00:00 2001
From: tastytea <tastytea@tastytea.de>
Date: Tue, 16 May 2023 11:17:00 +0200
Subject: [PATCH 2/2] add support for exiv-0.28.0 errors
exiv2-0.28.0 changed Exiv2::AnyError to Exiv2::Error.
---
src/uni-exiv2.cpp | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/uni-exiv2.cpp b/src/uni-exiv2.cpp
index 77064c2..567a50f 100644
--- a/src/uni-exiv2.cpp
+++ b/src/uni-exiv2.cpp
@@ -28,6 +28,15 @@
#define ARRAY_SIZE(array) (sizeof array/sizeof(array[0]))
+#define EXIV_ERROR Exiv2::AnyError
+#ifdef EXIV2_VERSION
+ #ifdef EXIV2_TEST_VERSION
+ #if EXIV2_TEST_VERSION(0,28,0)
+ #define EXIV_ERROR Exiv2::Error
+ #endif
+ #endif
+#endif
+
static std::unique_ptr<Exiv2::Image> cached_image;
extern "C"
@@ -81,7 +90,7 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const char*, const char*, v
}
}
}
- } catch (Exiv2::AnyError& e) {
+ } catch (EXIV_ERROR& e) {
std::cerr << "Exiv2: '" << e << "'\n";
}
}
@@ -104,7 +113,7 @@ uni_read_exiv2_to_cache(const char *uri)
}
cached_image->readMetadata();
- } catch (Exiv2::AnyError& e) {
+ } catch (EXIV_ERROR& e) {
std::cerr << "Exiv2: '" << e << "'\n";
}
@@ -134,7 +143,7 @@ uni_write_exiv2_from_cache(const char *uri)
cached_image.reset(nullptr);
return 0;
- } catch (Exiv2::AnyError& e) {
+ } catch (EXIV_ERROR& e) {
std::cerr << "Exiv2: '" << e << "'\n";
}

View file

@ -4,7 +4,7 @@
#
# Written by Šime Ramov <email removed>
# Copyright 2016-2018 Edinaldo P. Silva, Rio de Janeiro, Brazil.
# Copyright 2020 B. Watson
# Copyright 2020-2023 B. Watson
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -24,6 +24,9 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20231030 bkw: add patch for -current. doesn't break 15.0.
# Not updating BUILD for this (it's still 1).
# 20220610 bkw: update for v1.8.
# 20200304 bkw:
@ -87,6 +90,12 @@ chown -R root:root .
find -L . -type d -a -exec chmod 755 {} + -o \
-type f -a -exec chmod 644 {} +
# 20231030 bkw: this patch comes from arch (their extra/, not AUR).
# only apply it if needed: slackware 15.0 has exiv2-0.27.5 and doesn't
# need it.
pkg-config exiv2 --atleast-version=0.28 && \
patch -p1 < $CWD/exiv2-0.28.patch
sed -i "s,It's,Its," man/$PRGNAM.1
CFLAGS="$SLKCFLAGS" \