head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.22 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.20 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.18 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.16 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.14 pkgsrc-2025Q1-base:1.1 pkgsrc-2024Q4:1.1.0.12 pkgsrc-2024Q4-base:1.1 pkgsrc-2024Q3:1.1.0.10 pkgsrc-2024Q3-base:1.1 pkgsrc-2024Q2:1.1.0.8 pkgsrc-2024Q2-base:1.1 pkgsrc-2024Q1:1.1.0.6 pkgsrc-2024Q1-base:1.1 pkgsrc-2023Q4:1.1.0.4 pkgsrc-2023Q4-base:1.1 pkgsrc-2023Q3:1.1.0.2 pkgsrc-2023Q3-base:1.1; locks; strict; comment @// @; 1.1 date 2023.07.19.07.53.38; author wiz; state Exp; branches; next ; commitid P733pEec4g8kZnxE; desc @@ 1.1 log @viewnior: fix build with exiv2 0.28 @ text @$NetBSD$ Fix build with exiv2 0.28. https://github.com/hellosiyan/Viewnior/pull/130 --- src/uni-exiv2.cpp.orig 2018-05-13 09:40:40.000000000 +0000 +++ src/uni-exiv2.cpp @@@@ -22,10 +22,20 @@@@ #include #include +#include #include "uni-exiv2.hpp" -static Exiv2::Image::AutoPtr cached_image; +#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 cached_image; extern "C" void @@@@ -47,8 +57,8 @@@@ uni_read_exiv2_map(const char *uri, void { Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); try { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri); - if ( image.get() == 0 ) { + std::unique_ptr image = Exiv2::ImageFactory::open(uri); + if (image == nullptr) { return; } @@@@ -91,7 +101,7 @@@@ uni_read_exiv2_map(const char *uri, void } } } - } catch (Exiv2::AnyError& e) { + } catch (EXIV_ERROR& e) { std::cerr << "Exiv2: '" << e << "'\n"; } } @@@@ -102,19 +112,19 @@@@ 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; } cached_image->readMetadata(); - } catch (Exiv2::AnyError& e) { + } catch (EXIV_ERROR& e) { std::cerr << "Exiv2: '" << e << "'\n"; } @@@@ -127,13 +137,13 @@@@ uni_write_exiv2_from_cache(const char *u { 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 image = Exiv2::ImageFactory::open(uri); + if (image == nullptr) { return 2; } @@@@ -141,12 +151,12 @@@@ uni_write_exiv2_from_cache(const char *u image->writeMetadata(); cached_image->clearMetadata(); - cached_image.reset(NULL); + cached_image.reset(nullptr); return 0; - } catch (Exiv2::AnyError& e) { + } catch (EXIV_ERROR& e) { std::cerr << "Exiv2: '" << e << "'\n"; } return 0; -} \ No newline at end of file +} @