From 23da0c3955fa93cdfb485292fa74099fa275926c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 4 Mar 2022 17:06:55 +0100 Subject: [PATCH 01/17] Do not define not needed stuff --- app/actions.cpp | 2 +- app/exiv2.cpp | 1 - app/exiv2app.hpp | 5 ----- app/getopt.cpp | 4 ---- src/futils.cpp | 6 +----- src/image.cpp | 3 --- 6 files changed, 2 insertions(+), 19 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index 46130052..32062ed8 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -45,7 +45,7 @@ #include #include #else -# include +#include #endif #if !defined(__MINGW__) && !defined(_MSC_VER) diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 64171e9e..eb098c9d 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -965,7 +965,6 @@ static int readFileToBuf(FILE* f,Exiv2::DataBuf& buf) return nBytes; } -//#define DEBUG void Params::getStdin(Exiv2::DataBuf& buf) { // copy stdin to stdinBuf diff --git a/app/exiv2app.hpp b/app/exiv2app.hpp index 84099644..fa34b601 100644 --- a/app/exiv2app.hpp +++ b/app/exiv2app.hpp @@ -35,7 +35,6 @@ #include "getopt.hpp" // + standard includes -#include #include #include #include @@ -44,12 +43,8 @@ #ifndef _MSC_VER #include #include -#if defined(__CYGWIN__) || defined(__MINGW__) -#include -#else #include #endif -#endif // ***************************************************************************** // class definitions diff --git a/app/getopt.cpp b/app/getopt.cpp index 9dff95de..3c76ae27 100644 --- a/app/getopt.cpp +++ b/app/getopt.cpp @@ -1,9 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#if _MSC_VER >= 1400 -# pragma warning(disable : 4996) -#endif - // included header files #include #include diff --git a/src/futils.cpp b/src/futils.cpp index 34f76f39..e7334a52 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -26,13 +26,9 @@ namespace fs = std::filesystem; #include // For access to GetModuleFileNameEx #endif -#if defined(_MSC_VER) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#elif defined(__APPLE__) -#if defined(EXV_HAVE_LIBPROC_H) +#if defined(__APPLE__) && defined(EXV_HAVE_LIBPROC_H) #include #endif -#endif #if defined(__FreeBSD__) #include diff --git a/src/image.cpp b/src/image.cpp index 9197d9e6..97521ac3 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -51,9 +51,6 @@ #include #include -#ifdef _MSC_VER -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif #ifdef EXV_HAVE_UNISTD_H # include // stat #endif From 15697fcd1e546e3771e49ced6a4deb240c934f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 4 Mar 2022 17:19:47 +0100 Subject: [PATCH 02/17] Remove unused file --- src/CMakeLists.txt | 1 - src/timegm.h | 21 --------------------- 2 files changed, 22 deletions(-) delete mode 100644 src/timegm.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e4917cd..6b4a8587 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,6 @@ add_library( exiv2lib_int OBJECT tiffimage_int.cpp tiffimage_int.hpp tiffvisitor_int.cpp tiffvisitor_int.hpp tifffwd_int.hpp - timegm.h unused.h utils.hpp utils.cpp ) diff --git a/src/timegm.h b/src/timegm.h deleted file mode 100644 index c95189d5..00000000 --- a/src/timegm.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// The UTC version of mktime -/* timegm is replaced with _mkgmtime on Windows (msvc && mingw) */ -#if defined(_MSC_VER) -#define timegm _mkgmtime -#endif - -#if defined(__MINGW__) -time_t timegm(struct tm * const tmp); -#endif - -#ifdef __cplusplus -} -#endif - From 867132f7c7879bf90ef93b83fbabe44a11c09635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 4 Mar 2022 17:22:24 +0100 Subject: [PATCH 03/17] _fileno is only for Windows --- app/actions.cpp | 6 +++--- app/exiv2.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index 32062ed8..d33205e2 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -202,7 +202,7 @@ namespace Action { } } } else { - _setmode(_fileno(stdout),O_BINARY); + _setmode(fileno(stdout),O_BINARY); result = printStructure(std::cout, option, path); } @@ -834,7 +834,7 @@ namespace Action { bool bStdout = (Params::instance().target_ & Params::ctStdInOut) != 0; if (bStdout) { - _setmode(_fileno(stdout), _O_BINARY); + _setmode(fileno(stdout), _O_BINARY); } if (Params::instance().target_ & Params::ctThumb) { @@ -1905,7 +1905,7 @@ namespace { // if we used a temporary target, copy it to stdout if ( rc == 0 && bStdout ) { FILE* f = ::fopen(target.c_str(),"rb") ; - _setmode(_fileno(stdout),O_BINARY); + _setmode(fileno(stdout),O_BINARY); if ( f ) { char buffer[8*1024]; diff --git a/app/exiv2.cpp b/app/exiv2.cpp index eb098c9d..2682342a 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -971,7 +971,7 @@ void Params::getStdin(Exiv2::DataBuf& buf) if (stdinBuf.empty()) { #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MSC_VER) DWORD fdwMode; - _setmode(fileno(stdin), O_BINARY); + _setmode(fileno(stdin),O_BINARY); Sleep(300); if ( !GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &fdwMode) ) { // failed: stdin has bytes! #else @@ -1380,7 +1380,9 @@ namespace { if (cmdEnd == std::string::npos || keyStart == std::string::npos) { std::string cmdLine ; #if defined(_MSC_VER) || defined(__MINGW__) - for ( int i = 1 ; i < __argc ; i++ ) { cmdLine += std::string(" ") + formatArg(__argv[i]) ; } + for ( int i = 1 ; i < __argc ; i++ ) { + cmdLine += std::string(" ") + formatArg(__argv[i]) ; + } #endif throw Exiv2::Error(Exiv2::kerErrorMessage, Exiv2::toString(num) + ": " + _("Invalid command line:") + cmdLine); From 3f3b651c04e19d0521d6dcc3bb8c97e05400059d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 4 Mar 2022 17:23:26 +0100 Subject: [PATCH 04/17] Remove unused stuff --- app/exiv2app.hpp | 7 ------- src/http.cpp | 31 +++++-------------------------- src/image.cpp | 3 --- src/ini.cpp | 4 ---- src/makernote_int.cpp | 8 -------- src/minoltamn_int.cpp | 2 +- src/safe_op.hpp | 33 +-------------------------------- 7 files changed, 7 insertions(+), 81 deletions(-) diff --git a/app/exiv2app.hpp b/app/exiv2app.hpp index fa34b601..638f8004 100644 --- a/app/exiv2app.hpp +++ b/app/exiv2app.hpp @@ -39,13 +39,6 @@ #include #include -// stdin handler includes -#ifndef _MSC_VER -#include -#include -#include -#endif - // ***************************************************************************** // class definitions diff --git a/src/http.cpp b/src/http.cpp index 9eecfcac..deb221f3 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -1,44 +1,23 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MINGW64__) || defined(__MINGW32__) +#include "config.h" + +#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) #define __USE_W32_SOCKETS #include #endif -#include "config.h" -#include "datasets.hpp" #include "http.hpp" #include "futils.hpp" -#include #include #include -#include -#include #include -#include - -#define SLEEP 1000 -#define SNOOZE 0 - -#ifdef __MINGW__ -#define fopen_S(f,n,a) f=fopen(n,a) -#endif //////////////////////////////////////// // platform specific code #if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW__) -#include -#include -#if !defined(__MINGW__) && !defined(__CYGWIN__) -#define write _write -#define read _read -#define close _close -#define strdup _strdup -#define stat _stat -#define fopen_S(f,n,a) fopen_s(&f,n,a) -#endif #else //////////////////////////////////////// // Unix or Mac @@ -98,8 +77,8 @@ static constexpr std::array blankLines{ "\n\n", // this is commonly sent by CGI scripts }; -static constexpr int snooze = SNOOZE; -static int sleep_ = SLEEP; +static constexpr int snooze = 0; +static int sleep_ = 1000; static int forgive(int n,int& err) { diff --git a/src/image.cpp b/src/image.cpp index 97521ac3..b7b3124a 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -51,9 +51,6 @@ #include #include -#ifdef EXV_HAVE_UNISTD_H -# include // stat -#endif // ***************************************************************************** namespace { diff --git a/src/ini.cpp b/src/ini.cpp index 1e005e47..17100f17 100755 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -17,10 +17,6 @@ using std::string; using namespace Exiv2; -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS -#endif - #include #include #include diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index cd638cfa..0ec0cd8d 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -23,19 +23,11 @@ namespace fs = std::filesystem; -#if defined(__MINGW32__) || defined(__MINGW64__) -#ifndef __MINGW__ -#define __MINGW__ 1 -#endif -#endif - #if !defined(_MSC_VER) && !defined(__MINGW__) #include #include #include #else -#include -#include // _getcwd #include # ifndef CSIDL_PROFILE # define CSIDL_PROFILE 40 diff --git a/src/minoltamn_int.cpp b/src/minoltamn_int.cpp index 5841786f..f2837f84 100644 --- a/src/minoltamn_int.cpp +++ b/src/minoltamn_int.cpp @@ -2186,7 +2186,7 @@ namespace Exiv2::Internal { uint32_t id_; //!< Lens id PrintFct fct_; //!< Pretty-print function //! Comparison operator for find template - bool operator==(long id) const { return id_ == id; } + bool operator==(uint32_t id) const { return id_ == id; } }; //! List of lens ids which require special treatment from printMinoltaSonyLensID diff --git a/src/safe_op.hpp b/src/safe_op.hpp index de042481..1dc2539c 100644 --- a/src/safe_op.hpp +++ b/src/safe_op.hpp @@ -212,38 +212,7 @@ namespace Safe #undef SPECIALIZE_builtin_add_overflow #endif // __GNUC__ >= 5 || __clang_major >= 3 -#elif defined(_MSC_VER) -// intrinsics are not in available in MSVC 2005 and earlier -#if _MSC_VER >= 1400 - -/*! - * This macro pastes a specialization of builtin_add_overflow using MSVC's - * U(Int/Long/LongLong)Add. - * - * The add function is implemented by forwarding the parameters to the - * intrinsic. As MSVC's intrinsics return S_OK on success, this specialization - * returns whether the intrinsics return value does not equal S_OK. This ensures - * a uniform interface of the add function (false is returned when no overflow - * occurs, true on overflow). - * - * The intrinsics are documented here: - * https://msdn.microsoft.com/en-us/library/windows/desktop/ff516460(v=vs.85).aspx - */ -#define SPECIALIZE_builtin_add_overflow_WIN(type, builtin_name) \ - template <> \ - inline bool builtin_add_overflow(type summand_1, type summand_2, type& result) \ - { \ - return builtin_name(summand_1, summand_2, &result) != S_OK; \ - } - - SPECIALIZE_builtin_add_overflow_WIN(unsigned int, UIntAdd); - SPECIALIZE_builtin_add_overflow_WIN(unsigned long, ULongAdd); - SPECIALIZE_builtin_add_overflow_WIN(unsigned long long, ULongLongAdd); - -#undef SPECIALIZE_builtin_add_overflow_WIN - -#endif // _MSC_VER >= 1400 -#endif // defined(_MSC_VER) +#endif } // namespace Internal From 8b1fe379a1dd444026b6aa06750eed4929a1ac49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 4 Mar 2022 18:09:22 +0100 Subject: [PATCH 05/17] Removing unused headers thanks to IWYU --- include/exiv2/error.hpp | 5 +++-- src/basicio.cpp | 4 ---- src/bmpimage.cpp | 3 --- src/canonmn_int.cpp | 4 ---- src/canonmn_int.hpp | 1 - src/casiomn_int.cpp | 2 -- src/convert.cpp | 6 ----- src/cr2image.cpp | 18 +++++---------- src/crwimage.cpp | 13 ----------- src/datasets.cpp | 3 --- src/error.cpp | 1 + src/exif.cpp | 21 ++++++++---------- src/fujimn_int.cpp | 6 ----- src/futils.cpp | 8 +++---- src/gifimage.cpp | 8 +++---- src/http.cpp | 4 ---- src/image.cpp | 46 ++++++++++++++++----------------------- src/image_int.cpp | 4 +++- src/image_int.hpp | 6 +++-- src/ini.cpp | 2 -- src/iptc.cpp | 12 +++++----- src/jp2image.cpp | 8 ------- src/jpgimage.cpp | 9 -------- src/makernote_int.cpp | 3 --- src/makernote_int.hpp | 5 +++-- src/metadatum.cpp | 8 ------- src/minoltamn_int.cpp | 4 ---- src/minoltamn_int.hpp | 4 ---- src/mrwimage.cpp | 20 +++++------------ src/nikonmn_int.cpp | 18 +++++---------- src/nikonmn_int.hpp | 6 ----- src/olympusmn_int.cpp | 17 +++++---------- src/olympusmn_int.hpp | 3 --- src/orfimage_int.hpp | 1 - src/panasonicmn_int.cpp | 3 --- src/panasonicmn_int.hpp | 1 - src/pentaxmn_int.cpp | 4 ---- src/pgfimage.cpp | 14 +++--------- src/pngchunk_int.cpp | 1 - src/samsungmn_int.cpp | 3 --- src/samsungmn_int.hpp | 1 - src/sigmamn_int.cpp | 3 --- src/sigmamn_int.hpp | 1 - src/sonymn_int.cpp | 15 ++++--------- src/tiffcomposite_int.cpp | 7 ------ src/tiffimage_int.cpp | 2 -- src/tiffvisitor_int.cpp | 10 --------- 47 files changed, 81 insertions(+), 267 deletions(-) diff --git a/include/exiv2/error.hpp b/include/exiv2/error.hpp index 31a9e7f5..7eb7923f 100644 --- a/include/exiv2/error.hpp +++ b/include/exiv2/error.hpp @@ -14,8 +14,9 @@ // ***************************************************************************** #include "exiv2lib_export.h" -// included header files -#include "types.hpp" +#include // for exception +#include // for operator<<, ostream, ostringstream, bas... +#include // for basic_string, string // ***************************************************************************** // namespace extensions diff --git a/src/basicio.cpp b/src/basicio.cpp index ddbc81f3..b5280ed6 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -14,9 +14,7 @@ // + standard includes #include // _O_BINARY in FileIo::FileIo #include // for stat, chmod -#include // for stat, chmod -#include #include // for remove, rename #include // for alloc, realloc, free #include // std::memcpy @@ -24,8 +22,6 @@ #include #include // write the temporary file #include -#include -#include #ifdef EXV_HAVE_SYS_MMAN_H # include // for mmap and munmap diff --git a/src/bmpimage.cpp b/src/bmpimage.cpp index 14f73799..78416cfd 100644 --- a/src/bmpimage.cpp +++ b/src/bmpimage.cpp @@ -4,8 +4,6 @@ Author(s): Marco Piovanelli, Ovolab (marco) History: 05-Mar-2007, marco: created */ -// included header files -#include "config.h" #include "basicio.hpp" #include "bmpimage.hpp" @@ -15,7 +13,6 @@ // + standard includes #include -#include #include // ***************************************************************************** diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 260dd688..3cb04e09 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -20,10 +20,6 @@ #include #include #include -#include -#include -#include -#include #include // ***************************************************************************** diff --git a/src/canonmn_int.hpp b/src/canonmn_int.hpp index ea6ba528..ca6d8ced 100644 --- a/src/canonmn_int.hpp +++ b/src/canonmn_int.hpp @@ -17,7 +17,6 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" // ***************************************************************************** // namespace extensions diff --git a/src/casiomn_int.cpp b/src/casiomn_int.cpp index 520bf6e1..aced7ab8 100644 --- a/src/casiomn_int.cpp +++ b/src/casiomn_int.cpp @@ -12,10 +12,8 @@ #include "i18n.h" // NLS support. // + standard includes -#include #include #include -#include #include #include diff --git a/src/convert.cpp b/src/convert.cpp index 80d07bab..0c5224ab 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -19,14 +19,8 @@ #include "unused.h" // + standard includes -#include // for snprintf (C99) #include -#include #include -#include -#include -#include -#include #if defined WIN32 && !defined __CYGWIN__ # include diff --git a/src/cr2image.cpp b/src/cr2image.cpp index 00b28113..546a197d 100644 --- a/src/cr2image.cpp +++ b/src/cr2image.cpp @@ -1,23 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "cr2image.hpp" -#include "tiffimage.hpp" + +#include "config.h" #include "cr2header_int.hpp" -#include "tiffcomposite_int.hpp" -#include "tiffimage_int.hpp" -#include "image.hpp" #include "error.hpp" #include "futils.hpp" -#include "i18n.h" // NLS support. - -// + standard includes -#include -#include -#include -#include +#include "image.hpp" +#include "tiffcomposite_int.hpp" +#include "tiffimage_int.hpp" // ***************************************************************************** // class member definitions diff --git a/src/crwimage.cpp b/src/crwimage.cpp index 60ce8de3..7b61aa57 100644 --- a/src/crwimage.cpp +++ b/src/crwimage.cpp @@ -11,20 +11,7 @@ #include "crwimage_int.hpp" #include "error.hpp" #include "futils.hpp" -#include "value.hpp" #include "tags.hpp" -#include "tags_int.hpp" - -// + standard includes -#include -#include -#include -#include -#include -#include -#include -#include - // ***************************************************************************** // class member definitions diff --git a/src/datasets.cpp b/src/datasets.cpp index fb85b25c..e68e2073 100644 --- a/src/datasets.cpp +++ b/src/datasets.cpp @@ -9,11 +9,8 @@ #include "datasets.hpp" #include "error.hpp" #include "types.hpp" -#include "value.hpp" -#include "metadatum.hpp" #include "i18n.h" // NLS support. -#include #include #include #include diff --git a/src/error.cpp b/src/error.cpp index b7386e68..df447379 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -2,6 +2,7 @@ // included header files #include "error.hpp" +#include "types.hpp" #include "i18n.h" // NLS support. // + standard includes diff --git a/src/exif.cpp b/src/exif.cpp index 637b73eb..5217c1af 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -8,28 +8,25 @@ */ // ***************************************************************************** // included header files -#include "config.h" - #include "exif.hpp" + +#include "basicio.hpp" +#include "config.h" +#include "error.hpp" #include "metadatum.hpp" #include "tags.hpp" #include "tags_int.hpp" -#include "value.hpp" -#include "types.hpp" -#include "error.hpp" -#include "basicio.hpp" +#include "tiffcomposite_int.hpp" // for Tag::root #include "tiffimage.hpp" #include "tiffimage_int.hpp" -#include "tiffcomposite_int.hpp" // for Tag::root +#include "types.hpp" +#include "value.hpp" // + standard includes -#include -#include -#include #include -#include -#include #include +#include +#include // ***************************************************************************** namespace { diff --git a/src/fujimn_int.cpp b/src/fujimn_int.cpp index 7821eddc..b6cd58ee 100644 --- a/src/fujimn_int.cpp +++ b/src/fujimn_int.cpp @@ -11,15 +11,9 @@ #include "types.hpp" #include "fujimn_int.hpp" #include "tags_int.hpp" -#include "value.hpp" #include "i18n.h" // NLS support. // + standard includes -#include -#include -#include -#include -#include // ***************************************************************************** // class member definitions diff --git a/src/futils.cpp b/src/futils.cpp index e7334a52..438669e5 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -1,16 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "futils.hpp" -#include "datasets.hpp" -#include "enforce.hpp" -#include "image_int.hpp" + +#include "config.h" // + standard includes #include #include +#include #include #include #include diff --git a/src/gifimage.cpp b/src/gifimage.cpp index f483355a..3bc4c797 100644 --- a/src/gifimage.cpp +++ b/src/gifimage.cpp @@ -1,14 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "gifimage.hpp" + +#include "config.h" #include "error.hpp" #include "futils.hpp" -#include - // ***************************************************************************** // class member definitions namespace Exiv2 { @@ -16,7 +14,7 @@ namespace Exiv2 { GifImage::GifImage(BasicIo::UniquePtr io) : Image(ImageType::gif, mdNone, std::move(io)) { - } // GifImage::GifImage + } std::string GifImage::mimeType() const { diff --git a/src/http.cpp b/src/http.cpp index deb221f3..52b00d39 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -12,7 +12,6 @@ #include #include -#include //////////////////////////////////////// // platform specific code @@ -25,11 +24,8 @@ #define closesocket close #include -#include #include #include -#include -#include #include #include #include diff --git a/src/image.cpp b/src/image.cpp index b7b3124a..bf2d17e9 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1,57 +1,49 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "image.hpp" -#include "image_int.hpp" -#include "error.hpp" + +#include "config.h" #include "enforce.hpp" +#include "error.hpp" #include "futils.hpp" +#include "image_int.hpp" #include "safe_op.hpp" #include "slice.hpp" -#ifdef EXV_ENABLE_BMFF +#ifdef EXV_ENABLE_BMFF #include "bmffimage.hpp" -#endif// EXV_ENABLE_BMFF +#endif // EXV_ENABLE_BMFF #include "cr2image.hpp" #include "crwimage.hpp" #include "epsimage.hpp" #include "jpgimage.hpp" #include "mrwimage.hpp" -#ifdef EXV_HAVE_LIBZ -# include "pngimage.hpp" -#endif// EXV_HAVE_LIBZ -#include "rafimage.hpp" -#include "tiffimage.hpp" -#include "tiffimage_int.hpp" -#include "tiffcomposite_int.hpp" -#include "tiffvisitor_int.hpp" -#include "webpimage.hpp" -#include "orfimage.hpp" -#include "gifimage.hpp" -#include "psdimage.hpp" -#include "tgaimage.hpp" +#ifdef EXV_HAVE_LIBZ +#include "pngimage.hpp" +#endif // EXV_HAVE_LIBZ #include "bmpimage.hpp" +#include "gifimage.hpp" #include "jp2image.hpp" #include "nikonmn_int.hpp" - -#include "rw2image.hpp" +#include "orfimage.hpp" #include "pgfimage.hpp" +#include "psdimage.hpp" +#include "rafimage.hpp" +#include "rw2image.hpp" +#include "tags_int.hpp" +#include "tgaimage.hpp" +#include "tiffimage.hpp" +#include "webpimage.hpp" #include "xmpsidecar.hpp" // + standard includes -#include +#include #include #include -#include -#include #include #include -#include -#include - // ***************************************************************************** namespace { diff --git a/src/image_int.cpp b/src/image_int.cpp index deccb560..1586a4a5 100644 --- a/src/image_int.cpp +++ b/src/image_int.cpp @@ -2,10 +2,12 @@ #include "image_int.hpp" +#include #include #include -#include #include +#include +#include namespace Exiv2::Internal { std::string stringFormat(const char* format, ...) diff --git a/src/image_int.hpp b/src/image_int.hpp index 783b7476..3158b3de 100644 --- a/src/image_int.hpp +++ b/src/image_int.hpp @@ -5,9 +5,11 @@ // ***************************************************************************** // included header files -#include "types.hpp" +#include "slice.hpp" // for Slice -// + standard includes +#include // for size_t +#include // for int32_t +#include // for ostream, basic_ostream::put #include #if (defined(__GNUG__) || defined(__GNUC__)) || defined(__clang__) diff --git a/src/ini.cpp b/src/ini.cpp index 17100f17..c3527653 100755 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -7,7 +7,6 @@ // // https://github.com/benhoyt/inih -#include "config.h" #include "ini.hpp" #include @@ -18,7 +17,6 @@ using std::string; using namespace Exiv2; #include -#include #include #if !INI_USE_STACK diff --git a/src/iptc.cpp b/src/iptc.cpp index ceeb0450..25d93d15 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -2,18 +2,16 @@ // included header files #include "iptc.hpp" -#include "types.hpp" -#include "error.hpp" -#include "enforce.hpp" -#include "value.hpp" + #include "datasets.hpp" -#include "jpgimage.hpp" +#include "enforce.hpp" +#include "error.hpp" #include "image_int.hpp" +#include "types.hpp" +#include "value.hpp" // + standard includes -#include #include -#include // write the temporary file // ***************************************************************************** namespace { diff --git a/src/jp2image.cpp b/src/jp2image.cpp index a9eee89c..54fbc92c 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -14,14 +14,6 @@ #include "types.hpp" #include "safe_op.hpp" -// + standard includes -#include -#include -#include -#include -#include -#include - // JPEG-2000 box types const uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h' const uint32_t kJp2BoxTypeImageHeader = 0x69686472; // 'ihdr' diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp index ed3c4692..5edf737a 100644 --- a/src/jpgimage.cpp +++ b/src/jpgimage.cpp @@ -4,7 +4,6 @@ #include "config.h" #include "jpgimage.hpp" -#include "tiffimage.hpp" #include "image_int.hpp" #include "error.hpp" #include "futils.hpp" @@ -22,14 +21,6 @@ #include "fff.h" -// + standard includes -#include // for EOF -#include // for EOF -#include -#include -#include -#include - // ***************************************************************************** // class member definitions diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 0ec0cd8d..0c5ffa51 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -11,21 +11,18 @@ #include "ini.hpp" #include "tiffcomposite_int.hpp" #include "tiffvisitor_int.hpp" -#include "tiffimage.hpp" #include "tiffimage_int.hpp" #include "utils.hpp" // + standard includes #include #include -#include #include namespace fs = std::filesystem; #if !defined(_MSC_VER) && !defined(__MINGW__) #include -#include #include #else #include diff --git a/src/makernote_int.hpp b/src/makernote_int.hpp index 934d7d23..fa4db63d 100644 --- a/src/makernote_int.hpp +++ b/src/makernote_int.hpp @@ -5,13 +5,14 @@ // ***************************************************************************** // included header files -#include "tifffwd_int.hpp" #include "tags_int.hpp" #include "types.hpp" -// ***************************************************************************** // namespace extensions namespace Exiv2::Internal { + + class IoWrapper; + class TiffComponent; // ***************************************************************************** // function prototypes /*! diff --git a/src/metadatum.cpp b/src/metadatum.cpp index 7f85046f..324d6c9c 100644 --- a/src/metadatum.cpp +++ b/src/metadatum.cpp @@ -1,15 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later -// included header files #include "metadatum.hpp" -// + standard includes -#include -#include - - -// ***************************************************************************** -// class member definitions namespace Exiv2 { Key::UniquePtr Key::clone() const diff --git a/src/minoltamn_int.cpp b/src/minoltamn_int.cpp index f2837f84..2e549447 100644 --- a/src/minoltamn_int.cpp +++ b/src/minoltamn_int.cpp @@ -7,16 +7,12 @@ #include "value.hpp" #include "exif.hpp" #include "i18n.h" // NLS support. -#include "datasets.hpp" #include #include #include -#include -#include #include // popen to call exiftool -#include // ***************************************************************************** // class member definitions diff --git a/src/minoltamn_int.hpp b/src/minoltamn_int.hpp index d20dcc9b..39da7c0b 100644 --- a/src/minoltamn_int.hpp +++ b/src/minoltamn_int.hpp @@ -6,10 +6,6 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" - -// + standard includes -#include // ***************************************************************************** // namespace extensions diff --git a/src/mrwimage.cpp b/src/mrwimage.cpp index 63dfda5f..c529cb34 100644 --- a/src/mrwimage.cpp +++ b/src/mrwimage.cpp @@ -1,30 +1,22 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "mrwimage.hpp" -#include "tiffimage.hpp" -#include "image.hpp" + #include "basicio.hpp" -#include "error.hpp" +#include "config.h" #include "enforce.hpp" +#include "error.hpp" #include "futils.hpp" +#include "image.hpp" +#include "tiffimage.hpp" -// + standard includes -#include -#include -#include -#include - -// ***************************************************************************** -// class member definitions namespace Exiv2 { MrwImage::MrwImage(BasicIo::UniquePtr io, bool /*create*/) : Image(ImageType::mrw, mdExif | mdIptc | mdXmp, std::move(io)) { - } // MrwImage::MrwImage + } std::string MrwImage::mimeType() const { diff --git a/src/nikonmn_int.cpp b/src/nikonmn_int.cpp index 2efc1b06..128f4d33 100644 --- a/src/nikonmn_int.cpp +++ b/src/nikonmn_int.cpp @@ -1,24 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "types.hpp" #include "nikonmn_int.hpp" -#include "value.hpp" -#include "image.hpp" -#include "tags_int.hpp" + +#include "exif.hpp" +#include "i18n.h" // NLS support. #include "makernote_int.hpp" -#include "error.hpp" -#include "i18n.h" // NLS support. +#include "tags_int.hpp" +#include "value.hpp" // + standard includes -#include -#include -#include -#include -#include -#include //for log, pow, abs #include -#include // ***************************************************************************** // class member definitions diff --git a/src/nikonmn_int.hpp b/src/nikonmn_int.hpp index d79f18f9..1a16d51f 100644 --- a/src/nikonmn_int.hpp +++ b/src/nikonmn_int.hpp @@ -18,12 +18,6 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" - -// + standard includes -#include -#include -#include // ***************************************************************************** // namespace extensions diff --git a/src/olympusmn_int.cpp b/src/olympusmn_int.cpp index c04ffa04..7d4123f4 100644 --- a/src/olympusmn_int.cpp +++ b/src/olympusmn_int.cpp @@ -2,20 +2,13 @@ // ***************************************************************************** // included header files -#include "types.hpp" #include "olympusmn_int.hpp" -#include "value.hpp" -#include "image.hpp" -#include "tags_int.hpp" -#include "makernote_int.hpp" -#include "i18n.h" // NLS support. -// + standard includes -#include -#include -#include -#include -#include +#include "exif.hpp" +#include "i18n.h" // NLS support. +#include "makernote_int.hpp" +#include "tags_int.hpp" +#include "value.hpp" // ***************************************************************************** // class member definitions diff --git a/src/olympusmn_int.hpp b/src/olympusmn_int.hpp index fd1e3e24..6d1ee2d3 100644 --- a/src/olympusmn_int.hpp +++ b/src/olympusmn_int.hpp @@ -13,12 +13,9 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" // + standard includes -#include #include -#include // ***************************************************************************** // namespace extensions diff --git a/src/orfimage_int.hpp b/src/orfimage_int.hpp index 9051c47e..5215b720 100644 --- a/src/orfimage_int.hpp +++ b/src/orfimage_int.hpp @@ -6,7 +6,6 @@ // ***************************************************************************** // included header files #include "tiffimage_int.hpp" -#include "types.hpp" // ***************************************************************************** // namespace extensions diff --git a/src/panasonicmn_int.cpp b/src/panasonicmn_int.cpp index 4d15ea14..47f80f65 100644 --- a/src/panasonicmn_int.cpp +++ b/src/panasonicmn_int.cpp @@ -8,11 +8,8 @@ #include "i18n.h" // NLS support. // + standard includes -#include #include #include -#include -#include // ***************************************************************************** // class member definitions diff --git a/src/panasonicmn_int.hpp b/src/panasonicmn_int.hpp index 243a198a..c7aaa080 100644 --- a/src/panasonicmn_int.hpp +++ b/src/panasonicmn_int.hpp @@ -6,7 +6,6 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" // ***************************************************************************** // namespace extensions diff --git a/src/pentaxmn_int.cpp b/src/pentaxmn_int.cpp index e4fae83a..38dd9679 100644 --- a/src/pentaxmn_int.cpp +++ b/src/pentaxmn_int.cpp @@ -7,12 +7,8 @@ #include "value.hpp" #include "exif.hpp" #include "tags.hpp" -#include "metadatum.hpp" #include "i18n.h" // NLS support. -// + standard includes -#include - // ***************************************************************************** // class member definitions namespace Exiv2::Internal { diff --git a/src/pgfimage.cpp b/src/pgfimage.cpp index 2114e8cc..89eec775 100644 --- a/src/pgfimage.cpp +++ b/src/pgfimage.cpp @@ -1,22 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "pgfimage.hpp" -#include "image.hpp" -#include "pngimage.hpp" + #include "basicio.hpp" +#include "config.h" #include "enforce.hpp" #include "error.hpp" #include "futils.hpp" - -// + standard includes -#include // for EOF -#include -#include -#include -#include +#include "image.hpp" // Signature from front of PGF file const unsigned char pgfSignature[3] = { 0x50, 0x47, 0x46 }; diff --git a/src/pngchunk_int.cpp b/src/pngchunk_int.cpp index 53105c22..41d829c2 100644 --- a/src/pngchunk_int.cpp +++ b/src/pngchunk_int.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include /* diff --git a/src/samsungmn_int.cpp b/src/samsungmn_int.cpp index 417068f8..01472180 100644 --- a/src/samsungmn_int.cpp +++ b/src/samsungmn_int.cpp @@ -8,11 +8,8 @@ #include "i18n.h" // NLS support. // + standard includes -#include #include #include -#include -#include // ***************************************************************************** // class member definitions diff --git a/src/samsungmn_int.hpp b/src/samsungmn_int.hpp index d5c3879e..e2d7ffea 100644 --- a/src/samsungmn_int.hpp +++ b/src/samsungmn_int.hpp @@ -6,7 +6,6 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" // ***************************************************************************** // namespace extensions diff --git a/src/sigmamn_int.cpp b/src/sigmamn_int.cpp index a57246ab..5220685b 100644 --- a/src/sigmamn_int.cpp +++ b/src/sigmamn_int.cpp @@ -10,9 +10,6 @@ // + standard includes #include #include -#include -#include -#include // ***************************************************************************** // class member definitions diff --git a/src/sigmamn_int.hpp b/src/sigmamn_int.hpp index 7fe5dd23..fd979309 100644 --- a/src/sigmamn_int.hpp +++ b/src/sigmamn_int.hpp @@ -6,7 +6,6 @@ // ***************************************************************************** // included header files #include "tags.hpp" -#include "types.hpp" // ***************************************************************************** // namespace extensions diff --git a/src/sonymn_int.cpp b/src/sonymn_int.cpp index b7c60e46..ba54450e 100644 --- a/src/sonymn_int.cpp +++ b/src/sonymn_int.cpp @@ -1,21 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "types.hpp" -#include "minoltamn_int.hpp" #include "sonymn_int.hpp" -#include "tags_int.hpp" + +#include "exif.hpp" +#include "i18n.h" // NLS support. +#include "minoltamn_int.hpp" #include "tiffcomposite_int.hpp" #include "value.hpp" -#include "exif.hpp" -#include "i18n.h" // NLS support. -// + standard includes -#include -#include -#include -#include -#include #include // ***************************************************************************** diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 6ca4e357..e192da1a 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -11,13 +11,6 @@ #include "error.hpp" #include "enforce.hpp" -// + standard includes -#include -#include -#include -#include -#include - // ***************************************************************************** namespace { //! Add \em tobe - \em curr 0x00 filler bytes if necessary diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index eb221adf..bd04897c 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -8,8 +8,6 @@ #include "tiffvisitor_int.hpp" #include "i18n.h" // NLS support. -#include - // Shortcuts for the newTiffBinaryArray templates. #define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&arrayCfg, EXV_COUNTOF(arrayDef), arrayDef>) #define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>) diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index ddd5c5e6..bfed835d 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -6,24 +6,14 @@ #include "tiffcomposite_int.hpp" // Do not change the order of these 2 includes, #include "tiffvisitor_int.hpp" // see bug #487 #include "tiffimage_int.hpp" -#include "image_int.hpp" #include "makernote_int.hpp" #include "exif.hpp" #include "enforce.hpp" #include "iptc.hpp" #include "value.hpp" -#include "image.hpp" #include "jpgimage.hpp" #include "sonymn_int.hpp" -#include "i18n.h" // NLS support. -// + standard includes -#include -#include -#include -#include -#include -#include // ***************************************************************************** namespace { From 5508e6f46679e67e7e96104822efb1d8a41634cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 17:46:12 +0100 Subject: [PATCH 06/17] hexdump to size_t --- app/actions.cpp | 2 +- include/exiv2/types.hpp | 2 +- src/tiffcomposite_int.cpp | 5 ++--- src/types.cpp | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index d33205e2..75e2383b 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -571,7 +571,7 @@ namespace Action { std::cout << std::endl; Exiv2::DataBuf buf(md.size()); md.copy(buf.data(), pImage->byteOrder()); - Exiv2::hexdump(std::cout, buf.c_data(), static_cast(buf.size())); + Exiv2::hexdump(std::cout, buf.c_data(), buf.size()); } std::cout << std::endl; return true; diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 82ea5dfc..acb74c95 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -320,7 +320,7 @@ namespace Exiv2 { stream, prefixed with the position in the buffer adjusted by offset. */ - EXIV2API void hexdump(std::ostream& os, const byte* buf, long len, long offset = 0); + EXIV2API void hexdump(std::ostream& os, const byte* buf, size_t len, size_t offset = 0); /*! @brief Return true if str is a hex number starting with prefix followed diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index e192da1a..27b8f068 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -282,9 +282,8 @@ namespace Exiv2::Internal { memset(pData_, 0x0, size_); } size_ = value->copy(pData_, byteOrder); - assert(size_ == newSize); setValue(std::move(value)); - } // TiffEntryBase::updateValue + } void TiffEntryBase::setValue(Value::UniquePtr value) { @@ -294,7 +293,7 @@ namespace Exiv2::Internal { count_ = value->count(); delete pValue_; pValue_ = value.release(); - } // TiffEntryBase::setValue + } void TiffDataEntry::setStrips(const Value* pSize, const byte* pData, diff --git a/src/types.cpp b/src/types.cpp index 8f6ba372..97e65b37 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -540,13 +540,13 @@ namespace Exiv2 { return 8; } - void hexdump(std::ostream& os, const byte* buf, long len, long offset) + void hexdump(std::ostream& os, const byte* buf, size_t len, size_t offset) { const std::string::size_type pos = 8 + 16 * 3 + 2; const std::string align(pos, ' '); std::ios::fmtflags f( os.flags() ); - long i = 0; + size_t i = 0; while (i < len) { os << " " << std::setw(4) << std::setfill('0') << std::hex @@ -562,7 +562,7 @@ namespace Exiv2 { } os << std::dec << std::setfill(' '); os.flags(f); - } // hexdump + } bool isHex(const std::string& str, size_t size, const std::string& prefix) { From 2834fa5f05eac155b8083fea638631b926fa64b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 19:12:01 +0100 Subject: [PATCH 07/17] Use [[maybe_unused]] --- samples/geotag.cpp | 1 - samples/xmpsample.cpp | 21 +++++++-------------- src/CMakeLists.txt | 1 - src/bmffimage.cpp | 1 - src/convert.cpp | 1 - src/crwimage_int.cpp | 7 ++----- src/preview.cpp | 1 - src/types.cpp | 1 - src/unused.h | 8 -------- src/value.cpp | 4 +--- 10 files changed, 10 insertions(+), 36 deletions(-) delete mode 100644 src/unused.h diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 2a18be4f..8351b91e 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -22,7 +22,6 @@ // g++ geotag.cpp -o geotag -lexiv2 -lexpat #include -#include "unused.h" #include #include diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index 2b57ca01..173e9eb6 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -21,7 +21,6 @@ // Sample/test for high level XMP classes. See also addmoddel.cpp #include -#include "unused.h" #include #include @@ -77,26 +76,22 @@ try { assert(xmpData["Xmp.dc.one"].toInt64() == -1); assert(xmpData["Xmp.dc.one"].value().ok()); - const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value(); - UNUSED(getv1); + [[maybe_unused]] const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value(); assert(isEqual(getv1.toFloat(), -1)); assert(getv1.ok()); assert(getv1.toRational() == Exiv2::Rational(-1, 1)); assert(getv1.ok()); - const Exiv2::Value &getv2 = xmpData["Xmp.dc.two"].value(); - UNUSED(getv2); + [[maybe_unused]] const Exiv2::Value &getv2 = xmpData["Xmp.dc.two"].value(); assert(isEqual(getv2.toFloat(), 3.1415f)); assert(getv2.ok()); assert(getv2.toInt64() == 3); assert(getv2.ok()); - Exiv2::Rational R = getv2.toRational(); - UNUSED(R); + [[maybe_unused]] Exiv2::Rational R = getv2.toRational(); assert(getv2.ok()); assert(isEqual(static_cast(R.first) / R.second, 3.1415f )); - const Exiv2::Value &getv3 = xmpData["Xmp.dc.three"].value(); - UNUSED(getv3); + [[maybe_unused]] const Exiv2::Value &getv3 = xmpData["Xmp.dc.three"].value(); assert(isEqual(getv3.toFloat(), 5.0f/7.0f)); assert(getv3.ok()); assert(getv3.toInt64() == 0); // long(5.0 / 7.0) @@ -104,10 +99,9 @@ try { assert(getv3.toRational() == Exiv2::Rational(5, 7)); assert(getv3.ok()); - const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value(); - UNUSED(getv6); + [[maybe_unused]] const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value(); assert(getv6.toInt64() == 0); - assert(getv6.ok()); + assert(getv6.ok()^); assert(getv6.toFloat() == 0.0f); assert(getv6.ok()); assert(getv6.toRational() == Exiv2::Rational(0, 1)); @@ -117,8 +111,7 @@ try { getv7.toInt64(); // this should fail assert(!getv7.ok()); - const Exiv2::Value &getv8 = xmpData["Xmp.dc.eight"].value(); - UNUSED(getv8); + [[maybe_unused]] const Exiv2::Value &getv8 = xmpData["Xmp.dc.eight"].value(); assert(getv8.toInt64() == 1); assert(getv8.ok()); assert(getv8.toFloat() == 1.0f); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b4a8587..405f13e0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,6 @@ add_library( exiv2lib_int OBJECT tiffimage_int.cpp tiffimage_int.hpp tiffvisitor_int.cpp tiffvisitor_int.hpp tifffwd_int.hpp - unused.h utils.hpp utils.cpp ) diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index 61f92dda..5d20eb4e 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -14,7 +14,6 @@ #include "tiffimage.hpp" #include "tiffimage_int.hpp" #include "types.hpp" -#include "unused.h" // + standard includes #include diff --git a/src/convert.cpp b/src/convert.cpp index 0c5224ab..1ae175ad 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -16,7 +16,6 @@ #include "xmp_exiv2.hpp" #include "futils.hpp" #include "convert.hpp" -#include "unused.h" // + standard includes #include diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 7d9274ce..b2cf42e2 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -3,7 +3,6 @@ #include "crwimage_int.hpp" #include "canonmn_int.hpp" #include "i18n.h" // NLS support. -#include "unused.h" #include "error.hpp" #include "enforce.hpp" @@ -592,8 +591,7 @@ namespace Exiv2::Internal { { CrwDirs crwDirs; CrwMap::loadStack(crwDirs, crwDir); - uint16_t rootDirectory = crwDirs.top().crwDir_; - UNUSED(rootDirectory); + [[maybe_unused]] uint16_t rootDirectory = crwDirs.top().crwDir_; assert(rootDirectory == 0x0000); crwDirs.pop(); if (!pRootDir_) { @@ -671,8 +669,7 @@ namespace Exiv2::Internal { if (pRootDir_) { CrwDirs crwDirs; CrwMap::loadStack(crwDirs, crwDir); - uint16_t rootDirectory = crwDirs.top().crwDir_; - UNUSED(rootDirectory); + [[maybe_unused]] uint16_t rootDirectory = crwDirs.top().crwDir_; assert(rootDirectory == 0x0000); crwDirs.pop(); pRootDir_->remove(crwDirs, crwTagId); diff --git a/src/preview.cpp b/src/preview.cpp index 44c79751..e885960c 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -18,7 +18,6 @@ #include "jpgimage.hpp" #include "tiffimage.hpp" #include "tiffimage_int.hpp" -#include "unused.h" // ***************************************************************************** namespace { diff --git a/src/types.cpp b/src/types.cpp index 97e65b37..1dd66936 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -6,7 +6,6 @@ #include "futils.hpp" #include "i18n.h" // for _exvGettext #include "safe_op.hpp" -#include "unused.h" // + standard includes #include diff --git a/src/unused.h b/src/unused.h deleted file mode 100644 index fd2fc86e..00000000 --- a/src/unused.h +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#ifndef UNUSED_H -#define UNUSED_H - -#define UNUSED(x) (void)(x) - -#endif // UNUSED_H diff --git a/src/value.cpp b/src/value.cpp index b7edb3b3..cf61b351 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -6,7 +6,6 @@ #include "enforce.hpp" #include "error.hpp" #include "convert.hpp" -#include "unused.h" // + standard includes #include @@ -451,8 +450,7 @@ namespace Exiv2 { std::string c = value_; if (charsetId() == unicode) { c = value_.substr(8); - const size_t sz = c.size(); - UNUSED(sz); + [[maybe_unused]] const size_t sz = c.size(); if (byteOrder_ == littleEndian && byteOrder == bigEndian) { convertStringCharset(c, "UCS-2LE", "UCS-2BE"); assert(c.size() == sz); From 22064c957d66f697ea0358e3314ab407fc530fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 21:17:03 +0100 Subject: [PATCH 08/17] Add missing header to the CMake configuration --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 405f13e0..b61d09ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -94,6 +94,7 @@ add_library( exiv2lib error.cpp exif.cpp futils.cpp + fff.h gifimage.cpp http.cpp image.cpp From b3a216310a1cad9ae8ea662be836b0a2eb06ef64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 21:45:46 +0100 Subject: [PATCH 09/17] Removing unused headers thanks to IWYU --- app/actions.cpp | 44 +++++++++++++++------------------------ app/actions.hpp | 1 - app/exiv2.cpp | 1 - app/getopt.cpp | 13 ++++-------- app/getopt.hpp | 2 -- include/exiv2/types.hpp | 5 ----- samples/addmoddel.cpp | 2 +- samples/convert-test.cpp | 2 +- samples/exifdata.cpp | 2 +- samples/exifvalue.cpp | 3 +-- samples/exiv2json.cpp | 25 +++++++++------------- samples/geotag.cpp | 17 +++++---------- samples/getopt-test.cpp | 2 -- samples/iotest.cpp | 4 +--- samples/iptceasy.cpp | 3 +-- samples/iptcprint.cpp | 3 +-- samples/iptctest.cpp | 3 +-- samples/key-test.cpp | 3 +-- samples/metacopy.cpp | 1 - samples/mmap-test.cpp | 2 +- samples/path-test.cpp | 3 +-- samples/prevtest.cpp | 3 +-- samples/stringto-test.cpp | 2 +- samples/taglist.cpp | 3 +-- samples/write-test.cpp | 6 +----- samples/xmpsample.cpp | 3 --- src/orfimage.cpp | 20 +++++++----------- src/pngimage.cpp | 29 ++++++++++---------------- src/preview.cpp | 18 ++++++---------- src/properties.cpp | 15 ++++--------- src/psdimage.cpp | 20 +++++------------- src/rafimage.cpp | 18 ++++++---------- src/rw2image.cpp | 14 ++++++------- src/tags.cpp | 30 +++++--------------------- src/tgaimage.cpp | 13 ++++-------- src/tiffimage.cpp | 25 ++++++---------------- src/types.cpp | 17 ++++++--------- src/value.cpp | 13 +++--------- src/version.cpp | 2 -- src/webpimage.cpp | 27 ++++++------------------ src/xmp.cpp | 3 --- src/xmpsidecar.cpp | 19 ++++++----------- 42 files changed, 133 insertions(+), 308 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index 75e2383b..2faa67b7 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -1,49 +1,39 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" +#include "actions.hpp" #include "app_utils.hpp" -#include "actions.hpp" -#include "exiv2app.hpp" - -#include "image.hpp" -#include "jpgimage.hpp" -#include "xmpsidecar.hpp" -#include "types.hpp" -#include "exif.hpp" +#include "config.h" #include "easyaccess.hpp" -#include "iptc.hpp" -#include "xmp_exiv2.hpp" -#include "preview.hpp" +#include "exif.hpp" #include "futils.hpp" -#include "i18n.h" // NLS support. +#include "i18n.h" // NLS support. +#include "image.hpp" +#include "iptc.hpp" +#include "preview.hpp" +#include "types.hpp" +#include "xmp_exiv2.hpp" // + standard includes +#include // for stat() +#include // for stat() + #include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include +#include #include -#include -#include // for stat() -#include // for stat() +#include #ifdef EXV_HAVE_UNISTD_H -# include // for stat() +#include // for stat() #endif #if defined(_WIN32) || defined(__CYGWIN__) -# include #include #include #include +#include #else #include #endif diff --git a/app/actions.hpp b/app/actions.hpp index 3022c782..28e690f0 100644 --- a/app/actions.hpp +++ b/app/actions.hpp @@ -12,7 +12,6 @@ #define ACTIONS_HPP_ // ***************************************************************************** -// included header files #include "exiv2app.hpp" #include diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 2682342a..310e2f52 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -8,7 +8,6 @@ #include "exiv2app.hpp" #include "convert.hpp" -#include "futils.hpp" #include "getopt.hpp" #include "i18n.h" // NLS support. #include "xmp_exiv2.hpp" diff --git a/app/getopt.cpp b/app/getopt.cpp index 3c76ae27..f949fee0 100644 --- a/app/getopt.cpp +++ b/app/getopt.cpp @@ -1,17 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include -#include -#include -#include -#include -#include -#include -#include - #include "getopt.hpp" +#include +#include +#include + namespace fs = std::filesystem; namespace Util { diff --git a/app/getopt.hpp b/app/getopt.hpp index c6e5be9a..c92416fc 100644 --- a/app/getopt.hpp +++ b/app/getopt.hpp @@ -21,8 +21,6 @@ #ifndef GETOPT_H #define GETOPT_H -#include -#include #include namespace Util { diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index acb74c95..c8985656 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -11,10 +11,7 @@ // + standard includes #include -#include #include -#include -#include /*! @brief Macro to make calls to member functions through a pointer more readable. @@ -26,8 +23,6 @@ #define EXV_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember)) // ***************************************************************************** -// forward declarations -struct tm; // ***************************************************************************** // namespace extensions diff --git a/samples/addmoddel.cpp b/samples/addmoddel.cpp index b858f7a6..0adb6516 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -21,8 +21,8 @@ // Sample program showing how to add, modify and delete Exif metadata. #include + #include -#include #include int main(int argc, char* const argv[]) diff --git a/samples/convert-test.cpp b/samples/convert-test.cpp index 51d1318b..0580ea4d 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -21,8 +21,8 @@ // Conversion test driver - make sure you have a copy of the input file around! #include + #include -#include #include int main(int argc, char* const argv[]) diff --git a/samples/exifdata.cpp b/samples/exifdata.cpp index da235c67..40c4a8b2 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -21,8 +21,8 @@ // Sample program to format exif data in various external formats #include + #include -#include #include #include diff --git a/samples/exifvalue.cpp b/samples/exifvalue.cpp index 15485aff..b7c221c0 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -21,10 +21,9 @@ // Sample program to print value of an exif key in an image #include + #include -#include #include -#include int main(int argc, char* const argv[]) { diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index 47e24356..2e02bf65 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -21,25 +21,20 @@ // Sample program to print metadata in JSON format #include -#include "Jzon.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include + +#include "Jzon.h" + #if defined(__MINGW32__) || defined(__MINGW64__) -# ifndef __MINGW__ -# define __MINGW__ -# endif +#ifndef __MINGW__ +#define __MINGW__ +#endif #endif struct Token { diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 8351b91e..7cc0e5b2 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -22,24 +22,17 @@ // g++ geotag.cpp -o geotag -lexiv2 -lexpat #include - -#include -#include -#include -#include -#include +#include #include -#include -#include #include #include #include +#include -#include - -#include -#include +#include +#include +#include #if defined(__MINGW32__) || defined(__MINGW64__) # ifndef __MINGW__ diff --git a/samples/getopt-test.cpp b/samples/getopt-test.cpp index 690302a1..4f15dee7 100644 --- a/samples/getopt-test.cpp +++ b/samples/getopt-test.cpp @@ -48,8 +48,6 @@ #include #endif #include -#include -#include #define Safe(x) (x?x:"unknown") const char* optstring = ":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:"; diff --git a/samples/iotest.cpp b/samples/iotest.cpp index 7a7b8a5e..47e4f955 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -20,10 +20,8 @@ // ***************************************************************************** // included header files #include -#include // for EOF -#include + #include -#include using Exiv2::byte; using Exiv2::BasicIo; diff --git a/samples/iptceasy.cpp b/samples/iptceasy.cpp index 9363f4be..090ccf20 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -21,9 +21,8 @@ */ #include + #include -#include -#include int main(int argc, char* const argv[]) try { diff --git a/samples/iptcprint.cpp b/samples/iptcprint.cpp index a9a02643..1d5b888e 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -21,9 +21,8 @@ // Sample program to print the IPTC metadata of an image #include + #include -#include -#include int main(int argc, char* const argv[]) try { diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index 50a61f4d..9fb67a53 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -19,9 +19,8 @@ */ #include + #include -#include -#include using namespace Exiv2; diff --git a/samples/key-test.cpp b/samples/key-test.cpp index 6922a96d..ef09534c 100644 --- a/samples/key-test.cpp +++ b/samples/key-test.cpp @@ -19,9 +19,8 @@ */ #include + #include -#include -#include using namespace Exiv2; diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index 5c931dda..11c1227a 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -19,7 +19,6 @@ */ #include #include -#include #include // include local header files which are not part of libexiv2 diff --git a/samples/mmap-test.cpp b/samples/mmap-test.cpp index ae218431..7e834668 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -21,8 +21,8 @@ */ #include + #include -#include using namespace Exiv2; diff --git a/samples/path-test.cpp b/samples/path-test.cpp index 4f7a8d4a..5212ed8a 100644 --- a/samples/path-test.cpp +++ b/samples/path-test.cpp @@ -20,11 +20,10 @@ */ #include + #include #include #include -#include -#include namespace fs = std::filesystem; diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index 29e5b889..e5e07f6f 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -21,9 +21,8 @@ */ #include -#include + #include -#include int main(int argc, char* const argv[]) try { diff --git a/samples/stringto-test.cpp b/samples/stringto-test.cpp index 703ea81d..41dd82ea 100644 --- a/samples/stringto-test.cpp +++ b/samples/stringto-test.cpp @@ -21,8 +21,8 @@ */ #include + #include -#include static constexpr const char* testcases[] = { // bool diff --git a/samples/taglist.cpp b/samples/taglist.cpp index cc73bc0d..661eebb8 100644 --- a/samples/taglist.cpp +++ b/samples/taglist.cpp @@ -19,9 +19,8 @@ */ #include + #include -#include -#include using namespace Exiv2; diff --git a/samples/write-test.cpp b/samples/write-test.cpp index f084348d..6194393c 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -19,12 +19,8 @@ */ #include + #include -#include -#include -#include -#include -#include // ***************************************************************************** // local declarations diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index 173e9eb6..66fc7fba 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -22,10 +22,7 @@ #include -#include #include -#include -#include #include bool isEqual(float a, float b) diff --git a/src/orfimage.cpp b/src/orfimage.cpp index 640335e7..352f27c3 100644 --- a/src/orfimage.cpp +++ b/src/orfimage.cpp @@ -1,23 +1,17 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "orfimage.hpp" -#include "orfimage_int.hpp" -#include "tiffimage.hpp" -#include "tiffcomposite_int.hpp" -#include "tiffimage_int.hpp" -#include "image.hpp" + #include "basicio.hpp" +#include "config.h" #include "error.hpp" #include "futils.hpp" - -// + standard includes -#include -#include -#include -#include +#include "image.hpp" +#include "orfimage_int.hpp" +#include "tiffcomposite_int.hpp" +#include "tiffimage.hpp" +#include "tiffimage_int.hpp" // ***************************************************************************** // class member definitions diff --git a/src/pngimage.cpp b/src/pngimage.cpp index 39946f0f..6a0b9516 100644 --- a/src/pngimage.cpp +++ b/src/pngimage.cpp @@ -3,28 +3,21 @@ // included header files #include "config.h" -#ifdef EXV_HAVE_LIBZ -#include "pngchunk_int.hpp" -#include "pngimage.hpp" -#include "jpgimage.hpp" -#include "tiffimage.hpp" +#ifdef EXV_HAVE_LIBZ +#include // To uncompress IccProfiles + +#include "basicio.hpp" +#include "enforce.hpp" +#include "error.hpp" +#include "futils.hpp" #include "image.hpp" #include "image_int.hpp" -#include "basicio.hpp" -#include "error.hpp" -#include "enforce.hpp" -#include "futils.hpp" +#include "jpgimage.hpp" +#include "pngchunk_int.hpp" +#include "pngimage.hpp" +#include "tiffimage.hpp" #include "types.hpp" -// + standard includes -#include -#include -#include -#include -#include -#include - -#include // To uncompress IccProfiles // Signature from front of PNG file const unsigned char pngSignature[8] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }; diff --git a/src/preview.cpp b/src/preview.cpp index e885960c..d5e846df 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -1,25 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - -#include -#include -#include -#include - #include "preview.hpp" -#include "futils.hpp" -#include "enforce.hpp" -#include "safe_op.hpp" +#include "config.h" +#include "enforce.hpp" +#include "futils.hpp" #include "image.hpp" -#include "cr2image.hpp" #include "jpgimage.hpp" +#include "safe_op.hpp" #include "tiffimage.hpp" #include "tiffimage_int.hpp" -// ***************************************************************************** +#include + namespace { using namespace Exiv2; diff --git a/src/properties.cpp b/src/properties.cpp index 6cf00671..e0972fca 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -2,22 +2,15 @@ // included header files #include "properties.hpp" -#include "tags_int.hpp" + #include "error.hpp" +#include "i18n.h" // NLS support. +#include "metadatum.hpp" +#include "tags_int.hpp" #include "types.hpp" #include "value.hpp" -#include "metadatum.hpp" -#include "i18n.h" // NLS support. #include "xmp_exiv2.hpp" -#include -#include -#include -#include -#include -#include - -// ***************************************************************************** namespace { //! Struct used in the lookup table for pretty print functions diff --git a/src/psdimage.cpp b/src/psdimage.cpp index de491f95..75435dc6 100644 --- a/src/psdimage.cpp +++ b/src/psdimage.cpp @@ -1,25 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "psdimage.hpp" -#include "jpgimage.hpp" -#include "image.hpp" + #include "basicio.hpp" +#include "config.h" +#include "enforce.hpp" #include "error.hpp" #include "futils.hpp" - -#include "safe_op.hpp" -#include "enforce.hpp" - -// + standard includes -#include -#include -#include -#include -#include -#include +#include "image.hpp" +#include "jpgimage.hpp" // Todo: Consolidate with existing code in struct Photoshop (jpgimage.hpp): // Extend this helper to a proper class with all required functionality, diff --git a/src/rafimage.cpp b/src/rafimage.cpp index 75e7920f..5e883f99 100644 --- a/src/rafimage.cpp +++ b/src/rafimage.cpp @@ -1,23 +1,17 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "rafimage.hpp" -#include "tiffimage.hpp" -#include "image_int.hpp" -#include "image.hpp" + #include "basicio.hpp" +#include "config.h" +#include "enforce.hpp" #include "error.hpp" #include "futils.hpp" -#include "enforce.hpp" +#include "image.hpp" +#include "image_int.hpp" #include "safe_op.hpp" - -// +standard includes -#include -#include -#include -#include +#include "tiffimage.hpp" // ***************************************************************************** // class member definitions diff --git a/src/rw2image.cpp b/src/rw2image.cpp index 47be7da4..6d4605a6 100644 --- a/src/rw2image.cpp +++ b/src/rw2image.cpp @@ -1,20 +1,20 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "rw2image.hpp" + +#include "config.h" +#include "error.hpp" +#include "futils.hpp" +#include "image.hpp" +#include "preview.hpp" #include "rw2image_int.hpp" #include "tiffcomposite_int.hpp" #include "tiffimage_int.hpp" -#include "image.hpp" -#include "preview.hpp" -#include "error.hpp" -#include "futils.hpp" // + standard includes #ifdef EXIV2_DEBUG_MESSAGES -# include +#include #endif // ***************************************************************************** diff --git a/src/tags.cpp b/src/tags.cpp index 8badc90f..106bc2af 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -1,35 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "types.hpp" #include "tags.hpp" -#include "tags_int.hpp" -#include "error.hpp" -#include "futils.hpp" -#include "value.hpp" -#include "convert.hpp" -#include "i18n.h" // NLS support. #include "canonmn_int.hpp" #include "casiomn_int.hpp" -#include "fujimn_int.hpp" -#include "minoltamn_int.hpp" -#include "nikonmn_int.hpp" -#include "olympusmn_int.hpp" -#include "panasonicmn_int.hpp" -#include "pentaxmn_int.hpp" -#include "samsungmn_int.hpp" -#include "sigmamn_int.hpp" -#include "sonymn_int.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include +#include "convert.hpp" +#include "error.hpp" +#include "i18n.h" // NLS support. +#include "tags_int.hpp" +#include "types.hpp" // ***************************************************************************** // class member definitions diff --git a/src/tgaimage.cpp b/src/tgaimage.cpp index ee1705f1..c6115921 100644 --- a/src/tgaimage.cpp +++ b/src/tgaimage.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "tgaimage.hpp" -#include "image.hpp" + #include "basicio.hpp" +#include "config.h" #include "error.hpp" #include "futils.hpp" - -// + standard includes -#include -#include -#include +#include "image.hpp" // ***************************************************************************** // class member definitions @@ -21,7 +16,7 @@ namespace Exiv2 { TgaImage::TgaImage(BasicIo::UniquePtr io) : Image(ImageType::tga, mdNone, std::move(io)) { - } // TgaImage::TgaImage + } std::string TgaImage::mimeType() const { diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index f11e528e..20d9a06b 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -1,29 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "tiffimage.hpp" -#include "tiffimage_int.hpp" -#include "tiffcomposite_int.hpp" -#include "tiffvisitor_int.hpp" -#include "orfimage.hpp" -#include "makernote_int.hpp" -#include "nikonmn_int.hpp" -#include "image.hpp" -#include "image_int.hpp" + +#include "basicio.hpp" +#include "config.h" #include "error.hpp" #include "futils.hpp" +#include "image.hpp" +#include "tiffcomposite_int.hpp" +#include "tiffimage_int.hpp" #include "types.hpp" -#include "basicio.hpp" -#include "i18n.h" // NLS support. - -// + standard includes -#include -#include -#include -#include -#include /* -------------------------------------------------------------------------- diff --git a/src/types.cpp b/src/types.cpp index 1dd66936..5b955807 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -2,26 +2,21 @@ // included header files #include "types.hpp" + #include "enforce.hpp" #include "futils.hpp" #include "i18n.h" // for _exvGettext #include "safe_op.hpp" // + standard includes -#include -#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include // ***************************************************************************** namespace { diff --git a/src/value.cpp b/src/value.cpp index cf61b351..fa7c42a4 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -2,21 +2,14 @@ // included header files #include "value.hpp" -#include "types.hpp" + +#include "convert.hpp" #include "enforce.hpp" #include "error.hpp" -#include "convert.hpp" +#include "types.hpp" // + standard includes -#include -#include -#include -#include -#include -#include -#include -#include #include #include diff --git a/src/version.cpp b/src/version.cpp index 1616341b..f132ea13 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -6,7 +6,6 @@ #include #endif -#include "http.hpp" #include "version.hpp" #include "makernote_int.hpp" #include "futils.hpp" @@ -20,7 +19,6 @@ #include #include #include -#include // #1147 #ifndef WIN32 diff --git a/src/webpimage.cpp b/src/webpimage.cpp index c4302335..22bf202e 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -6,31 +6,16 @@ */ // included header files -#include "config.h" - #include "webpimage.hpp" -#include "image_int.hpp" + +#include "basicio.hpp" +#include "config.h" +#include "convert.hpp" #include "enforce.hpp" #include "futils.hpp" -#include "basicio.hpp" -#include "tags.hpp" -#include "tags_int.hpp" -#include "types.hpp" -#include "tiffimage.hpp" -#include "tiffimage_int.hpp" -#include "convert.hpp" +#include "image_int.hpp" #include "safe_op.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define CHECK_BIT(var,pos) ((var) & (1<<(pos))) +#include "types.hpp" namespace { [[maybe_unused]] std::string binaryToHex(const uint8_t* data, size_t size) diff --git a/src/xmp.cpp b/src/xmp.cpp index 133d38d6..5d19646e 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -8,10 +8,7 @@ #include "properties.hpp" // + standard includes -#include #include -#include -#include // Adobe XMP Toolkit #ifdef EXV_HAVE_XMP_TOOLKIT diff --git a/src/xmpsidecar.cpp b/src/xmpsidecar.cpp index 7aa8c380..11b64148 100644 --- a/src/xmpsidecar.cpp +++ b/src/xmpsidecar.cpp @@ -1,21 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#include "config.h" - #include "xmpsidecar.hpp" -#include "image.hpp" + #include "basicio.hpp" -#include "error.hpp" -#include "xmp_exiv2.hpp" -#include "futils.hpp" +#include "config.h" #include "convert.hpp" +#include "error.hpp" +#include "futils.hpp" +#include "image.hpp" +#include "xmp_exiv2.hpp" -// + standard includes -#include -#include -#include -#include - -// ***************************************************************************** namespace { constexpr auto xmlHeader = "\n"; const auto xmlHdrCnt = static_cast(std::strlen(xmlHeader)); // without the trailing 0-character From 5a6ec653150eb69226db67a462a281847943e625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 21:54:38 +0100 Subject: [PATCH 10/17] Use SPDX identifiers in more files --- app/app_utils.cpp | 2 ++ app/app_utils.hpp | 2 ++ app/exiv2app.hpp | 21 +-------------------- app/getopt.hpp | 20 +------------------- include/exiv2/easyaccess.hpp | 22 ++-------------------- samples/addmoddel.cpp | 21 +-------------------- samples/conntest.cpp | 21 +-------------------- samples/convert-test.cpp | 21 +-------------------- samples/easyaccess-test.cpp | 21 +-------------------- samples/exifcomment.cpp | 25 ++----------------------- samples/exifdata-test.cpp | 23 +---------------------- samples/exifdata.cpp | 21 +-------------------- samples/exifprint.cpp | 23 +---------------------- samples/exifvalue.cpp | 22 +--------------------- samples/exiv2json.cpp | 21 +-------------------- samples/geotag.cpp | 22 +--------------------- samples/getopt-test.cpp | 22 ++-------------------- samples/ini-test.cpp | 20 +------------------- samples/iotest.cpp | 22 +--------------------- samples/iptceasy.cpp | 21 +-------------------- samples/iptcprint.cpp | 21 +-------------------- samples/iptctest.cpp | 20 +------------------- samples/key-test.cpp | 20 +------------------- samples/largeiptc-test.cpp | 19 +------------------ samples/metacopy.cpp | 22 ++-------------------- samples/mmap-test.cpp | 21 +-------------------- samples/mrwthumb.cpp | 21 +-------------------- samples/path-test.cpp | 21 +-------------------- samples/prevtest.cpp | 21 +-------------------- samples/remotetest.cpp | 21 +-------------------- samples/stringto-test.cpp | 21 +-------------------- samples/taglist.cpp | 20 +------------------- samples/tiff-test.cpp | 22 +--------------------- samples/werror-test.cpp | 23 +---------------------- samples/write-test.cpp | 20 +------------------- samples/write2-test.cpp | 23 +---------------------- samples/xmpdump.cpp | 25 ++----------------------- samples/xmpparse.cpp | 23 +---------------------- samples/xmpparser-test.cpp | 23 +---------------------- samples/xmpprint.cpp | 29 ++--------------------------- samples/xmpsample.cpp | 21 +-------------------- 41 files changed, 49 insertions(+), 801 deletions(-) diff --git a/app/app_utils.cpp b/app/app_utils.cpp index 09aaf144..8027f68c 100644 --- a/app/app_utils.cpp +++ b/app/app_utils.cpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + #include #include diff --git a/app/app_utils.hpp b/app/app_utils.hpp index be8db686..e71c03b8 100644 --- a/app/app_utils.hpp +++ b/app/app_utils.hpp @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + #ifndef APP_UTILS_HPP_ #define APP_UTILS_HPP_ diff --git a/app/exiv2app.hpp b/app/exiv2app.hpp index 638f8004..5998df8a 100644 --- a/app/exiv2app.hpp +++ b/app/exiv2app.hpp @@ -1,24 +1,5 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later /*! - @file exiv2app.hpp @brief Defines class Params, used for the command line handling of exiv2 @author Andreas Huggel (ahu) ahuggel@gmx.net diff --git a/app/getopt.hpp b/app/getopt.hpp index c92416fc..e9a83976 100644 --- a/app/getopt.hpp +++ b/app/getopt.hpp @@ -1,22 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #ifndef GETOPT_H #define GETOPT_H diff --git a/include/exiv2/easyaccess.hpp b/include/exiv2/easyaccess.hpp index d51fb8ae..efda3168 100644 --- a/include/exiv2/easyaccess.hpp +++ b/include/exiv2/easyaccess.hpp @@ -1,24 +1,6 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later + /*! - @file easyaccess.hpp @brief Provides easy (high-level) access to some Exif meta data. @author Carsten Pfeiffer @date 28-Feb-09, gis: created diff --git a/samples/addmoddel.cpp b/samples/addmoddel.cpp index 0adb6516..69adb8ce 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// addmoddel.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program showing how to add, modify and delete Exif metadata. #include diff --git a/samples/conntest.cpp b/samples/conntest.cpp index 3537567d..9df8e969 100644 --- a/samples/conntest.cpp +++ b/samples/conntest.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// con-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Tester application for testing the http/https/ftp/ssh/sftp connection #include diff --git a/samples/convert-test.cpp b/samples/convert-test.cpp index 0580ea4d..420cf9b2 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// convert-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Conversion test driver - make sure you have a copy of the input file around! #include diff --git a/samples/easyaccess-test.cpp b/samples/easyaccess-test.cpp index 6ead23ab..fee22a57 100644 --- a/samples/easyaccess-test.cpp +++ b/samples/easyaccess-test.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// easyaccess-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program using high-level metadata access functions #include diff --git a/samples/exifcomment.cpp b/samples/exifcomment.cpp index df7fb0a8..89f643a7 100644 --- a/samples/exifcomment.cpp +++ b/samples/exifcomment.cpp @@ -1,26 +1,5 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -/* - Abstract : Sample program showing how to set the Exif comment of an image, - Exif.Photo.UserComment - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Abstract : Sample program showing how to set the Exif comment of an image, Exif.Photo.UserComment #include #include diff --git a/samples/exifdata-test.cpp b/samples/exifdata-test.cpp index 4f97604d..9abe339b 100644 --- a/samples/exifdata-test.cpp +++ b/samples/exifdata-test.cpp @@ -1,28 +1,7 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include #include -#include -#include -#include void write(const std::string& file, Exiv2::ExifData& ed); void print(const std::string& file); diff --git a/samples/exifdata.cpp b/samples/exifdata.cpp index 40c4a8b2..31e7d57a 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// exifdata.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to format exif data in various external formats #include diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 65ff5e47..8d5e80cf 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -1,28 +1,7 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include #include -#include -#include -#include #include // copied from src/tiffvisitor_int.cpp diff --git a/samples/exifvalue.cpp b/samples/exifvalue.cpp index b7c221c0..f87ec599 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -1,29 +1,9 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// exifvalue.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to print value of an exif key in an image #include #include -#include int main(int argc, char* const argv[]) { diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index 2e02bf65..5120e7fc 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// exiv2json.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to print metadata in JSON format #include diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 7cc0e5b2..3fe01ec0 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -1,25 +1,5 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// geotag.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to read gpx files and update images with GPS tags -// g++ geotag.cpp -o geotag -lexiv2 -lexpat #include #include diff --git a/samples/getopt-test.cpp b/samples/getopt-test.cpp index 4f15dee7..2588602e 100644 --- a/samples/getopt-test.cpp +++ b/samples/getopt-test.cpp @@ -1,23 +1,5 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// getopt-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later + // Sample program to test getopt() // Command: // $ getopt-test -v pr -P EIXxgklnycsvth file1 file2 diff --git a/samples/ini-test.cpp b/samples/ini-test.cpp index 9f737c35..24d6c7ba 100644 --- a/samples/ini-test.cpp +++ b/samples/ini-test.cpp @@ -1,22 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later /* 670 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ gcc ../src/ini.cpp ini-test.cpp -lstdc++ -o ini-test diff --git a/samples/iotest.cpp b/samples/iotest.cpp index 47e4f955..ba6ee082 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -1,24 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// ***************************************************************************** -// included header files +// SPDX-License-Identifier: GPL-2.0-or-later #include #include diff --git a/samples/iptceasy.cpp b/samples/iptceasy.cpp index 090ccf20..ae06c3a5 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -1,24 +1,5 @@ -// ***************************************************************** -*- C++ -*- -// iptceasy.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // The quickest way to access, set or modify IPTC metadata. -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include diff --git a/samples/iptcprint.cpp b/samples/iptcprint.cpp index 1d5b888e..4a685a9f 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// iptcprint.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to print the IPTC metadata of an image #include diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index 9fb67a53..ed413a31 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -1,22 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include diff --git a/samples/key-test.cpp b/samples/key-test.cpp index ef09534c..05636594 100644 --- a/samples/key-test.cpp +++ b/samples/key-test.cpp @@ -1,22 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index 0ba4ea28..d62ae3f9 100644 --- a/samples/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -1,24 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later // ***************************************************************** -*- C++ -*- // Test for large (>65535 bytes) IPTC buffer // ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include #include diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index 11c1227a..ff376ac5 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -1,25 +1,7 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later + #include #include -#include // include local header files which are not part of libexiv2 #include "getopt.hpp" diff --git a/samples/mmap-test.cpp b/samples/mmap-test.cpp index 7e834668..17133f18 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -1,24 +1,5 @@ -// ***************************************************************** -*- C++ -*- -// mmap-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Simple mmap tests -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include diff --git a/samples/mrwthumb.cpp b/samples/mrwthumb.cpp index 3b2a96ae..8656c51b 100644 --- a/samples/mrwthumb.cpp +++ b/samples/mrwthumb.cpp @@ -1,24 +1,5 @@ -// ***************************************************************** -*- C++ -*- -// mrwthumb.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to extract a Minolta thumbnail from the makernote -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include #include diff --git a/samples/path-test.cpp b/samples/path-test.cpp index 5212ed8a..a7877961 100644 --- a/samples/path-test.cpp +++ b/samples/path-test.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -// path-test.cpp -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index e5e07f6f..25960e33 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -1,24 +1,5 @@ -// ***************************************************************** -*- C++ -*- -// prevtest.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Test access to preview images -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include diff --git a/samples/remotetest.cpp b/samples/remotetest.cpp index 8fbc6b8c..aa78988d 100644 --- a/samples/remotetest.cpp +++ b/samples/remotetest.cpp @@ -1,26 +1,7 @@ -// ***************************************************************** -*- C++ -*- -// remotetest.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Tester application for testing remote i/o. // It makes some modifications on the metadata of remote file, reads new metadata from that file // and reset the metadata back to the original status. -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include #include diff --git a/samples/stringto-test.cpp b/samples/stringto-test.cpp index 41dd82ea..0d5c3291 100644 --- a/samples/stringto-test.cpp +++ b/samples/stringto-test.cpp @@ -1,24 +1,5 @@ -// ***************************************************************** -*- C++ -*- -// stringto-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Test conversions from string to long, float and Rational types. -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ #include diff --git a/samples/taglist.cpp b/samples/taglist.cpp index 661eebb8..cc01839e 100644 --- a/samples/taglist.cpp +++ b/samples/taglist.cpp @@ -1,22 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include diff --git a/samples/tiff-test.cpp b/samples/tiff-test.cpp index 27f7b09a..17239357 100644 --- a/samples/tiff-test.cpp +++ b/samples/tiff-test.cpp @@ -1,24 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ - -// tiff-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // First and very simple TIFF write test. #include diff --git a/samples/werror-test.cpp b/samples/werror-test.cpp index 227bf232..fad6fb06 100644 --- a/samples/werror-test.cpp +++ b/samples/werror-test.cpp @@ -1,25 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ - -// ***************************************************************** -*- C++ -*- -// werror-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Simple tests for the wide-string error class WError #include diff --git a/samples/write-test.cpp b/samples/write-test.cpp index 6194393c..14681aed 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -1,22 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include diff --git a/samples/write2-test.cpp b/samples/write2-test.cpp index 06bb8d8f..a47db8cb 100644 --- a/samples/write2-test.cpp +++ b/samples/write2-test.cpp @@ -1,28 +1,7 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include #include -#include -#include -#include void write(const std::string& file, Exiv2::ExifData& ed); void print(const std::string& file); diff --git a/samples/xmpdump.cpp b/samples/xmpdump.cpp index 5c884598..30a1d1c5 100644 --- a/samples/xmpdump.cpp +++ b/samples/xmpdump.cpp @@ -1,29 +1,8 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ - -// xmpdump.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to dump the XMP packet of an image + #include -#include #include -#include int main(int argc, char* const argv[]) { diff --git a/samples/xmpparse.cpp b/samples/xmpparse.cpp index 70af215b..5ced9765 100644 --- a/samples/xmpparse.cpp +++ b/samples/xmpparse.cpp @@ -1,29 +1,8 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// xmpparse.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Read an XMP packet from a file, parse it and print all (known) properties. #include -#include #include -#include int main(int argc, char* const argv[]) try { diff --git a/samples/xmpparser-test.cpp b/samples/xmpparser-test.cpp index 985f4c64..f141bf35 100644 --- a/samples/xmpparser-test.cpp +++ b/samples/xmpparser-test.cpp @@ -1,29 +1,8 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// xmpparser-test.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Read an XMP packet from a file, parse and re-serialize it. #include -#include #include -#include int main(int argc, char* const argv[]) try { diff --git a/samples/xmpprint.cpp b/samples/xmpprint.cpp index 7b160d46..b739122e 100644 --- a/samples/xmpprint.cpp +++ b/samples/xmpprint.cpp @@ -1,30 +1,5 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ - -// xmpprint.cpp -// Read an XMP from a video or graphic file, parse it and print -// all (known) properties. -// ======================================================================== -// Linux standalone compilation : -// g++ -o xmpprint xmpprint.cpp `pkg-config --cflags --libs exiv2` -// ======================================================================== +// SPDX-License-Identifier: GPL-2.0-or-later +// Read an XMP from a video or graphic file, parse it and print all (known) properties. #include #include diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index 66fc7fba..e2067de5 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -1,23 +1,4 @@ -// ***************************************************************** -*- C++ -*- -/* - * Copyright (C) 2004-2021 Exiv2 authors - * This program is part of the Exiv2 distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. - */ -// xmpsample.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample/test for high level XMP classes. See also addmoddel.cpp #include From f156af46f3b7694dd4a973e4b0d5345f79d96ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 22:06:35 +0100 Subject: [PATCH 11/17] Fix build on Windows --- include/exiv2/error.hpp | 8 +++++--- include/exiv2/ini.hpp | 2 ++ include/exiv2/types.hpp | 3 ++- src/jp2image.cpp | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/exiv2/error.hpp b/include/exiv2/error.hpp index 7eb7923f..863e73bc 100644 --- a/include/exiv2/error.hpp +++ b/include/exiv2/error.hpp @@ -14,9 +14,11 @@ // ***************************************************************************** #include "exiv2lib_export.h" -#include // for exception -#include // for operator<<, ostream, ostringstream, bas... -#include // for basic_string, string +#include "config.h" + +#include // for exception +#include // for operator<<, ostream, ostringstream, bas... +#include // for basic_string, string // ***************************************************************************** // namespace extensions diff --git a/include/exiv2/ini.hpp b/include/exiv2/ini.hpp index c45905fc..4b53244a 100755 --- a/include/exiv2/ini.hpp +++ b/include/exiv2/ini.hpp @@ -11,6 +11,8 @@ #include "exiv2lib_export.h" +#include "config.h" + #include #include diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index c8985656..0d08eee8 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -9,9 +9,10 @@ #include "config.h" #include "slice.hpp" -// + standard includes +// standard includes #include #include +#include /*! @brief Macro to make calls to member functions through a pointer more readable. diff --git a/src/jp2image.cpp b/src/jp2image.cpp index 54fbc92c..fafc0893 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -14,6 +14,8 @@ #include "types.hpp" #include "safe_op.hpp" +#include + // JPEG-2000 box types const uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h' const uint32_t kJp2BoxTypeImageHeader = 0x69686472; // 'ihdr' From bbc99ae581744767f00d5c6fdf0963fba97996b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 22:21:20 +0100 Subject: [PATCH 12/17] Use auto for unique pointers --- samples/addmoddel.cpp | 4 +--- samples/convert-test.cpp | 3 +-- samples/easyaccess-test.cpp | 3 +-- samples/exifcomment.cpp | 15 +++++---------- samples/exifdata-test.cpp | 10 ++++------ samples/exifdata.cpp | 3 +-- samples/exifprint.cpp | 3 +-- samples/exifvalue.cpp | 3 +-- samples/geotag.cpp | 3 +-- samples/iotest.cpp | 2 +- samples/iptceasy.cpp | 4 +--- samples/iptcprint.cpp | 3 +-- samples/iptctest.cpp | 3 +-- samples/largeiptc-test.cpp | 6 +++--- samples/metacopy.cpp | 6 ++---- samples/mmap-test.cpp | 3 +-- samples/mrwthumb.cpp | 3 +-- samples/prevtest.cpp | 3 +-- samples/remotetest.cpp | 6 ++---- samples/write-test.cpp | 6 ++---- samples/write2-test.cpp | 17 +++++++---------- samples/xmpdump.cpp | 3 +-- samples/xmpparse.cpp | 1 + samples/xmpprint.cpp | 3 +-- samples/xmpsample.cpp | 2 +- src/futils.cpp | 1 + 26 files changed, 44 insertions(+), 75 deletions(-) diff --git a/samples/addmoddel.cpp b/samples/addmoddel.cpp index 69adb8ce..09080fea 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -103,9 +103,7 @@ try { // ************************************************************************* // Finally, write the remaining Exif data to the image file - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); - + auto image = Exiv2::ImageFactory::open(file); image->setExifData(exifData); image->writeMetadata(); diff --git a/samples/convert-test.cpp b/samples/convert-test.cpp index 420cf9b2..2d05f740 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -19,8 +19,7 @@ try { return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); Exiv2::XmpData xmpData; diff --git a/samples/easyaccess-test.cpp b/samples/easyaccess-test.cpp index fee22a57..ea8b7345 100644 --- a/samples/easyaccess-test.cpp +++ b/samples/easyaccess-test.cpp @@ -63,8 +63,7 @@ try { return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); Exiv2::ExifData& ed = image->exifData(); diff --git a/samples/exifcomment.cpp b/samples/exifcomment.cpp index 89f643a7..880c38ff 100644 --- a/samples/exifcomment.cpp +++ b/samples/exifcomment.cpp @@ -20,8 +20,7 @@ try { return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); @@ -37,14 +36,10 @@ try { Following are a few examples of valid comments. The last one is written to the file. */ - exifData["Exif.Photo.UserComment"] - = "charset=Unicode A Unicode Exif comment added with Exiv2"; - exifData["Exif.Photo.UserComment"] - = "charset=Undefined An undefined Exif comment added with Exiv2"; - exifData["Exif.Photo.UserComment"] - = "Another undefined Exif comment added with Exiv2"; - exifData["Exif.Photo.UserComment"] - = "charset=Ascii An ASCII Exif comment added with Exiv2"; + exifData["Exif.Photo.UserComment"] = "charset=Unicode A Unicode Exif comment added with Exiv2"; + exifData["Exif.Photo.UserComment"] = "charset=Undefined An undefined Exif comment added with Exiv2"; + exifData["Exif.Photo.UserComment"] = "Another undefined Exif comment added with Exiv2"; + exifData["Exif.Photo.UserComment"] = "charset=Ascii An ASCII Exif comment added with Exiv2"; std::cout << "Writing user comment '" << exifData["Exif.Photo.UserComment"] diff --git a/samples/exifdata-test.cpp b/samples/exifdata-test.cpp index 9abe339b..3ae5f6ec 100644 --- a/samples/exifdata-test.cpp +++ b/samples/exifdata-test.cpp @@ -23,8 +23,8 @@ try { } std::string file(argv[1]); - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); + assert (image); image->readMetadata(); Exiv2::ExifData &ed = image->exifData(); @@ -96,16 +96,14 @@ catch (Exiv2::AnyError& e) { void write(const std::string& file, Exiv2::ExifData& ed) { - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->setExifData(ed); image->writeMetadata(); } void print(const std::string& file) { - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); Exiv2::ExifData &ed = image->exifData(); diff --git a/samples/exifdata.cpp b/samples/exifdata.cpp index 31e7d57a..18d87940 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -184,8 +184,7 @@ int main(int argc,const char* argv[]) } if ( !result ) try { - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 8d5e80cf..124f37a8 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -63,8 +63,7 @@ try { return rc; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); diff --git a/samples/exifvalue.cpp b/samples/exifvalue.cpp index f87ec599..55ceb02e 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -21,8 +21,7 @@ int main(int argc, char* const argv[]) const char* file = argv[1]; const char* key = argv[2]; - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 3fe01ec0..9a377c87 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -391,14 +391,13 @@ time_t parseTime(const char* arg,bool bAdjust) // West of GMT is negative (PDT = Pacific Daylight = -07:00 == -25200 seconds int timeZoneAdjust() { - time_t now = time(nullptr); + [[maybe_unused]] time_t now = time(nullptr); int offset; #if defined(_MSC_VER) || defined(__MINGW__) TIME_ZONE_INFORMATION TimeZoneInfo; GetTimeZoneInformation( &TimeZoneInfo ); offset = - (((int)TimeZoneInfo.Bias + (int)TimeZoneInfo.DaylightBias) * 60); - UNUSED(now); #elif defined(__CYGWIN__) struct tm lcopy = *localtime(&now); time_t gmt = timegm(&lcopy) ; // timegm modifies lcopy diff --git a/samples/iotest.cpp b/samples/iotest.cpp index ba6ee082..8a538b95 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -49,7 +49,7 @@ int main(int argc, char* const argv[]) std::vector bytes (blocksize); // copy fileIn from a remote location. - BasicIo::UniquePtr io = Exiv2::ImageFactory::createIo(fr); + auto io = Exiv2::ImageFactory::createIo(fr); if ( io->open() != 0 ) { Error(Exiv2::kerFileOpenFailed, io->path(), "rb", strError()); } diff --git a/samples/iptceasy.cpp b/samples/iptceasy.cpp index ae06c3a5..99afcae0 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -37,9 +37,7 @@ try { std::cout << "Time sent: " << iptcData["Iptc.Envelope.TimeSent"] << "\n"; // Open image file - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert (image.get() != 0); - + auto image = Exiv2::ImageFactory::open(file); // Set IPTC data and write it to the file image->setIptcData(iptcData); image->writeMetadata(); diff --git a/samples/iptcprint.cpp b/samples/iptcprint.cpp index 4a685a9f..f7eea57a 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -18,8 +18,7 @@ try { return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); Exiv2::IptcData &iptcData = image->iptcData(); diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index ed413a31..36703700 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -29,8 +29,7 @@ int main(int argc, char* const argv[]) return 1; } - Image::UniquePtr image = ImageFactory::open(argv[1]); - assert (image.get() != 0); + auto image = ImageFactory::open(argv[1]); image->readMetadata(); // Process commands diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index d62ae3f9..d4d5b4dc 100644 --- a/samples/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -28,7 +28,8 @@ int main(int argc, char* const argv[]) if (io.open() != 0) { throw Exiv2::Error(Exiv2::kerDataSourceOpenFailed, io.path(), Exiv2::strError()); } - Exiv2::DataBuf buf(static_cast(io.size())); + + Exiv2::DataBuf buf(io.size()); std::cout << "Reading " << buf.size() << " bytes from " << data << "\n"; const size_t readBytes = io.read(buf.data(), buf.size()); if (readBytes != buf.size() || io.error() || io.eof()) { @@ -36,8 +37,7 @@ int main(int argc, char* const argv[]) } // Read metadata from file - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); // Set Preview field to the content of the data file diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index ff376ac5..5062b014 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -34,12 +34,10 @@ try { auto memIo = std::make_unique(); memIo->transfer(fileIo); - Exiv2::Image::UniquePtr readImg = Exiv2::ImageFactory::open(std::move(memIo)); - assert(readImg.get() != 0); + auto readImg = Exiv2::ImageFactory::open(std::move(memIo)); readImg->readMetadata(); - Exiv2::Image::UniquePtr writeImg = Exiv2::ImageFactory::open(params.write_); - assert(writeImg.get() != 0); + auto writeImg = Exiv2::ImageFactory::open(params.write_); if (params.preserve_) { writeImg->readMetadata(); } diff --git a/samples/mmap-test.cpp b/samples/mmap-test.cpp index 17133f18..a12ba7a5 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -28,8 +28,7 @@ try { } // Map it to memory const Exiv2::byte* pData = file.mmap(); - auto size = static_cast(file.size()); - DataBuf buf(size); + DataBuf buf(file.size()); // Read from the memory mapped region buf.copyBytes(0, pData, buf.size()); // Reopen file in write mode and write to it diff --git a/samples/mrwthumb.cpp b/samples/mrwthumb.cpp index 8656c51b..323b0346 100644 --- a/samples/mrwthumb.cpp +++ b/samples/mrwthumb.cpp @@ -19,8 +19,7 @@ int main(int argc, char* const argv[]) return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index 25960e33..f4065a3d 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -19,8 +19,7 @@ try { } std::string filename(argv[1]); - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(filename); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(filename); image->readMetadata(); Exiv2::PreviewManager loader(*image); diff --git a/samples/remotetest.cpp b/samples/remotetest.cpp index aa78988d..a08a494e 100644 --- a/samples/remotetest.cpp +++ b/samples/remotetest.cpp @@ -44,15 +44,13 @@ try { Exiv2::ExifKey key("Exif.Image.DateTime"); exifData.add(key, v.get()); - Exiv2::Image::UniquePtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); - assert(writeTest.get() != 0); + auto writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); writeTest->setExifData(exifData); writeTest->writeMetadata(); // read the result to make sure everything fine std::cout << "Print out the new metadata ...\n"; - Exiv2::Image::UniquePtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); - assert(readTest.get() != 0); + auto readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); readTest->readMetadata(); Exiv2::ExifData &exifReadData = readTest->exifData(); if (exifReadData.empty()) { diff --git a/samples/write-test.cpp b/samples/write-test.cpp index 14681aed..2bb1e320 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -148,8 +148,7 @@ void testCase(const std::string& file1, ExifKey ek(key); //Open first image - Image::UniquePtr image1 = ImageFactory::open(file1); - assert(image1.get() != 0); + auto image1 = ImageFactory::open(file1); // Load existing metadata std::cerr << "---> Reading file " << file1 << "\n"; @@ -164,8 +163,7 @@ void testCase(const std::string& file1, pos->setValue(value); // Open second image - Image::UniquePtr image2 = ImageFactory::open(file2); - assert(image2.get() != 0); + auto image2 = ImageFactory::open(file2); image2->setExifData(image1->exifData()); diff --git a/samples/write2-test.cpp b/samples/write2-test.cpp index a47db8cb..a1a11690 100644 --- a/samples/write2-test.cpp +++ b/samples/write2-test.cpp @@ -27,19 +27,19 @@ int main(int argc, char* const argv[]) Exiv2::ExifData ed1; ed1["Exif.Image.Model"] = "Test 1"; - Exiv2::Value::UniquePtr v1 = Exiv2::Value::create(Exiv2::unsignedShort); + auto v1 = Exiv2::Value::create(Exiv2::unsignedShort); v1->read("160 161 162 163"); ed1.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v1.get()); - Exiv2::Value::UniquePtr v2 = Exiv2::Value::create(Exiv2::signedLong); + auto v2 = Exiv2::Value::create(Exiv2::signedLong); v2->read("-2 -1 0 1"); ed1.add(Exiv2::ExifKey("Exif.Image.XResolution"), v2.get()); - Exiv2::Value::UniquePtr v3 = Exiv2::Value::create(Exiv2::signedRational); + auto v3 = Exiv2::Value::create(Exiv2::signedRational); v3->read("-2/3 -1/3 0/3 1/3"); ed1.add(Exiv2::ExifKey("Exif.Image.YResolution"), v3.get()); - Exiv2::Value::UniquePtr v4 = Exiv2::Value::create(Exiv2::undefined); + auto v4 = Exiv2::Value::create(Exiv2::undefined); v4->read("255 254 253 252"); ed1.add(Exiv2::ExifKey("Exif.Image.WhitePoint"), v4.get()); @@ -66,8 +66,7 @@ int main(int argc, char* const argv[]) print(file); std::cout <<"\n----- Non-intrusive writing of special Canon MakerNote tags\n"; - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); Exiv2::ExifData& rEd = image->exifData(); @@ -198,8 +197,7 @@ catch (Exiv2::AnyError& e) { void write(const std::string& file, Exiv2::ExifData& ed) { - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->setExifData(ed); image->writeMetadata(); @@ -207,8 +205,7 @@ void write(const std::string& file, Exiv2::ExifData& ed) void print(const std::string& file) { - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(file); image->readMetadata(); Exiv2::ExifData &ed = image->exifData(); diff --git a/samples/xmpdump.cpp b/samples/xmpdump.cpp index 30a1d1c5..27046816 100644 --- a/samples/xmpdump.cpp +++ b/samples/xmpdump.cpp @@ -18,8 +18,7 @@ int main(int argc, char* const argv[]) return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert(image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); const std::string& xmpPacket = image->xmpPacket(); diff --git a/samples/xmpparse.cpp b/samples/xmpparse.cpp index 5ced9765..7a3c4b70 100644 --- a/samples/xmpparse.cpp +++ b/samples/xmpparse.cpp @@ -16,6 +16,7 @@ try { std::cout << "Usage: " << argv[0] << " file\n"; return 1; } + Exiv2::DataBuf buf = Exiv2::readFile(argv[1]); std::string xmpPacket; xmpPacket.assign(buf.c_str(), buf.size()); diff --git a/samples/xmpprint.cpp b/samples/xmpprint.cpp index b739122e..d31be898 100644 --- a/samples/xmpprint.cpp +++ b/samples/xmpprint.cpp @@ -23,8 +23,7 @@ int main(int argc, char** argv) return 1; } - Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); - assert (image.get() != 0); + auto image = Exiv2::ImageFactory::open(argv[1]); image->readMetadata(); Exiv2::XmpData &xmpData = image->xmpData(); diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index e2067de5..5c67d954 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -107,7 +107,7 @@ try { // properties and language alternatives. // Add a simple XMP property in a known namespace - Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpText); + auto v = Exiv2::Value::create(Exiv2::xmpText); v->read("image/jpeg"); xmpData.add(Exiv2::XmpKey("Xmp.dc.format"), v.get()); diff --git a/src/futils.cpp b/src/futils.cpp index 438669e5..e5292451 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -4,6 +4,7 @@ #include "futils.hpp" #include "config.h" +#include "error.hpp" // + standard includes #include From c146ae5215584fd0db656bd89e66afb74c4dfa54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 22:25:06 +0100 Subject: [PATCH 13/17] Fix mac build --- src/futils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/futils.cpp b/src/futils.cpp index e5292451..529d717a 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -4,6 +4,7 @@ #include "futils.hpp" #include "config.h" +#include "enforce.hpp" #include "error.hpp" // + standard includes From c0a3242e73035e246843a7473bb8d68e005ab247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 8 Mar 2022 10:05:27 +0100 Subject: [PATCH 14/17] C++-style headers --- samples/geotag.cpp | 3 --- src/helper_functions.cpp | 3 ++- src/http.cpp | 1 - src/image_int.hpp | 4 ++-- src/ini.cpp | 3 +-- src/minoltamn_int.cpp | 4 +--- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 9a377c87..f05c115a 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -4,11 +4,8 @@ #include #include -#include -#include #include #include -#include #include #include diff --git a/src/helper_functions.cpp b/src/helper_functions.cpp index 07820fc1..42915352 100644 --- a/src/helper_functions.cpp +++ b/src/helper_functions.cpp @@ -1,7 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "helper_functions.hpp" -#include + +#include std::string string_from_unterminated(const char* data, size_t data_length) { diff --git a/src/http.cpp b/src/http.cpp index 52b00d39..90fffc03 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -10,7 +10,6 @@ #include "http.hpp" #include "futils.hpp" -#include #include //////////////////////////////////////// diff --git a/src/image_int.hpp b/src/image_int.hpp index 3158b3de..4278b307 100644 --- a/src/image_int.hpp +++ b/src/image_int.hpp @@ -7,8 +7,8 @@ // included header files #include "slice.hpp" // for Slice -#include // for size_t -#include // for int32_t +#include // for size_t +#include // for int32_t #include // for ostream, basic_ostream::put #include diff --git a/src/ini.cpp b/src/ini.cpp index c3527653..036d7797 100755 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -16,8 +16,7 @@ using std::string; using namespace Exiv2; -#include -#include +#include #if !INI_USE_STACK #include diff --git a/src/minoltamn_int.cpp b/src/minoltamn_int.cpp index 2e549447..89bd0988 100644 --- a/src/minoltamn_int.cpp +++ b/src/minoltamn_int.cpp @@ -8,11 +8,9 @@ #include "exif.hpp" #include "i18n.h" // NLS support. -#include #include -#include -#include // popen to call exiftool +#include // popen to call exiftool // ***************************************************************************** // class member definitions From cca6f74200f461c4b0a6d66fa46e88e1097a07c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 8 Mar 2022 10:07:25 +0100 Subject: [PATCH 15/17] windows.h --- app/actions.cpp | 2 +- app/exiv2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index 2faa67b7..8fe342d3 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -30,7 +30,7 @@ #endif #if defined(_WIN32) || defined(__CYGWIN__) -#include +#include #include #include #include diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 310e2f52..6573c0c4 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -21,7 +21,7 @@ #include #if defined(_WIN32) || defined(__CYGWIN__) -#include +#include #include #include #else From f894ee0568080ed19d301dfbae155b5f0b6025a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 8 Mar 2022 10:13:22 +0100 Subject: [PATCH 16/17] Fix debug builds --- samples/xmpsample.cpp | 5 +++-- src/bmpimage.cpp | 1 + src/cr2image.cpp | 2 ++ src/crwimage.cpp | 2 ++ src/gifimage.cpp | 2 ++ src/iptc.cpp | 1 + src/jp2image.cpp | 1 + src/jpgimage.cpp | 2 ++ src/mrwimage.cpp | 2 ++ src/orfimage.cpp | 2 ++ src/pgfimage.cpp | 2 ++ src/pngimage.cpp | 2 ++ src/properties.cpp | 2 ++ src/psdimage.cpp | 2 ++ src/rafimage.cpp | 2 ++ src/tgaimage.cpp | 2 ++ src/tiffcomposite_int.cpp | 2 ++ src/tiffimage.cpp | 2 ++ src/tiffimage_int.cpp | 2 ++ src/tiffvisitor_int.cpp | 1 + src/webpimage.cpp | 2 ++ src/xmp.cpp | 1 + src/xmpsidecar.cpp | 2 ++ 23 files changed, 42 insertions(+), 2 deletions(-) diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index 5c67d954..81042953 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -3,8 +3,9 @@ #include -#include +#include #include +#include bool isEqual(float a, float b) { @@ -79,7 +80,7 @@ try { [[maybe_unused]] const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value(); assert(getv6.toInt64() == 0); - assert(getv6.ok()^); + assert(getv6.ok()); assert(getv6.toFloat() == 0.0f); assert(getv6.ok()); assert(getv6.toRational() == Exiv2::Rational(0, 1)); diff --git a/src/bmpimage.cpp b/src/bmpimage.cpp index 78416cfd..f60c0e25 100644 --- a/src/bmpimage.cpp +++ b/src/bmpimage.cpp @@ -14,6 +14,7 @@ // + standard includes #include #include +#include // ***************************************************************************** // class member definitions diff --git a/src/cr2image.cpp b/src/cr2image.cpp index 546a197d..264e5b04 100644 --- a/src/cr2image.cpp +++ b/src/cr2image.cpp @@ -11,6 +11,8 @@ #include "tiffcomposite_int.hpp" #include "tiffimage_int.hpp" +#include + // ***************************************************************************** // class member definitions namespace Exiv2 { diff --git a/src/crwimage.cpp b/src/crwimage.cpp index 7b61aa57..f584cbf1 100644 --- a/src/crwimage.cpp +++ b/src/crwimage.cpp @@ -13,6 +13,8 @@ #include "futils.hpp" #include "tags.hpp" +#include + // ***************************************************************************** // class member definitions namespace Exiv2 { diff --git a/src/gifimage.cpp b/src/gifimage.cpp index 3bc4c797..4ae6976c 100644 --- a/src/gifimage.cpp +++ b/src/gifimage.cpp @@ -7,6 +7,8 @@ #include "error.hpp" #include "futils.hpp" +#include + // ***************************************************************************** // class member definitions namespace Exiv2 { diff --git a/src/iptc.cpp b/src/iptc.cpp index 25d93d15..53908c17 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -12,6 +12,7 @@ // + standard includes #include +#include // ***************************************************************************** namespace { diff --git a/src/jp2image.cpp b/src/jp2image.cpp index fafc0893..2d2dbbcc 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -15,6 +15,7 @@ #include "safe_op.hpp" #include +#include // JPEG-2000 box types const uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h' diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp index 5edf737a..2be1c3e2 100644 --- a/src/jpgimage.cpp +++ b/src/jpgimage.cpp @@ -21,6 +21,8 @@ #include "fff.h" +#include + // ***************************************************************************** // class member definitions diff --git a/src/mrwimage.cpp b/src/mrwimage.cpp index c529cb34..639392b0 100644 --- a/src/mrwimage.cpp +++ b/src/mrwimage.cpp @@ -11,6 +11,8 @@ #include "image.hpp" #include "tiffimage.hpp" +#include + namespace Exiv2 { MrwImage::MrwImage(BasicIo::UniquePtr io, bool /*create*/) diff --git a/src/orfimage.cpp b/src/orfimage.cpp index 352f27c3..3412a577 100644 --- a/src/orfimage.cpp +++ b/src/orfimage.cpp @@ -13,6 +13,8 @@ #include "tiffimage.hpp" #include "tiffimage_int.hpp" +#include + // ***************************************************************************** // class member definitions namespace Exiv2 { diff --git a/src/pgfimage.cpp b/src/pgfimage.cpp index 89eec775..daab5b3c 100644 --- a/src/pgfimage.cpp +++ b/src/pgfimage.cpp @@ -10,6 +10,8 @@ #include "futils.hpp" #include "image.hpp" +#include + // Signature from front of PGF file const unsigned char pgfSignature[3] = { 0x50, 0x47, 0x46 }; diff --git a/src/pngimage.cpp b/src/pngimage.cpp index 6a0b9516..c1a26d6c 100644 --- a/src/pngimage.cpp +++ b/src/pngimage.cpp @@ -18,6 +18,8 @@ #include "tiffimage.hpp" #include "types.hpp" +#include + // Signature from front of PNG file const unsigned char pngSignature[8] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }; diff --git a/src/properties.cpp b/src/properties.cpp index e0972fca..ac8dff7a 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -11,6 +11,8 @@ #include "value.hpp" #include "xmp_exiv2.hpp" +#include + namespace { //! Struct used in the lookup table for pretty print functions diff --git a/src/psdimage.cpp b/src/psdimage.cpp index 75435dc6..13dea7c4 100644 --- a/src/psdimage.cpp +++ b/src/psdimage.cpp @@ -11,6 +11,8 @@ #include "image.hpp" #include "jpgimage.hpp" +#include + // Todo: Consolidate with existing code in struct Photoshop (jpgimage.hpp): // Extend this helper to a proper class with all required functionality, // then move it here or into a separate file? diff --git a/src/rafimage.cpp b/src/rafimage.cpp index 5e883f99..5d12fe75 100644 --- a/src/rafimage.cpp +++ b/src/rafimage.cpp @@ -13,6 +13,8 @@ #include "safe_op.hpp" #include "tiffimage.hpp" +#include + // ***************************************************************************** // class member definitions namespace Exiv2 { diff --git a/src/tgaimage.cpp b/src/tgaimage.cpp index c6115921..437c6147 100644 --- a/src/tgaimage.cpp +++ b/src/tgaimage.cpp @@ -9,6 +9,8 @@ #include "futils.hpp" #include "image.hpp" +#include + // ***************************************************************************** // class member definitions namespace Exiv2 { diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 27b8f068..b6991c3e 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -11,6 +11,8 @@ #include "error.hpp" #include "enforce.hpp" +#include + // ***************************************************************************** namespace { //! Add \em tobe - \em curr 0x00 filler bytes if necessary diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index 20d9a06b..bffd7ce7 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -12,6 +12,8 @@ #include "tiffimage_int.hpp" #include "types.hpp" +#include + /* -------------------------------------------------------------------------- Todo: diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index bd04897c..eb221adf 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -8,6 +8,8 @@ #include "tiffvisitor_int.hpp" #include "i18n.h" // NLS support. +#include + // Shortcuts for the newTiffBinaryArray templates. #define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&arrayCfg, EXV_COUNTOF(arrayDef), arrayDef>) #define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>) diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index bfed835d..0c2aa35e 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -14,6 +14,7 @@ #include "jpgimage.hpp" #include "sonymn_int.hpp" +#include // ***************************************************************************** namespace { diff --git a/src/webpimage.cpp b/src/webpimage.cpp index 22bf202e..ddf83ea1 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -17,6 +17,8 @@ #include "safe_op.hpp" #include "types.hpp" +#include + namespace { [[maybe_unused]] std::string binaryToHex(const uint8_t* data, size_t size) { diff --git a/src/xmp.cpp b/src/xmp.cpp index 5d19646e..e37252e3 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -9,6 +9,7 @@ // + standard includes #include +#include // Adobe XMP Toolkit #ifdef EXV_HAVE_XMP_TOOLKIT diff --git a/src/xmpsidecar.cpp b/src/xmpsidecar.cpp index 11b64148..18c4ad1e 100644 --- a/src/xmpsidecar.cpp +++ b/src/xmpsidecar.cpp @@ -9,6 +9,8 @@ #include "image.hpp" #include "xmp_exiv2.hpp" +#include + namespace { constexpr auto xmlHeader = "\n"; const auto xmlHdrCnt = static_cast(std::strlen(xmlHeader)); // without the trailing 0-character From 85d6082d7f44e0ddee2637dcf093fd5d67c935dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 8 Mar 2022 11:10:11 +0100 Subject: [PATCH 17/17] Should fix build in some Linux distros --- app/exiv2.cpp | 2 ++ include/exiv2/types.hpp | 1 + 2 files changed, 3 insertions(+) diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 6573c0c4..ee32960c 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -25,6 +25,8 @@ #include #include #else +#include +#include #include #endif diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 0d08eee8..63486f35 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -11,6 +11,7 @@ // standard includes #include +#include #include #include