diff --git a/app/actions.cpp b/app/actions.cpp index e07f0835..83b505d7 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -1,51 +1,41 @@ // 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 +#include #else -# include +#include #endif #if !defined(__MINGW__) && !defined(_MSC_VER) @@ -202,7 +192,7 @@ namespace Action { } } } else { - _setmode(_fileno(stdout),O_BINARY); + _setmode(fileno(stdout),O_BINARY); result = printStructure(std::cout, option, path); } @@ -571,7 +561,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; @@ -834,7 +824,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 +1895,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/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/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/exiv2.cpp b/app/exiv2.cpp index 64171e9e..ee32960c 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" @@ -22,10 +21,12 @@ #include #if defined(_WIN32) || defined(__CYGWIN__) -#include +#include #include #include #else +#include +#include #include #endif @@ -965,14 +966,13 @@ static int readFileToBuf(FILE* f,Exiv2::DataBuf& buf) return nBytes; } -//#define DEBUG void Params::getStdin(Exiv2::DataBuf& buf) { // copy stdin to stdinBuf 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 @@ -1381,7 +1381,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); diff --git a/app/exiv2app.hpp b/app/exiv2app.hpp index 84099644..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 @@ -35,22 +16,10 @@ #include "getopt.hpp" // + standard includes -#include #include #include #include -// stdin handler includes -#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 975b9ed6..c6fcd2c3 100644 --- a/app/getopt.cpp +++ b/app/getopt.cpp @@ -1,21 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#if _MSC_VER >= 1400 -# pragma warning(disable : 4996) -#endif - // 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..e9a83976 100644 --- a/app/getopt.hpp +++ b/app/getopt.hpp @@ -1,28 +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. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #ifndef GETOPT_H #define GETOPT_H -#include -#include #include namespace Util { 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/include/exiv2/error.hpp b/include/exiv2/error.hpp index 31a9e7f5..863e73bc 100644 --- a/include/exiv2/error.hpp +++ b/include/exiv2/error.hpp @@ -14,8 +14,11 @@ // ***************************************************************************** #include "exiv2lib_export.h" -// included header files -#include "types.hpp" +#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 bd808123..553806d6 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -9,11 +9,10 @@ #include "config.h" #include "slice.hpp" -// + standard includes +// standard includes #include #include #include -#include #include /*! @@ -26,8 +25,6 @@ #define EXV_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember)) // ***************************************************************************** -// forward declarations -struct tm; // ***************************************************************************** // namespace extensions @@ -320,7 +317,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/samples/addmoddel.cpp b/samples/addmoddel.cpp index 972e848e..6abc1225 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -1,28 +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. - */ -// addmoddel.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program showing how to add, modify and delete Exif metadata. #include + #include -#include #include int main(int argc, char* const argv[]) @@ -122,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/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 51d1318b..2d05f740 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -1,28 +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. - */ -// 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 + #include -#include #include int main(int argc, char* const argv[]) @@ -38,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 6ead23ab..ea8b7345 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 @@ -82,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 df7fb0a8..880c38ff 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 @@ -41,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(); @@ -58,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 4f97604d..3ae5f6ec 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); @@ -44,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(); @@ -117,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 da235c67..18d87940 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -1,28 +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. - */ -// exifdata.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to format exif data in various external formats #include + #include -#include #include #include @@ -203,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 bc5c3d2a..7748ee24 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 @@ -85,8 +64,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 15485aff..55ceb02e 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -1,30 +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 -#include -#include int main(int argc, char* const argv[]) { @@ -42,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/exiv2json.cpp b/samples/exiv2json.cpp index 47e24356..5120e7fc 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -1,45 +1,21 @@ -// ***************************************************************** -*- 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 -#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 2a18be4f..f05c115a 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -1,46 +1,15 @@ -// ***************************************************************** -*- 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 "unused.h" +#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__ @@ -419,14 +388,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/getopt-test.cpp b/samples/getopt-test.cpp index 690302a1..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 @@ -48,8 +30,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/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 7a7b8a5e..8a538b95 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -1,29 +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. - */ -// ***************************************************************************** -// included header files +// SPDX-License-Identifier: GPL-2.0-or-later #include -#include // for EOF -#include + #include -#include using Exiv2::byte; using Exiv2::BasicIo; @@ -71,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 9363f4be..99afcae0 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -1,29 +1,9 @@ -// ***************************************************************** -*- 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 + #include -#include -#include int main(int argc, char* const argv[]) try { @@ -57,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 a9a02643..f7eea57a 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.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. - */ -// iptcprint.cpp +// SPDX-License-Identifier: GPL-2.0-or-later // Sample program to print the IPTC metadata of an image #include + #include -#include -#include int main(int argc, char* const argv[]) try { @@ -38,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 50a61f4d..36703700 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -1,27 +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. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include + #include -#include -#include using namespace Exiv2; @@ -48,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/key-test.cpp b/samples/key-test.cpp index 6922a96d..05636594 100644 --- a/samples/key-test.cpp +++ b/samples/key-test.cpp @@ -1,27 +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. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include + #include -#include -#include using namespace Exiv2; diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index 0ba4ea28..d4d5b4dc 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 @@ -45,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()) { @@ -53,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 5c931dda..5062b014 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -1,26 +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 local header files which are not part of libexiv2 #include "getopt.hpp" @@ -53,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 ae218431..a12ba7a5 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -1,28 +1,9 @@ -// ***************************************************************** -*- 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 + #include -#include using namespace Exiv2; @@ -47,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 3b2a96ae..323b0346 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 @@ -38,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/path-test.cpp b/samples/path-test.cpp index 4f7a8d4a..a7877961 100644 --- a/samples/path-test.cpp +++ b/samples/path-test.cpp @@ -1,30 +1,10 @@ -// ***************************************************************** -*- 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 + #include #include #include -#include -#include namespace fs = std::filesystem; diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index 29e5b889..f4065a3d 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -1,29 +1,9 @@ -// ***************************************************************** -*- 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 -#include + #include -#include int main(int argc, char* const argv[]) try { @@ -39,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 8fbc6b8c..a08a494e 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 @@ -63,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/stringto-test.cpp b/samples/stringto-test.cpp index 703ea81d..0d5c3291 100644 --- a/samples/stringto-test.cpp +++ b/samples/stringto-test.cpp @@ -1,28 +1,9 @@ -// ***************************************************************** -*- 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 + #include -#include static constexpr const char* testcases[] = { // bool diff --git a/samples/taglist.cpp b/samples/taglist.cpp index cc73bc0d..cc01839e 100644 --- a/samples/taglist.cpp +++ b/samples/taglist.cpp @@ -1,27 +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. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include + #include -#include -#include using namespace Exiv2; 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 f084348d..2bb1e320 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -1,30 +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. - */ +// SPDX-License-Identifier: GPL-2.0-or-later #include + #include -#include -#include -#include -#include -#include // ***************************************************************************** // local declarations @@ -170,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"; @@ -186,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 06bb8d8f..a1a11690 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); @@ -48,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()); @@ -87,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(); @@ -219,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(); @@ -228,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 5c884598..27046816 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[]) { @@ -39,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 70af215b..7a3c4b70 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 { @@ -37,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/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..d31be898 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 @@ -48,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 2b57ca01..81042953 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -1,33 +1,11 @@ -// ***************************************************************** -*- 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 -#include "unused.h" -#include -#include -#include #include #include +#include bool isEqual(float a, float b) { @@ -77,26 +55,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,8 +78,7 @@ 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.toFloat() == 0.0f); @@ -117,8 +90,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); @@ -136,7 +108,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/CMakeLists.txt b/src/CMakeLists.txt index 1e4917cd..b61d09ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,8 +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 ) @@ -96,6 +94,7 @@ add_library( exiv2lib error.cpp exif.cpp futils.cpp + fff.h gifimage.cpp http.cpp image.cpp diff --git a/src/basicio.cpp b/src/basicio.cpp index 603ba004..1e2f28ad 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/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/bmpimage.cpp b/src/bmpimage.cpp index 14f73799..f60c0e25 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,8 +13,8 @@ // + standard includes #include -#include #include +#include // ***************************************************************************** // class member definitions 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 ff2b26f6..a71fe4d3 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -16,17 +16,10 @@ #include "xmp_exiv2.hpp" #include "futils.hpp" #include "convert.hpp" -#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..264e5b04 100644 --- a/src/cr2image.cpp +++ b/src/cr2image.cpp @@ -1,23 +1,17 @@ // 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. +#include "image.hpp" +#include "tiffcomposite_int.hpp" +#include "tiffimage_int.hpp" -// + standard includes #include -#include -#include -#include // ***************************************************************************** // class member definitions diff --git a/src/crwimage.cpp b/src/crwimage.cpp index 143fa2b5..88676cf9 100644 --- a/src/crwimage.cpp +++ b/src/crwimage.cpp @@ -11,20 +11,9 @@ #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/crwimage_int.cpp b/src/crwimage_int.cpp index 4c03d4a4..0cbeae2d 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/datasets.cpp b/src/datasets.cpp index 5db1e9f6..4f03322f 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 9cef2b7e..ab464d4d 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 34f76f39..529d717a 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later // included header files -#include "config.h" - #include "futils.hpp" -#include "datasets.hpp" + +#include "config.h" #include "enforce.hpp" -#include "image_int.hpp" +#include "error.hpp" // + standard includes #include #include +#include #include #include #include @@ -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/gifimage.cpp b/src/gifimage.cpp index f483355a..4ae6976c 100644 --- a/src/gifimage.cpp +++ b/src/gifimage.cpp @@ -1,9 +1,9 @@ // 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" @@ -16,7 +16,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/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 9eecfcac..90fffc03 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -1,44 +1,21 @@ // 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 @@ -46,11 +23,8 @@ #define closesocket close #include -#include #include #include -#include -#include #include #include #include @@ -98,8 +72,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 3bd70246..d9c6eaa8 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1,63 +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 -#ifdef _MSC_VER -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif -#ifdef EXV_HAVE_UNISTD_H -# include // stat -#endif - // ***************************************************************************** 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..4278b307 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 f586c497..cf29b15b 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 @@ -17,13 +16,7 @@ using std::string; using namespace Exiv2; -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include -#include -#include +#include #if !INI_USE_STACK #include diff --git a/src/iptc.cpp b/src/iptc.cpp index 98e5dc30..b303bb38 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -2,18 +2,17 @@ // 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 +#include // ***************************************************************************** namespace { diff --git a/src/jp2image.cpp b/src/jp2image.cpp index a9eee89c..2d2dbbcc 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -14,13 +14,8 @@ #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' diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp index 0de05ee7..11f4eb19 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,12 +21,6 @@ #include "fff.h" -// + standard includes -#include // for EOF -#include // for EOF -#include -#include -#include #include // ***************************************************************************** diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 0079e7fd..d804c575 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -11,31 +11,20 @@ #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(__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/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 5841786f..89bd0988 100644 --- a/src/minoltamn_int.cpp +++ b/src/minoltamn_int.cpp @@ -7,16 +7,10 @@ #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 +#include // popen to call exiftool // ***************************************************************************** // class member definitions @@ -2186,7 +2180,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/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..639392b0 100644 --- a/src/mrwimage.cpp +++ b/src/mrwimage.cpp @@ -1,30 +1,24 @@ // 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 8a7187fc..8fb1d3a9 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 46f55bb5..fb704aab 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.cpp b/src/orfimage.cpp index 640335e7..3412a577 100644 --- a/src/orfimage.cpp +++ b/src/orfimage.cpp @@ -1,23 +1,19 @@ // 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" +#include "image.hpp" +#include "orfimage_int.hpp" +#include "tiffcomposite_int.hpp" +#include "tiffimage.hpp" +#include "tiffimage_int.hpp" -// + standard includes -#include -#include #include -#include // ***************************************************************************** // class member definitions 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..daab5b3c 100644 --- a/src/pgfimage.cpp +++ b/src/pgfimage.cpp @@ -1,22 +1,16 @@ // 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" +#include "image.hpp" -// + standard includes -#include // for EOF -#include -#include #include -#include // 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/pngimage.cpp b/src/pngimage.cpp index 39946f0f..c1a26d6c 100644 --- a/src/pngimage.cpp +++ b/src/pngimage.cpp @@ -3,28 +3,23 @@ // 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 2cd0a0fb..9dc9144a 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -1,26 +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 "unused.h" -// ***************************************************************************** +#include + namespace { using namespace Exiv2; diff --git a/src/properties.cpp b/src/properties.cpp index 2fd90a47..a78f2994 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -2,22 +2,17 @@ // 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..13dea7c4 100644 --- a/src/psdimage.cpp +++ b/src/psdimage.cpp @@ -1,25 +1,17 @@ // 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 "image.hpp" +#include "jpgimage.hpp" -#include "safe_op.hpp" -#include "enforce.hpp" - -// + standard includes -#include -#include #include -#include -#include -#include // 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..5d12fe75 100644 --- a/src/rafimage.cpp +++ b/src/rafimage.cpp @@ -1,23 +1,19 @@ // 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" +#include "tiffimage.hpp" -// +standard includes -#include -#include #include -#include // ***************************************************************************** // 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/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 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/tags.cpp b/src/tags.cpp index 45a0bf25..cd763c36 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..437c6147 100644 --- a/src/tgaimage.cpp +++ b/src/tgaimage.cpp @@ -1,17 +1,14 @@ // 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" +#include "image.hpp" -// + standard includes -#include -#include #include // ***************************************************************************** @@ -21,7 +18,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/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 8c1850b6..1730cd02 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -11,12 +11,7 @@ #include "error.hpp" #include "enforce.hpp" -// + standard includes -#include -#include #include -#include -#include // ***************************************************************************** namespace { @@ -289,9 +284,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) { @@ -301,7 +295,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/tiffimage.cpp b/src/tiffimage.cpp index f11e528e..bffd7ce7 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -1,29 +1,18 @@ // 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/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index 16b01263..f82a53e2 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -6,24 +6,15 @@ #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 { 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 - diff --git a/src/types.cpp b/src/types.cpp index 510a69a2..c9f3c48b 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -2,27 +2,21 @@ // included header files #include "types.hpp" + #include "enforce.hpp" #include "futils.hpp" #include "i18n.h" // for _exvGettext #include "safe_op.hpp" -#include "unused.h" // + standard includes -#include -#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include // ***************************************************************************** namespace { @@ -542,13 +536,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 @@ -564,7 +558,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) { 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 d1b05756..28d9b92b 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -2,22 +2,14 @@ // included header files #include "value.hpp" -#include "types.hpp" + +#include "convert.hpp" #include "enforce.hpp" #include "error.hpp" -#include "convert.hpp" -#include "unused.h" +#include "types.hpp" // + standard includes -#include -#include -#include -#include -#include -#include -#include -#include #include #include @@ -451,8 +443,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); 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..ddf83ea1 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -6,31 +6,18 @@ */ // 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 "types.hpp" -#include -#include -#include -#include #include -#include -#include -#include - -#define CHECK_BIT(var,pos) ((var) & (1<<(pos))) namespace { [[maybe_unused]] std::string binaryToHex(const uint8_t* data, size_t size) diff --git a/src/xmp.cpp b/src/xmp.cpp index 12ad29d2..f458eb3d 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -8,10 +8,8 @@ #include "properties.hpp" // + standard includes -#include #include -#include -#include +#include // Adobe XMP Toolkit #ifdef EXV_HAVE_XMP_TOOLKIT diff --git a/src/xmpsidecar.cpp b/src/xmpsidecar.cpp index 7aa8c380..18c4ad1e 100644 --- a/src/xmpsidecar.cpp +++ b/src/xmpsidecar.cpp @@ -1,21 +1,16 @@ // 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