From: Enblend <enb...@li...> - 2019-10-21 11:58:42
|
branch: details: http://enblend.hg.sourceforge.net/hgweb/enblend/enblend/hg/p/enblend/code/rev/c6b17c386f40 changeset: 1526:c6b17c386f40 user: Chris <cs...@us...> date: Mon Oct 21 13:57:12 2019 +0200 description: C++17: replace Exiv2::Image::AutoPtr with Exiv2::Image::UniquePtr. Requires recent exiv2 library. diffstat: VERSION | 2 +- configure.ac | 16 +++++++++++++++- src/enblend.h | 2 +- src/enfuse.h | 2 +- src/metadata.cc | 8 ++++---- src/metadata.h | 4 ++-- 6 files changed, 24 insertions(+), 10 deletions(-) diffs (113 lines): diff -r acca568fcdc3 -r c6b17c386f40 VERSION --- a/VERSION Mon Oct 21 13:57:00 2019 +0200 +++ b/VERSION Mon Oct 21 13:57:12 2019 +0200 @@ -1,1 +1,1 @@ -4.3-4c30a326b3f4 +4.3-acca568fcdc3 diff -r acca568fcdc3 -r c6b17c386f40 configure.ac --- a/configure.ac Mon Oct 21 13:57:00 2019 +0200 +++ b/configure.ac Mon Oct 21 13:57:12 2019 +0200 @@ -151,9 +151,23 @@ image->iptcData();]])], [AC_MSG_RESULT(yes) use_exiv2=yes - AC_DEFINE(HAVE_EXIV2, 1, [Define if you have the exiv2 library])], + AC_DEFINE(HAVE_EXIV2, 1, [Define if you have the Exiv2 library])], [AC_MSG_RESULT(no) LIBS="$SAVED_LIBS"])]) +if test "$use_exiv2" = yes; then + AC_MSG_CHECKING([whether Exiv2 library is sufficiently recent]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <exiv2/image.hpp>]], + [[Exiv2::Image::UniquePtr p {nullptr}]])], + AC_MSG_RESULT(yes), + [AC_MSG_RESULT(no) + use_exiv2=no + LIBS="$SAVED_LIBS" + if test "$with_exiv2" = check; then + AC_MSG_WARN([Exiv2 was found, but it was not recent enough.]) + else + AC_MSG_ERROR([Exiv2 was found, but it was not recent enough.]) + fi]) +fi AC_MSG_CHECKING([for support of partially static linking]) original_LIBS="${LIBS}" diff -r acca568fcdc3 -r c6b17c386f40 src/enblend.h --- a/src/enblend.h Mon Oct 21 13:57:00 2019 +0200 +++ b/src/enblend.h Mon Oct 21 13:57:12 2019 +0200 @@ -100,7 +100,7 @@ FileNameList::const_iterator inputFileNameIterator(anInputFileNameList.begin()); #ifdef HAVE_EXIV2 - typedef allocate::array<Exiv2::Image::AutoPtr> metadata_array; + typedef allocate::array<Exiv2::Image::UniquePtr> metadata_array; metadata_array input_metadata(anInputFileNameList.size()); { FileNameList::const_iterator filename(anInputFileNameList.begin()); diff -r acca568fcdc3 -r c6b17c386f40 src/enfuse.h --- a/src/enfuse.h Mon Oct 21 13:57:00 2019 +0200 +++ b/src/enfuse.h Mon Oct 21 13:57:12 2019 +0200 @@ -1255,7 +1255,7 @@ FileNameList::const_iterator inputFileNameIterator(anInputFileNameList.begin()); #ifdef HAVE_EXIV2 - typedef allocate::array<Exiv2::Image::AutoPtr> metadata_array; + typedef allocate::array<Exiv2::Image::UniquePtr> metadata_array; metadata_array input_metadata(anInputFileNameList.size()); { FileNameList::const_iterator filename(anInputFileNameList.begin()); diff -r acca568fcdc3 -r c6b17c386f40 src/metadata.cc --- a/src/metadata.cc Mon Oct 21 13:57:00 2019 +0200 +++ b/src/metadata.cc Mon Oct 21 13:57:12 2019 +0200 @@ -171,10 +171,10 @@ } - Exiv2::Image::AutoPtr + Exiv2::Image::UniquePtr read(const std::string& an_image_filename) { - Exiv2::Image::AutoPtr meta {Exiv2::ImageFactory::open(an_image_filename)}; + Exiv2::Image::UniquePtr meta {Exiv2::ImageFactory::open(an_image_filename)}; if (meta.get() && meta->good()) { @@ -183,7 +183,7 @@ } else { - return Exiv2::Image::AutoPtr(nullptr); + return Exiv2::Image::UniquePtr(nullptr); } } @@ -193,7 +193,7 @@ named_meta_array::const_iterator some_named_meta_begin, named_meta_array::const_iterator some_named_meta_end) { - Exiv2::Image::AutoPtr output_meta {Exiv2::ImageFactory::open(an_image_filename)}; + Exiv2::Image::UniquePtr output_meta {Exiv2::ImageFactory::open(an_image_filename)}; if (output_meta.get() && output_meta->good()) { diff -r acca568fcdc3 -r c6b17c386f40 src/metadata.h --- a/src/metadata.h Mon Oct 21 13:57:00 2019 +0200 +++ b/src/metadata.h Mon Oct 21 13:57:12 2019 +0200 @@ -50,7 +50,7 @@ class Named { - typedef Exiv2::Image::AutoPtr::element_type* meta_pointer; + typedef Exiv2::Image::UniquePtr::element_type* meta_pointer; public: Named() = delete; @@ -71,7 +71,7 @@ typedef std::vector<Named> named_meta_array; - Exiv2::Image::AutoPtr read(const std::string& an_image_filename); + Exiv2::Image::UniquePtr read(const std::string& an_image_filename); named_meta_array::const_iterator write(const std::string& an_image_filename, named_meta_array::const_iterator some_named_meta_begin, |