From 93a5f2a2bcc751ff52240935d2a27bfe64e27a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 30 Nov 2018 16:47:06 +0100 Subject: [PATCH 01/31] Switch to c++11 --- cmake/mainSetup.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/mainSetup.cmake b/cmake/mainSetup.cmake index 05c16004d8..0c67b901af 100644 --- a/cmake/mainSetup.cmake +++ b/cmake/mainSetup.cmake @@ -16,9 +16,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) -set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) +set(CMAKE_CXX_EXTENSIONS OFF) if (UNIX) if (APPLE) From 427bbad060f044f5857416af6633f3595af198ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 30 Nov 2018 17:21:17 +0100 Subject: [PATCH 02/31] Move from auto_ptr to unique_ptr --- include/exiv2/asfvideo.hpp | 4 +- include/exiv2/basicio.hpp | 8 +-- include/exiv2/bigtiffimage.hpp | 2 +- include/exiv2/bmpimage.hpp | 4 +- include/exiv2/cr2image.hpp | 4 +- include/exiv2/crwimage.hpp | 4 +- include/exiv2/datasets.hpp | 4 +- include/exiv2/epsimage.hpp | 4 +- include/exiv2/exif.hpp | 6 +- include/exiv2/gifimage.hpp | 4 +- include/exiv2/image.hpp | 28 ++++---- include/exiv2/iptc.hpp | 6 +- include/exiv2/jp2image.hpp | 4 +- include/exiv2/jpgimage.hpp | 10 +-- include/exiv2/matroskavideo.hpp | 4 +- include/exiv2/metadatum.hpp | 6 +- include/exiv2/mrwimage.hpp | 4 +- include/exiv2/orfimage.hpp | 4 +- include/exiv2/pgfimage.hpp | 4 +- include/exiv2/pngimage.hpp | 4 +- include/exiv2/properties.hpp | 6 +- include/exiv2/psdimage.hpp | 4 +- include/exiv2/quicktimevideo.hpp | 4 +- include/exiv2/rafimage.hpp | 4 +- include/exiv2/riffvideo.hpp | 4 +- include/exiv2/rw2image.hpp | 4 +- include/exiv2/tags.hpp | 6 +- include/exiv2/tgaimage.hpp | 4 +- include/exiv2/tiffimage.hpp | 4 +- include/exiv2/types.hpp | 6 +- include/exiv2/value.hpp | 52 +++++++------- include/exiv2/webpimage.hpp | 4 +- include/exiv2/xmp_exiv2.hpp | 4 +- include/exiv2/xmpsidecar.hpp | 4 +- samples/addmoddel.cpp | 8 +-- samples/convert-test.cpp | 2 +- samples/easyaccess-test.cpp | 2 +- samples/exifcomment.cpp | 2 +- samples/exifdata-test.cpp | 6 +- samples/exifdata.cpp | 2 +- samples/exifprint.cpp | 2 +- samples/exifvalue.cpp | 2 +- samples/exiv2json.cpp | 2 +- samples/geotag.cpp | 6 +- samples/iptceasy.cpp | 2 +- samples/iptcprint.cpp | 2 +- samples/iptctest.cpp | 6 +- samples/largeiptc-test.cpp | 2 +- samples/metacopy.cpp | 8 +-- samples/mrwthumb.cpp | 2 +- samples/prevtest.cpp | 2 +- samples/remotetest.cpp | 6 +- samples/tiff-test.cpp | 2 +- samples/toexv.hpp | 2 +- samples/write-test.cpp | 4 +- samples/write2-test.cpp | 16 ++--- samples/xmpdump.cpp | 2 +- samples/xmpprint.cpp | 2 +- samples/xmpsample.cpp | 2 +- src/actions.cpp | 113 ++++++++++++++++--------------- src/actions.hpp | 46 ++++++------- src/asfvideo.cpp | 12 ++-- src/bigtiffimage.cpp | 8 +-- src/bmpimage.cpp | 6 +- src/cr2image.cpp | 10 +-- src/crwimage.cpp | 14 ++-- src/crwimage_int.cpp | 32 ++++----- src/crwimage_int.hpp | 14 ++-- src/datasets.cpp | 4 +- src/epsimage.cpp | 10 +-- src/exif.cpp | 42 ++++++------ src/exiv2.cpp | 2 +- src/gifimage.cpp | 8 +-- src/image.cpp | 85 +++++++++++------------ src/iptc.cpp | 10 +-- src/jp2image.cpp | 12 ++-- src/jpgimage.cpp | 28 ++++---- src/matroskavideo.cpp | 8 +-- src/metadatum.cpp | 4 +- src/mrwimage.cpp | 8 +-- src/orfimage.cpp | 10 +-- src/pgfimage.cpp | 14 ++-- src/pngimage.cpp | 12 ++-- src/preview.cpp | 54 +++++++-------- src/properties.cpp | 4 +- src/psdimage.cpp | 10 +-- src/quicktimevideo.cpp | 10 +-- src/rafimage.cpp | 8 +-- src/riffvideo.cpp | 10 +-- src/rw2image.cpp | 10 +-- src/tags.cpp | 4 +- src/tgaimage.cpp | 8 +-- src/tiffcomposite_int.cpp | 111 +++++++++++++++--------------- src/tiffcomposite_int.hpp | 88 ++++++++++++------------ src/tifffwd_int.hpp | 4 +- src/tiffimage.cpp | 10 +-- src/tiffimage_int.cpp | 23 ++++--- src/tiffimage_int.hpp | 4 +- src/tiffvisitor_int.cpp | 30 ++++---- src/value.cpp | 54 +++++++-------- src/webpimage.cpp | 12 ++-- src/xmp.cpp | 22 +++--- src/xmpsidecar.cpp | 10 +-- unitTests/test_XmpKey.cpp | 2 +- 104 files changed, 663 insertions(+), 659 deletions(-) diff --git a/include/exiv2/asfvideo.hpp b/include/exiv2/asfvideo.hpp index f334587686..0b75588e89 100644 --- a/include/exiv2/asfvideo.hpp +++ b/include/exiv2/asfvideo.hpp @@ -61,7 +61,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - AsfVideo(BasicIo::AutoPtr io); + AsfVideo(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -168,7 +168,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newAsfInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Windows Asf Video. EXIV2API bool isAsfType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp index e726e6e188..5e42fc68a8 100644 --- a/include/exiv2/basicio.hpp +++ b/include/exiv2/basicio.hpp @@ -30,7 +30,7 @@ // + standard includes #include -#include // for std::auto_ptr +#include // for std::unique_ptr #include // write the temporary file #include // _O_BINARY in FileIo::FileIo #include // timestamp for the name of temporary file @@ -59,7 +59,7 @@ namespace Exiv2 { class EXIV2API BasicIo { public: //! BasicIo auto_ptr type - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! Seek starting positions enum Position { beg, cur, end }; @@ -525,7 +525,7 @@ namespace Exiv2 { // Pimpl idiom class Impl; - std::auto_ptr p_; + std::unique_ptr p_; }; // class FileIo @@ -725,7 +725,7 @@ namespace Exiv2 { // Pimpl idiom class Impl; - std::auto_ptr p_; + std::unique_ptr p_; }; // class MemIo diff --git a/include/exiv2/bigtiffimage.hpp b/include/exiv2/bigtiffimage.hpp index 9e53ee8a14..9fe6a1742a 100644 --- a/include/exiv2/bigtiffimage.hpp +++ b/include/exiv2/bigtiffimage.hpp @@ -10,7 +10,7 @@ namespace ImageType const int bigtiff = 25; } -Image::AutoPtr newBigTiffInstance(BasicIo::AutoPtr, bool); +Image::UniquePtr newBigTiffInstance(BasicIo::UniquePtr, bool); bool isBigTiffType(BasicIo &, bool); } diff --git a/include/exiv2/bmpimage.hpp b/include/exiv2/bmpimage.hpp index 07b0f3a381..c35efd1946 100644 --- a/include/exiv2/bmpimage.hpp +++ b/include/exiv2/bmpimage.hpp @@ -77,7 +77,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - explicit BmpImage(BasicIo::AutoPtr io); + explicit BmpImage(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -122,7 +122,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newBmpInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Windows Bitmap image. EXIV2API bool isBmpType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/cr2image.hpp b/include/exiv2/cr2image.hpp index 34323ce6a7..a364e1a6ae 100644 --- a/include/exiv2/cr2image.hpp +++ b/include/exiv2/cr2image.hpp @@ -71,7 +71,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - Cr2Image(BasicIo::AutoPtr io, bool create); + Cr2Image(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -155,7 +155,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newCr2Instance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a CR2 image. EXIV2API bool isCr2Type(BasicIo& iIo, bool advance); diff --git a/include/exiv2/crwimage.hpp b/include/exiv2/crwimage.hpp index a9bbe5ba58..1ffd39be5c 100644 --- a/include/exiv2/crwimage.hpp +++ b/include/exiv2/crwimage.hpp @@ -79,7 +79,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - CrwImage(BasicIo::AutoPtr io, bool create); + CrwImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -165,7 +165,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newCrwInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a CRW image. EXIV2API bool isCrwType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/datasets.hpp b/include/exiv2/datasets.hpp index 34e907a007..c7ec50fecb 100644 --- a/include/exiv2/datasets.hpp +++ b/include/exiv2/datasets.hpp @@ -278,7 +278,7 @@ namespace Exiv2 { class EXIV2API IptcKey : public Key { public: //! Shortcut for an %IptcKey auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -323,7 +323,7 @@ namespace Exiv2 { virtual std::string tagName() const; virtual std::string tagLabel() const; virtual uint16_t tag() const; - AutoPtr clone() const; + UniquePtr clone() const; //! Return the name of the record std::string recordName() const; //! Return the record id diff --git a/include/exiv2/epsimage.hpp b/include/exiv2/epsimage.hpp index 363bda6e57..616e3e06ae 100644 --- a/include/exiv2/epsimage.hpp +++ b/include/exiv2/epsimage.hpp @@ -76,7 +76,7 @@ namespace Exiv2 @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - EpsImage(BasicIo::AutoPtr io, bool create); + EpsImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -116,7 +116,7 @@ namespace Exiv2 Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newEpsInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newEpsInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a EPS image. EXIV2API bool isEpsType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp index a0f15d97bf..4d9e094a3c 100644 --- a/include/exiv2/exif.hpp +++ b/include/exiv2/exif.hpp @@ -194,7 +194,7 @@ namespace Exiv2 { long toLong(long n =0) const; float toFloat(long n =0) const; Rational toRational(long n =0) const; - Value::AutoPtr getValue() const; + Value::UniquePtr getValue() const; const Value& value() const; //! Return the size of the data area. long sizeDataArea() const; @@ -215,8 +215,8 @@ namespace Exiv2 { private: // DATA - ExifKey::AutoPtr key_; //!< Key - Value::AutoPtr value_; //!< Value + ExifKey::UniquePtr key_; //!< Key + Value::UniquePtr value_; //!< Value }; // class Exifdatum diff --git a/include/exiv2/gifimage.hpp b/include/exiv2/gifimage.hpp index 479edc7454..12ea983473 100644 --- a/include/exiv2/gifimage.hpp +++ b/include/exiv2/gifimage.hpp @@ -78,7 +78,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - explicit GifImage(BasicIo::AutoPtr io); + explicit GifImage(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -123,7 +123,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newGifInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a GIF image. EXIV2API bool isGifType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp index 3683a61d95..b7bf5babcb 100644 --- a/include/exiv2/image.hpp +++ b/include/exiv2/image.hpp @@ -80,7 +80,7 @@ namespace Exiv2 { class EXIV2API Image { public: //! Image auto_ptr type - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -91,7 +91,7 @@ namespace Exiv2 { */ Image(int imageType, uint16_t supportedMetadata, - BasicIo::AutoPtr io); + BasicIo::UniquePtr io); //! Virtual Destructor virtual ~Image(); //@} @@ -483,7 +483,7 @@ namespace Exiv2 { protected: // DATA - BasicIo::AutoPtr io_; //!< Image data IO pointer + BasicIo::UniquePtr io_; //!< Image data IO pointer ExifData exifData_; //!< Exif data container IptcData iptcData_; //!< IPTC data container XmpData xmpData_; //!< XMP data container @@ -521,7 +521,7 @@ namespace Exiv2 { }; // class Image //! Type for function pointer that creates new Image instances - typedef Image::AutoPtr (*NewInstanceFct)(BasicIo::AutoPtr io, bool create); + typedef Image::UniquePtr (*NewInstanceFct)(BasicIo::UniquePtr io, bool create); //! Type for function pointer that checks image types typedef bool (*IsThisTypeFct)(BasicIo& iIo, bool advance); @@ -547,13 +547,13 @@ namespace Exiv2 { @throw Error If the file is not found or it is unable to connect to the server to read the remote file. */ - static BasicIo::AutoPtr createIo(const std::string& path, bool useCurl = true); + static BasicIo::UniquePtr createIo(const std::string& path, bool useCurl = true); #ifdef EXV_UNICODE_PATH /*! @brief Like createIo() but accepts a unicode path in an std::wstring. @note This function is only available on Windows. */ - static BasicIo::AutoPtr createIo(const std::wstring& wpath, bool useCurl = true); + static BasicIo::UniquePtr createIo(const std::wstring& wpath, bool useCurl = true); #endif /*! @brief Create an Image subclass of the appropriate type by reading @@ -568,13 +568,13 @@ namespace Exiv2 { @throw Error If opening the file fails or it contains data of an unknown image type. */ - static Image::AutoPtr open(const std::string& path, bool useCurl = true); + static Image::UniquePtr open(const std::string& path, bool useCurl = true); #ifdef EXV_UNICODE_PATH /*! @brief Like open() but accepts a unicode path in an std::wstring. @note This function is only available on Windows. */ - static Image::AutoPtr open(const std::wstring& wpath, bool useCurl = true); + static Image::UniquePtr open(const std::wstring& wpath, bool useCurl = true); #endif /*! @brief Create an Image subclass of the appropriate type by reading @@ -587,7 +587,7 @@ namespace Exiv2 { matches that of the data buffer. @throw Error If the memory contains data of an unknown image type. */ - static Image::AutoPtr open(const byte* data, long size); + static Image::UniquePtr open(const byte* data, long size); /*! @brief Create an Image subclass of the appropriate type by reading the provided BasicIo instance. %Image type is derived from the @@ -605,7 +605,7 @@ namespace Exiv2 { determined, the pointer is 0. @throw Error If opening the BasicIo fails */ - static Image::AutoPtr open(BasicIo::AutoPtr io); + static Image::UniquePtr open(BasicIo::UniquePtr io); /*! @brief Create an Image subclass of the requested type by creating a new image file. If the file already exists, it will be overwritten. @@ -615,13 +615,13 @@ namespace Exiv2 { type. @throw Error If the image type is not supported. */ - static Image::AutoPtr create(int type, const std::string& path); + static Image::UniquePtr create(int type, const std::string& path); #ifdef EXV_UNICODE_PATH /*! @brief Like create() but accepts a unicode path in an std::wstring. @note This function is only available on Windows. */ - static Image::AutoPtr create(int type, const std::wstring& wpath); + static Image::UniquePtr create(int type, const std::wstring& wpath); #endif /*! @brief Create an Image subclass of the requested type by creating a @@ -631,7 +631,7 @@ namespace Exiv2 { type. @throw Error If the image type is not supported */ - static Image::AutoPtr create(int type); + static Image::UniquePtr create(int type); /*! @brief Create an Image subclass of the requested type by writing a new image to a BasicIo instance. If the BasicIo instance already @@ -646,7 +646,7 @@ namespace Exiv2 { @return An auto-pointer that owns an Image instance of the requested type. If the image type is not supported, the pointer is 0. */ - static Image::AutoPtr create(int type, BasicIo::AutoPtr io); + static Image::UniquePtr create(int type, BasicIo::UniquePtr io); /*! @brief Returns the image type of the provided file. @param path %Image file. The contents of the file are tested to diff --git a/include/exiv2/iptc.hpp b/include/exiv2/iptc.hpp index f1ecee6ec1..ebc2377152 100644 --- a/include/exiv2/iptc.hpp +++ b/include/exiv2/iptc.hpp @@ -150,14 +150,14 @@ namespace Exiv2 { long toLong(long n =0) const; float toFloat(long n =0) const; Rational toRational(long n =0) const; - Value::AutoPtr getValue() const; + Value::UniquePtr getValue() const; const Value& value() const; //@} private: // DATA - IptcKey::AutoPtr key_; //!< Key - Value::AutoPtr value_; //!< Value + IptcKey::UniquePtr key_; //!< Key + Value::UniquePtr value_; //!< Value }; // class Iptcdatum diff --git a/include/exiv2/jp2image.hpp b/include/exiv2/jp2image.hpp index 6b30d0686f..82fa99c07a 100644 --- a/include/exiv2/jp2image.hpp +++ b/include/exiv2/jp2image.hpp @@ -70,7 +70,7 @@ namespace Exiv2 @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - Jp2Image(BasicIo::AutoPtr io, bool create); + Jp2Image(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -134,7 +134,7 @@ namespace Exiv2 Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a JPEG-2000 image. EXIV2API bool isJp2Type(BasicIo& iIo, bool advance); diff --git a/include/exiv2/jpgimage.hpp b/include/exiv2/jpgimage.hpp index 373d83bca1..de00b8768e 100644 --- a/include/exiv2/jpgimage.hpp +++ b/include/exiv2/jpgimage.hpp @@ -182,7 +182,7 @@ namespace Exiv2 { @param dataSize Size of initData in bytes. */ JpegBase(int type, - BasicIo::AutoPtr io, + BasicIo::UniquePtr io, bool create, const byte initData[], long dataSize); @@ -321,7 +321,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - JpegImage(BasicIo::AutoPtr io, bool create); + JpegImage(BasicIo::UniquePtr io, bool create); //@} //! @name Accessors //@{ @@ -382,7 +382,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - ExvImage(BasicIo::AutoPtr io, bool create); + ExvImage(BasicIo::UniquePtr io, bool create); //@} //! @name Accessors //@{ @@ -424,7 +424,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newJpegInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a JPEG image. EXIV2API bool isJpegType(BasicIo& iIo, bool advance); /*! @@ -432,7 +432,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newExvInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is an EXV file EXIV2API bool isExvType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/matroskavideo.hpp b/include/exiv2/matroskavideo.hpp index 5db1bfcee0..b1d2084c25 100644 --- a/include/exiv2/matroskavideo.hpp +++ b/include/exiv2/matroskavideo.hpp @@ -74,7 +74,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - MatroskaVideo(BasicIo::AutoPtr io); + MatroskaVideo(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -144,7 +144,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newMkvInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newMkvInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Matroska Video. EXIV2API bool isMkvType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp index f707760f08..1995c2b242 100644 --- a/include/exiv2/metadatum.hpp +++ b/include/exiv2/metadatum.hpp @@ -58,7 +58,7 @@ namespace Exiv2 { class EXIV2API Key { public: //! Shortcut for a %Key auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -90,7 +90,7 @@ namespace Exiv2 { The caller owns this copy and the auto-pointer ensures that it will be deleted. */ - AutoPtr clone() const; + UniquePtr clone() const; /*! @brief Write the key to an output stream. You do not usually have to use this function; it is used for the implementation of @@ -265,7 +265,7 @@ namespace Exiv2 { @return An auto-pointer containing a pointer to a copy (clone) of the value, 0 if the value is not set. */ - virtual Value::AutoPtr getValue() const =0; + virtual Value::UniquePtr getValue() const =0; /*! @brief Return a constant reference to the value. diff --git a/include/exiv2/mrwimage.hpp b/include/exiv2/mrwimage.hpp index 079fcceed8..773147f1bf 100644 --- a/include/exiv2/mrwimage.hpp +++ b/include/exiv2/mrwimage.hpp @@ -72,7 +72,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - MrwImage(BasicIo::AutoPtr io, bool create); + MrwImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -128,7 +128,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newMrwInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a MRW image. EXIV2API bool isMrwType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/orfimage.hpp b/include/exiv2/orfimage.hpp index b21479b3ed..26f2b2eb4f 100644 --- a/include/exiv2/orfimage.hpp +++ b/include/exiv2/orfimage.hpp @@ -72,7 +72,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - OrfImage(BasicIo::AutoPtr io, bool create); + OrfImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -149,7 +149,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newOrfInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newOrfInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is an ORF image. EXIV2API bool isOrfType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/pgfimage.hpp b/include/exiv2/pgfimage.hpp index 5648e73217..482f8215bc 100644 --- a/include/exiv2/pgfimage.hpp +++ b/include/exiv2/pgfimage.hpp @@ -76,7 +76,7 @@ namespace Exiv2 @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - PgfImage(BasicIo::AutoPtr io, bool create); + PgfImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -126,7 +126,7 @@ namespace Exiv2 Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a PGF image. EXIV2API bool isPgfType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/pngimage.hpp b/include/exiv2/pngimage.hpp index 94336b6085..faee292fba 100644 --- a/include/exiv2/pngimage.hpp +++ b/include/exiv2/pngimage.hpp @@ -77,7 +77,7 @@ namespace Exiv2 @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - PngImage(BasicIo::AutoPtr io, bool create); + PngImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -128,7 +128,7 @@ namespace Exiv2 Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newPngInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newPngInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a PNG image. EXIV2API bool isPngType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/properties.hpp b/include/exiv2/properties.hpp index ab6d01eb1a..6b3f48f942 100644 --- a/include/exiv2/properties.hpp +++ b/include/exiv2/properties.hpp @@ -248,7 +248,7 @@ namespace Exiv2 { { public: //! Shortcut for an %XmpKey auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -297,7 +297,7 @@ namespace Exiv2 { //! Properties don't have a tag number. Return 0. virtual uint16_t tag() const; - AutoPtr clone() const; + UniquePtr clone() const; // Todo: Should this be removed? What about tagLabel then? //! Return the schema namespace for the prefix of the key @@ -311,7 +311,7 @@ namespace Exiv2 { private: // Pimpl idiom struct Impl; - std::auto_ptr p_; + std::unique_ptr p_; }; // class XmpKey diff --git a/include/exiv2/psdimage.hpp b/include/exiv2/psdimage.hpp index cbe1ff285e..c86adf2d39 100644 --- a/include/exiv2/psdimage.hpp +++ b/include/exiv2/psdimage.hpp @@ -79,7 +79,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - explicit PsdImage(BasicIo::AutoPtr io); + explicit PsdImage(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -141,7 +141,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newPsdInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Photoshop image. EXIV2API bool isPsdType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/quicktimevideo.hpp b/include/exiv2/quicktimevideo.hpp index d8b23f0db4..fa2d8060cc 100644 --- a/include/exiv2/quicktimevideo.hpp +++ b/include/exiv2/quicktimevideo.hpp @@ -63,7 +63,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - QuickTimeVideo(BasicIo::AutoPtr io); + QuickTimeVideo(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -240,7 +240,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newQTimeInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Quick Time Video. EXIV2API bool isQTimeType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/rafimage.hpp b/include/exiv2/rafimage.hpp index 62934a9b5b..51adde84b3 100644 --- a/include/exiv2/rafimage.hpp +++ b/include/exiv2/rafimage.hpp @@ -71,7 +71,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - RafImage(BasicIo::AutoPtr io, bool create); + RafImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -128,7 +128,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newRafInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newRafInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a RAF image. EXIV2API bool isRafType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/riffvideo.hpp b/include/exiv2/riffvideo.hpp index 25a3f891ca..fb3686a651 100644 --- a/include/exiv2/riffvideo.hpp +++ b/include/exiv2/riffvideo.hpp @@ -63,7 +63,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - RiffVideo(BasicIo::AutoPtr io); + RiffVideo(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -208,7 +208,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Riff Video. EXIV2API bool isRiffType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/rw2image.hpp b/include/exiv2/rw2image.hpp index 21f49d5b0e..34c36125c8 100644 --- a/include/exiv2/rw2image.hpp +++ b/include/exiv2/rw2image.hpp @@ -69,7 +69,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - explicit Rw2Image(BasicIo::AutoPtr io); + explicit Rw2Image(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -148,7 +148,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newRw2Instance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newRw2Instance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a RW2 image. EXIV2API bool isRw2Type(BasicIo& iIo, bool advance); diff --git a/include/exiv2/tags.hpp b/include/exiv2/tags.hpp index 7844f7b428..86efcc9cb7 100644 --- a/include/exiv2/tags.hpp +++ b/include/exiv2/tags.hpp @@ -147,7 +147,7 @@ namespace Exiv2 { class EXIV2API ExifKey : public Key { public: //! Shortcut for an %ExifKey auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -209,7 +209,7 @@ namespace Exiv2 { //! Return the default type id for this tag. TypeId defaultTypeId() const; // Todo: should be in the base class - AutoPtr clone() const; + UniquePtr clone() const; //! Return the index (unique id of this key within the original Exif data, 0 if not set) int idx() const; //@} @@ -221,7 +221,7 @@ namespace Exiv2 { private: // Pimpl idiom struct Impl; - std::auto_ptr p_; + std::unique_ptr p_; }; // class ExifKey diff --git a/include/exiv2/tgaimage.hpp b/include/exiv2/tgaimage.hpp index 2c40f0bfc2..1ee4911907 100644 --- a/include/exiv2/tgaimage.hpp +++ b/include/exiv2/tgaimage.hpp @@ -79,7 +79,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - explicit TgaImage(BasicIo::AutoPtr io); + explicit TgaImage(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -124,7 +124,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newTgaInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newTgaInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a Targa v2 image. EXIV2API bool isTgaType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/tiffimage.hpp b/include/exiv2/tiffimage.hpp index a25952846d..cc2b10938a 100644 --- a/include/exiv2/tiffimage.hpp +++ b/include/exiv2/tiffimage.hpp @@ -74,7 +74,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - TiffImage(BasicIo::AutoPtr io, bool create); + TiffImage(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -210,7 +210,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a TIFF image. EXIV2API bool isTiffType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 5775a5612d..43d964224f 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -215,7 +215,7 @@ namespace Exiv2 { DataBuf(const byte* pData, long size); /*! @brief Copy constructor. Transfers the buffer to the newly created - object similar to std::auto_ptr, i.e., the original object is + object similar to std::unique_ptr, i.e., the original object is modified. */ DataBuf(DataBuf& rhs); @@ -227,7 +227,7 @@ namespace Exiv2 { //@{ /*! @brief Assignment operator. Transfers the buffer and releases the - buffer at the original object similar to std::auto_ptr, i.e., + buffer at the original object similar to std::unique_ptr, i.e., the original object is modified. */ DataBuf& operator=(DataBuf& rhs); @@ -257,7 +257,7 @@ namespace Exiv2 { @name Conversions Special conversions with auxiliary type to enable copies - and assignments, similar to those used for std::auto_ptr. + and assignments, similar to those used for std::unique_ptr. See http://www.josuttis.com/libbook/auto_ptr.html for a discussion. */ //@{ diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp index ea61b1a67d..5637958ed1 100644 --- a/include/exiv2/value.hpp +++ b/include/exiv2/value.hpp @@ -62,7 +62,7 @@ namespace Exiv2 { class EXIV2API Value { public: //! Shortcut for a %Value auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -118,7 +118,7 @@ namespace Exiv2 { The caller owns this copy and the auto-pointer ensures that it will be deleted. */ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } /*! @brief Write value to a data buffer. @@ -235,7 +235,7 @@ namespace Exiv2 { @return Auto-pointer to the newly created Value. The caller owns this copy and the auto-pointer ensures that it will be deleted. */ - static AutoPtr create(TypeId typeId); + static UniquePtr create(TypeId typeId); protected: /*! @@ -264,7 +264,7 @@ namespace Exiv2 { class EXIV2API DataValue : public Value { public: //! Shortcut for a %DataValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; explicit DataValue(TypeId typeId =undefined); @@ -297,7 +297,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } /*! @brief Write value to a character data buffer. @@ -346,7 +346,7 @@ namespace Exiv2 { class EXIV2API StringValueBase : public Value { public: //! Shortcut for a %StringValueBase auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -383,7 +383,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } /*! @brief Write value to a character data buffer. @@ -428,7 +428,7 @@ namespace Exiv2 { class EXIV2API StringValue : public StringValueBase { public: //! Shortcut for a %StringValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -442,7 +442,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } //@} private: @@ -460,7 +460,7 @@ namespace Exiv2 { class EXIV2API AsciiValue : public StringValueBase { public: //! Shortcut for a %AsciiValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -485,7 +485,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } /*! @brief Write the ASCII value up to the the first '\\0' character to an output stream. Any further characters are ignored and not @@ -548,7 +548,7 @@ namespace Exiv2 { }; // class CharsetInfo //! Shortcut for a %CommentValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -583,7 +583,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } long copy(byte* buf, ByteOrder byteOrder) const; /*! @brief Write the comment in a format which can be read by @@ -635,7 +635,7 @@ namespace Exiv2 { class EXIV2API XmpValue : public Value { public: //! Shortcut for a %XmpValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! XMP array types. enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq }; @@ -726,7 +726,7 @@ namespace Exiv2 { class EXIV2API XmpTextValue : public XmpValue { public: //! Shortcut for a %XmpTextValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -759,7 +759,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const; + UniquePtr clone() const; long size() const; virtual long count() const; /*! @@ -808,7 +808,7 @@ namespace Exiv2 { class EXIV2API XmpArrayValue : public XmpValue { public: //! Shortcut for a %XmpArrayValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -834,7 +834,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const; + UniquePtr clone() const; virtual long count() const; /*! @brief Return the n-th component of the value as a string. @@ -901,7 +901,7 @@ namespace Exiv2 { class EXIV2API LangAltValue : public XmpValue { public: //! Shortcut for a %LangAltValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -936,7 +936,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const; + UniquePtr clone() const; virtual long count() const; /*! @brief Return the text value associated with the default language @@ -989,7 +989,7 @@ namespace Exiv2 { class EXIV2API DateValue : public Value { public: //! Shortcut for a %DateValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -1042,7 +1042,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } /*! @brief Write value to a character data buffer. @@ -1090,7 +1090,7 @@ namespace Exiv2 { class EXIV2API TimeValue : public Value { public: //! Shortcut for a %TimeValue auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -1149,7 +1149,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } /*! @brief Write value to a character data buffer. @@ -1246,7 +1246,7 @@ namespace Exiv2 { class ValueType : public Value { public: //! Shortcut for a %ValueType\ auto pointer. - typedef std::auto_ptr > AutoPtr; + typedef std::unique_ptr > UniquePtr; //! @name Creators //@{ @@ -1286,7 +1286,7 @@ namespace Exiv2 { //! @name Accessors //@{ - AutoPtr clone() const { return AutoPtr(clone_()); } + UniquePtr clone() const { return UniquePtr(clone_()); } virtual long copy(byte* buf, ByteOrder byteOrder) const; virtual long count() const; virtual long size() const; diff --git a/include/exiv2/webpimage.hpp b/include/exiv2/webpimage.hpp index f132559673..e0ed0c0809 100644 --- a/include/exiv2/webpimage.hpp +++ b/include/exiv2/webpimage.hpp @@ -63,7 +63,7 @@ namespace Exiv2 { instance after it is passed to this method. Use the Image::io() method to get a temporary reference. */ - WebPImage(BasicIo::AutoPtr io); + WebPImage(BasicIo::UniquePtr io); //@} //! @name Manipulators @@ -132,7 +132,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is a WebP Video. EXIV2API bool isWebPType(BasicIo& iIo, bool advance); diff --git a/include/exiv2/xmp_exiv2.hpp b/include/exiv2/xmp_exiv2.hpp index 029e46aeb4..b713dea8c7 100644 --- a/include/exiv2/xmp_exiv2.hpp +++ b/include/exiv2/xmp_exiv2.hpp @@ -152,14 +152,14 @@ namespace Exiv2 { long toLong(long n =0) const; float toFloat(long n =0) const; Rational toRational(long n =0) const; - Value::AutoPtr getValue() const; + Value::UniquePtr getValue() const; const Value& value() const; //@} private: // Pimpl idiom struct Impl; - std::auto_ptr p_; + std::unique_ptr p_; }; // class Xmpdatum diff --git a/include/exiv2/xmpsidecar.hpp b/include/exiv2/xmpsidecar.hpp index 782abc7980..4907e7e7a7 100644 --- a/include/exiv2/xmpsidecar.hpp +++ b/include/exiv2/xmpsidecar.hpp @@ -68,7 +68,7 @@ namespace Exiv2 { @param create Specifies if an existing image should be read (false) or if a new image should be created (true). */ - XmpSidecar(BasicIo::AutoPtr io, bool create); + XmpSidecar(BasicIo::UniquePtr io, bool create); //@} //! @name Manipulators @@ -110,7 +110,7 @@ namespace Exiv2 { Caller owns the returned object and the auto-pointer ensures that it will be deleted. */ - EXIV2API Image::AutoPtr newXmpInstance(BasicIo::AutoPtr io, bool create); + EXIV2API Image::UniquePtr newXmpInstance(BasicIo::UniquePtr io, bool create); //! Check if the file iIo is an XMP sidecar file. EXIV2API bool isXmpType(BasicIo& iIo, bool advance); diff --git a/samples/addmoddel.cpp b/samples/addmoddel.cpp index e171eddb7d..30f67924f7 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -34,7 +34,7 @@ try { std::cout << "Added a few tags the quick way.\n"; // Create a ASCII string value (note the use of create) - Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString); + Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::asciiString); // Set the value to a string v->read("1999:12:31 23:59:59"); // Add the value together with its key to the Exif data container @@ -43,7 +43,7 @@ try { std::cout << "Added key \"" << key << "\", value \"" << *v << "\"\n"; // Now create a more interesting value (without using the create method) - Exiv2::URationalValue::AutoPtr rv(new Exiv2::URationalValue); + Exiv2::URationalValue::UniquePtr rv(new Exiv2::URationalValue); // Set two rational components from a string rv->read("1/2 1/3"); // Add more elements through the extended interface of rational value @@ -75,7 +75,7 @@ try { // Downcast the Value pointer to its actual type Exiv2::URationalValue* prv = dynamic_cast(v.release()); if (prv == 0) throw Exiv2::Error(Exiv2::kerErrorMessage, "Downcast failed"); - rv = Exiv2::URationalValue::AutoPtr(prv); + rv = Exiv2::URationalValue::UniquePtr(prv); // Modify the value directly through the interface of URationalValue rv->value_[2] = std::make_pair(88,77); // Copy the modified value back to the metadatum @@ -95,7 +95,7 @@ try { // ************************************************************************* // Finally, write the remaining Exif data to the image file - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->setExifData(exifData); diff --git a/samples/convert-test.cpp b/samples/convert-test.cpp index 2c5723d392..011962efc0 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -15,7 +15,7 @@ try { return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/easyaccess-test.cpp b/samples/easyaccess-test.cpp index 7e0b222041..88e0ca17b0 100644 --- a/samples/easyaccess-test.cpp +++ b/samples/easyaccess-test.cpp @@ -48,7 +48,7 @@ try { return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert (image.get() != 0); image->readMetadata(); Exiv2::ExifData& ed = image->exifData(); diff --git a/samples/exifcomment.cpp b/samples/exifcomment.cpp index 7eede6f9bf..4517e048ea 100644 --- a/samples/exifcomment.cpp +++ b/samples/exifcomment.cpp @@ -25,7 +25,7 @@ try { return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert (image.get() != 0); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); diff --git a/samples/exifdata-test.cpp b/samples/exifdata-test.cpp index 268cc682e0..41f39d047f 100644 --- a/samples/exifdata-test.cpp +++ b/samples/exifdata-test.cpp @@ -30,7 +30,7 @@ try { } std::string file(argv[1]); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert (image.get() != 0); image->readMetadata(); @@ -103,7 +103,7 @@ catch (Exiv2::AnyError& e) { void write(const std::string& file, Exiv2::ExifData& ed) { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert (image.get() != 0); image->setExifData(ed); image->writeMetadata(); @@ -111,7 +111,7 @@ void write(const std::string& file, Exiv2::ExifData& ed) void print(const std::string& file) { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert (image.get() != 0); image->readMetadata(); diff --git a/samples/exifdata.cpp b/samples/exifdata.cpp index 0c18d5b84e..25f2ad8136 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -174,7 +174,7 @@ int main(int argc,const char* argv[]) } if ( !result ) try { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 5f4d5da1cc..180d3b328c 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -67,7 +67,7 @@ try { return 0; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/exifvalue.cpp b/samples/exifvalue.cpp index 672772f2d7..bca39d2168 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -19,7 +19,7 @@ int main(int argc, char* const argv[]) const char* file = argv[1]; const char* key = argv[2]; - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData &exifData = image->exifData(); diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index a33a383b3b..1399fa139a 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -279,7 +279,7 @@ int main(int argc, char* const argv[]) while (opt[0] == '-') opt++ ; // skip past leading -'s char option = opt[0]; - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/geotag.cpp b/samples/geotag.cpp index f6dbe0b00e..f8b8471cb4 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -597,7 +597,7 @@ bool readImage(const char* path,Options& /* options */) bool bResult = false ; try { - Image::AutoPtr image = ImageFactory::open(path); + Image::UniquePtr image = ImageFactory::open(path); if ( image.get() ) { image->readMetadata(); ExifData &exifData = image->exifData(); @@ -623,7 +623,7 @@ time_t readImageTime(const std::string& path,std::string* pS=NULL) do { try { - Image::AutoPtr image = ImageFactory::open(path); + Image::UniquePtr image = ImageFactory::open(path); if ( image.get() ) { image->readMetadata(); ExifData &exifData = image->exifData(); @@ -898,7 +898,7 @@ int main(int argc,const char* argv[]) try { time_t t = readImageTime(path,&stamp) ; Position* pPos = searchTimeDict(gTimeDict,t,Position::deltaMax_); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); if ( image.get() ) { image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); diff --git a/samples/iptceasy.cpp b/samples/iptceasy.cpp index a5d0f4ce6e..936b8d0012 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -34,7 +34,7 @@ try { std::cout << "Time sent: " << iptcData["Iptc.Envelope.TimeSent"] << "\n"; // Open image file - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert (image.get() != 0); // Set IPTC data and write it to the file diff --git a/samples/iptcprint.cpp b/samples/iptcprint.cpp index ee29575220..d0ad0f8215 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -16,7 +16,7 @@ try { return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert (image.get() != 0); image->readMetadata(); diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index 23b9003011..e1bf470ca9 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -34,7 +34,7 @@ int main(int argc, char* const argv[]) return 1; } - Image::AutoPtr image = ImageFactory::open(argv[1]); + Image::UniquePtr image = ImageFactory::open(argv[1]); assert (image.get() != 0); image->readMetadata(); @@ -106,7 +106,7 @@ void processAdd(const std::string& line, int num, IptcData &iptcData) data = data.substr(1, data.size()-2); } TypeId type = IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record()); - Value::AutoPtr value = Value::create(type); + Value::UniquePtr value = Value::create(type); value->read(data); int rc = iptcData.add(iptcKey, value.get()); @@ -157,7 +157,7 @@ void processModify(const std::string& line, int num, IptcData &iptcData) data = data.substr(1, data.size()-2); } TypeId type = IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record()); - Value::AutoPtr value = Value::create(type); + Value::UniquePtr value = Value::create(type); value->read(data); IptcData::iterator iter = iptcData.findKey(iptcKey); diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index 6ae90b9990..1e86fa0841 100644 --- a/samples/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -26,7 +26,7 @@ try { if (io.error() || !io.eof()) throw Exiv2::Error(Exiv2::kerFailedToReadImageData); // Read metadata from file - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index 23c1a74239..89155e70e8 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -52,15 +52,15 @@ try { } // Use MemIo to increase test coverage. - Exiv2::BasicIo::AutoPtr fileIo(new Exiv2::FileIo(params.read_)); - Exiv2::BasicIo::AutoPtr memIo(new Exiv2::MemIo); + Exiv2::BasicIo::UniquePtr fileIo(new Exiv2::FileIo(params.read_)); + Exiv2::BasicIo::UniquePtr memIo(new Exiv2::MemIo); memIo->transfer(*fileIo); - Exiv2::Image::AutoPtr readImg = Exiv2::ImageFactory::open(memIo); + Exiv2::Image::UniquePtr readImg = Exiv2::ImageFactory::open(std::move(memIo)); assert(readImg.get() != 0); readImg->readMetadata(); - Exiv2::Image::AutoPtr writeImg = Exiv2::ImageFactory::open(params.write_); + Exiv2::Image::UniquePtr writeImg = Exiv2::ImageFactory::open(params.write_); assert(writeImg.get() != 0); if (params.preserve_) writeImg->readMetadata(); if (params.iptc_) { diff --git a/samples/mrwthumb.cpp b/samples/mrwthumb.cpp index 323f61e664..506815bd7a 100644 --- a/samples/mrwthumb.cpp +++ b/samples/mrwthumb.cpp @@ -15,7 +15,7 @@ int main(int argc, char* const argv[]) return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index c6a98bb3f1..b9048a8886 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -16,7 +16,7 @@ try { } std::string filename(argv[1]); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(filename); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/remotetest.cpp b/samples/remotetest.cpp index 703eb136c7..740c02856c 100644 --- a/samples/remotetest.cpp +++ b/samples/remotetest.cpp @@ -35,19 +35,19 @@ try { exifData["Exif.Image.Make"] = "Canon"; // AsciiValue exifData["Exif.Canon.OwnerName"] = "Tuan"; // UShortValue exifData["Exif.CanonCs.LensType"] = uint16_t(65535); // LongValue - Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::asciiString); + Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::asciiString); v->read("2013:06:09 14:30:30"); Exiv2::ExifKey key("Exif.Image.DateTime"); exifData.add(key, v.get()); - Exiv2::Image::AutoPtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); + Exiv2::Image::UniquePtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); assert(writeTest.get() != 0); writeTest->setExifData(exifData); writeTest->writeMetadata(); // read the result to make sure everything fine std::cout << "Print out the new metadata ...\n"; - Exiv2::Image::AutoPtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); + Exiv2::Image::UniquePtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps); assert(readTest.get() != 0); readTest->readMetadata(); Exiv2::ExifData &exifReadData = readTest->exifData(); diff --git a/samples/tiff-test.cpp b/samples/tiff-test.cpp index 92b0f0a514..0a08650c2a 100644 --- a/samples/tiff-test.cpp +++ b/samples/tiff-test.cpp @@ -66,7 +66,7 @@ void mini1(const char* path) void mini9(const char* path) { - TiffImage tiffImage(BasicIo::AutoPtr(new FileIo(path)), false); + TiffImage tiffImage(BasicIo::UniquePtr(new FileIo(path)), false); tiffImage.readMetadata(); std::cout << "MIME type: " << tiffImage.mimeType() << "\n"; diff --git a/samples/toexv.hpp b/samples/toexv.hpp index 690cf14099..8a8a7bcdcc 100644 --- a/samples/toexv.hpp +++ b/samples/toexv.hpp @@ -68,7 +68,7 @@ class Params : public Util::Getopt { int help(std::ostream& os =std::cout) const; //! copy metadata from one image to another. - void copyMetadata(Exiv2::Image::AutoPtr& readImage,Exiv2::Image::AutoPtr& writeImage); + void copyMetadata(Exiv2::Image::UniquePtr& readImage,Exiv2::Image::UniquePtr& writeImage); }; // class Params diff --git a/samples/write-test.cpp b/samples/write-test.cpp index 12290f6b8e..f8374d118b 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -161,7 +161,7 @@ void testCase(const std::string& file1, ExifKey ek(key); //Open first image - Image::AutoPtr image1 = ImageFactory::open(file1); + Image::UniquePtr image1 = ImageFactory::open(file1); assert(image1.get() != 0); // Load existing metadata @@ -177,7 +177,7 @@ void testCase(const std::string& file1, pos->setValue(value); // Open second image - Image::AutoPtr image2 = ImageFactory::open(file2); + Image::UniquePtr image2 = ImageFactory::open(file2); assert(image2.get() != 0); image2->setExifData(image1->exifData()); diff --git a/samples/write2-test.cpp b/samples/write2-test.cpp index d220956b1b..b5e24e45fc 100644 --- a/samples/write2-test.cpp +++ b/samples/write2-test.cpp @@ -34,19 +34,19 @@ try { Exiv2::ExifData ed1; ed1["Exif.Image.Model"] = "Test 1"; - Exiv2::Value::AutoPtr v1 = Exiv2::Value::create(Exiv2::unsignedShort); + Exiv2::Value::UniquePtr v1 = Exiv2::Value::create(Exiv2::unsignedShort); v1->read("160 161 162 163"); ed1.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v1.get()); - Exiv2::Value::AutoPtr v2 = Exiv2::Value::create(Exiv2::signedLong); + Exiv2::Value::UniquePtr v2 = Exiv2::Value::create(Exiv2::signedLong); v2->read("-2 -1 0 1"); ed1.add(Exiv2::ExifKey("Exif.Image.XResolution"), v2.get()); - Exiv2::Value::AutoPtr v3 = Exiv2::Value::create(Exiv2::signedRational); + Exiv2::Value::UniquePtr 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::AutoPtr v4 = Exiv2::Value::create(Exiv2::undefined); + Exiv2::Value::UniquePtr v4 = Exiv2::Value::create(Exiv2::undefined); v4->read("255 254 253 252"); ed1.add(Exiv2::ExifKey("Exif.Image.WhitePoint"), v4.get()); @@ -73,7 +73,7 @@ try { print(file); std::cout <<"\n----- Non-intrusive writing of special Canon MakerNote tags\n"; - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); @@ -189,7 +189,7 @@ try { std::cout <<"\n----- One IFD0 and one IFD1 tag\n"; Exiv2::ExifData ed7; ed7["Exif.Thumbnail.Artist"] = "Test 7"; - Exiv2::Value::AutoPtr v5 = Exiv2::Value::create(Exiv2::unsignedShort); + Exiv2::Value::UniquePtr v5 = Exiv2::Value::create(Exiv2::unsignedShort); v5->read("160 161 162 163"); ed7.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v5.get()); write(file, ed7); @@ -205,7 +205,7 @@ catch (Exiv2::AnyError& e) { void write(const std::string& file, Exiv2::ExifData& ed) { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->setExifData(ed); @@ -214,7 +214,7 @@ void write(const std::string& file, Exiv2::ExifData& ed) void print(const std::string& file) { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/xmpdump.cpp b/samples/xmpdump.cpp index 6231bad0d2..1be2ac49bf 100644 --- a/samples/xmpdump.cpp +++ b/samples/xmpdump.cpp @@ -15,7 +15,7 @@ int main(int argc, char* const argv[]) return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert(image.get() != 0); image->readMetadata(); diff --git a/samples/xmpprint.cpp b/samples/xmpprint.cpp index 49f6436f3d..317342b93f 100644 --- a/samples/xmpprint.cpp +++ b/samples/xmpprint.cpp @@ -24,7 +24,7 @@ try return 1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]); assert (image.get() != 0); image->readMetadata(); diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index 9a4e7b9cd1..3d1a5993d5 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -112,7 +112,7 @@ try { // properties and language alternatives. // Add a simple XMP property in a known namespace - Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText); + Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpText); v->read("image/jpeg"); xmpData.add(Exiv2::XmpKey("Xmp.dc.format"), v.get()); diff --git a/src/actions.cpp b/src/actions.cpp index 34a7a80d5b..15ad5bf056 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -166,9 +166,9 @@ namespace Action { { } - Task::AutoPtr Task::clone() const + Task::UniquePtr Task::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } TaskFactory* TaskFactory::instance_ = 0; @@ -193,7 +193,7 @@ namespace Action { } } //TaskFactory::cleanup - void TaskFactory::registerTask(TaskType type, Task::AutoPtr task) + void TaskFactory::registerTask(TaskType type, Task::UniquePtr task) { Registry::iterator i = registry_.find(type); if (i != registry_.end()) { @@ -205,26 +205,26 @@ namespace Action { TaskFactory::TaskFactory() { // Register a prototype of each known task - registerTask(adjust, Task::AutoPtr(new Adjust)); - registerTask(print, Task::AutoPtr(new Print)); - registerTask(rename, Task::AutoPtr(new Rename)); - registerTask(erase, Task::AutoPtr(new Erase)); - registerTask(extract, Task::AutoPtr(new Extract)); - registerTask(insert, Task::AutoPtr(new Insert)); - registerTask(modify, Task::AutoPtr(new Modify)); - registerTask(fixiso, Task::AutoPtr(new FixIso)); - registerTask(fixcom, Task::AutoPtr(new FixCom)); + registerTask(adjust, Task::UniquePtr(new Adjust)); + registerTask(print, Task::UniquePtr(new Print)); + registerTask(rename, Task::UniquePtr(new Rename)); + registerTask(erase, Task::UniquePtr(new Erase)); + registerTask(extract, Task::UniquePtr(new Extract)); + registerTask(insert, Task::UniquePtr(new Insert)); + registerTask(modify, Task::UniquePtr(new Modify)); + registerTask(fixiso, Task::UniquePtr(new FixIso)); + registerTask(fixcom, Task::UniquePtr(new FixCom)); } // TaskFactory c'tor - Task::AutoPtr TaskFactory::create(TaskType type) + Task::UniquePtr TaskFactory::create(TaskType type) { Registry::const_iterator i = registry_.find(type); if (i != registry_.end() && i->second != 0) { Task* t = i->second; return t->clone(); } - return Task::AutoPtr(0); - } // TaskFactory::create + return nullptr; + } Print::~Print() { @@ -281,7 +281,7 @@ namespace Action { << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); @@ -513,7 +513,7 @@ namespace Action { << ": " << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); // Set defaults for metadata types and data columns @@ -765,7 +765,7 @@ namespace Action { << ": " << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); if (Params::instance().verbose_) { @@ -782,7 +782,7 @@ namespace Action { << ": " << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); bool const manyFiles = Params::instance().files_.size() > 1; @@ -805,9 +805,9 @@ namespace Action { return 0; } // Print::printPreviewList - Print::AutoPtr Print::clone() const + Print::UniquePtr Print::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Print* Print::clone_() const @@ -830,7 +830,7 @@ namespace Action { Timestamp ts; if (Params::instance().preserve_) ts.read(path); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); @@ -893,9 +893,9 @@ namespace Action { return 1; }} // Rename::run - Rename::AutoPtr Rename::clone() const + Rename::UniquePtr Rename::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Rename* Rename::clone_() const @@ -919,7 +919,7 @@ namespace Action { Timestamp ts; if (Params::instance().preserve_) ts.read(path); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); // Thumbnail must be before Exif @@ -1019,9 +1019,9 @@ namespace Action { return 0; } - Erase::AutoPtr Erase::clone() const + Erase::UniquePtr Erase::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Erase* Erase::clone_() const @@ -1084,7 +1084,7 @@ namespace Action { << ": " << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); @@ -1126,7 +1126,7 @@ namespace Action { << ": " << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); @@ -1164,7 +1164,7 @@ namespace Action { bool bStdout = target == "-" ; if ( rc == 0 ) { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path_); assert(image.get() != 0); image->readMetadata(); if ( !image->iccProfileDefined() ) { @@ -1211,9 +1211,9 @@ namespace Action { } } // Extract::writePreviewFile - Extract::AutoPtr Extract::clone() const + Extract::UniquePtr Extract::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Extract* Extract::clone_() const @@ -1312,7 +1312,7 @@ namespace Action { for ( long i = 0 ; i < xmpBlob.size_ ; i++ ) { xmpPacket += (char) xmpBlob.pData_[i]; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); image->clearXmpData(); @@ -1356,7 +1356,7 @@ namespace Action { // read in the metadata if ( rc == 0 ) { - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); // clear existing profile, assign the blob and rewrite image @@ -1383,7 +1383,7 @@ namespace Action { << ": " << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifThumb exifThumb(image->exifData()); @@ -1393,9 +1393,9 @@ namespace Action { return 0; } // Insert::insertThumbnail - Insert::AutoPtr Insert::clone() const + Insert::UniquePtr Insert::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Insert* Insert::clone_() const @@ -1418,7 +1418,7 @@ namespace Action { Timestamp ts; if (Params::instance().preserve_) ts.read(path); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); @@ -1492,7 +1492,7 @@ namespace Action { Exiv2::ExifData& exifData = pImage->exifData(); Exiv2::IptcData& iptcData = pImage->iptcData(); Exiv2::XmpData& xmpData = pImage->xmpData(); - Exiv2::Value::AutoPtr value = Exiv2::Value::create(modifyCmd.typeId_); + Exiv2::Value::UniquePtr value = Exiv2::Value::create(modifyCmd.typeId_); int rc = value->read(modifyCmd.value_); if (0 == rc) { if (modifyCmd.metadataId_ == exif) { @@ -1553,7 +1553,7 @@ namespace Action { // If a type was explicitly requested, use it; else // use the current type of the metadatum, if any; // or the default type - Exiv2::Value::AutoPtr value; + Exiv2::Value::UniquePtr value; if (metadatum) { value = metadatum->getValue(); } @@ -1630,9 +1630,9 @@ namespace Action { Exiv2::XmpProperties::registerNs(modifyCmd.value_, modifyCmd.key_); } - Modify::AutoPtr Modify::clone() const + Modify::UniquePtr Modify::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Modify* Modify::clone_() const @@ -1659,7 +1659,7 @@ namespace Action { Timestamp ts; if (Params::instance().preserve_) ts.read(path); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); @@ -1686,9 +1686,9 @@ namespace Action { return 1; } // Adjust::run - Adjust::AutoPtr Adjust::clone() const + Adjust::UniquePtr Adjust::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Adjust* Adjust::clone_() const @@ -1795,7 +1795,7 @@ namespace Action { Timestamp ts; if (Params::instance().preserve_) ts.read(path); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); @@ -1833,9 +1833,9 @@ namespace Action { } } // FixIso::run - FixIso::AutoPtr FixIso::clone() const + FixIso::UniquePtr FixIso::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } FixIso* FixIso::clone_() const @@ -1858,7 +1858,7 @@ namespace Action { Timestamp ts; if (Params::instance().preserve_) ts.read(path); - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->readMetadata(); Exiv2::ExifData& exifData = image->exifData(); @@ -1874,7 +1874,7 @@ namespace Action { } return 0; } - Exiv2::Value::AutoPtr v = pos->getValue(); + Exiv2::Value::UniquePtr v = pos->getValue(); const Exiv2::CommentValue* pcv = dynamic_cast(v.get()); if (!pcv) { if (Params::instance().verbose_) { @@ -1909,9 +1909,9 @@ namespace Action { } } // FixCom::run - FixCom::AutoPtr FixCom::clone() const + FixCom::UniquePtr FixCom::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } FixCom* FixCom::clone_() const @@ -2087,9 +2087,10 @@ namespace { Exiv2::DataBuf stdIn; if ( bStdin ) Params::instance().getStdin(stdIn); - Exiv2::BasicIo::AutoPtr ioStdin = Exiv2::BasicIo::AutoPtr(new Exiv2::MemIo(stdIn.pData_,stdIn.size_)); + Exiv2::BasicIo::UniquePtr ioStdin = Exiv2::BasicIo::UniquePtr(new Exiv2::MemIo(stdIn.pData_,stdIn.size_)); - Exiv2::Image::AutoPtr sourceImage = bStdin ? Exiv2::ImageFactory::open(ioStdin) : Exiv2::ImageFactory::open(source); + Exiv2::Image::UniquePtr sourceImage = bStdin ? Exiv2::ImageFactory::open(std::move(ioStdin)) : + Exiv2::ImageFactory::open(source); assert(sourceImage.get() != 0); sourceImage->readMetadata(); @@ -2099,7 +2100,7 @@ namespace { // Open or create the target file std::string target(bStdout ? temporaryPath() : tgt); - Exiv2::Image::AutoPtr targetImage; + Exiv2::Image::UniquePtr targetImage; if (Exiv2::fileExists(target)) { targetImage = Exiv2::ImageFactory::open(target); assert(targetImage.get() != 0); @@ -2356,7 +2357,7 @@ namespace { << _("Failed to open the file\n"); return -1; } - Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path); + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(path); assert(image.get() != 0); image->printStructure(out,option); return 0; diff --git a/src/actions.hpp b/src/actions.hpp index 93eef6c6d8..836face618 100644 --- a/src/actions.hpp +++ b/src/actions.hpp @@ -73,11 +73,11 @@ namespace Action { class Task { public: //! Shortcut for an auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! Virtual destructor. virtual ~Task(); //! Virtual copy construction. - AutoPtr clone() const; + UniquePtr clone() const; /*! @brief Application interface to perform a task. @@ -121,7 +121,7 @@ namespace Action { returned auto pointer and take appropriate action (e.g., throw an exception) if it is 0. */ - Task::AutoPtr create(TaskType type); + Task::UniquePtr create(TaskType type); /*! @brief Register a task prototype together with its type. @@ -135,7 +135,7 @@ namespace Action { @param task Pointer to the prototype. Ownership is transferred to the task factory. That's what the auto pointer indicates. */ - void registerTask(TaskType type, Task::AutoPtr task); + void registerTask(TaskType type, Task::UniquePtr task); private: //! Prevent construction other than through instance(). @@ -157,8 +157,8 @@ namespace Action { public: virtual ~Print(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; //! Print the Jpeg comment int printComment(); @@ -212,8 +212,8 @@ namespace Action { public: virtual ~Rename(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; private: virtual Rename* clone_() const; @@ -224,8 +224,8 @@ namespace Action { public: virtual ~Adjust(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; private: virtual Adjust* clone_() const; @@ -247,8 +247,8 @@ namespace Action { public: virtual ~Erase(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; /*! @brief Delete the thumbnail image, incl IFD1 metadata from the file. @@ -289,8 +289,8 @@ namespace Action { public: virtual ~Extract(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; /*! @brief Write the thumbnail image to a file. The filename is composed by @@ -328,8 +328,8 @@ namespace Action { public: virtual ~Insert(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; /*! @brief Insert a Jpeg thumbnail image from a file into file \em path. @@ -369,15 +369,15 @@ namespace Action { public: virtual ~Modify(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; Modify() {} //! Apply modification commands to the \em pImage, return 0 if successful. static int applyCommands(Exiv2::Image* pImage); private: virtual Modify* clone_() const; - //! Copy constructor needed because of AutoPtr member + //! Copy constructor needed because of UniquePtr member Modify(const Modify& /*src*/) : Task() {} //! Add a metadatum to \em pImage according to \em modifyCmd @@ -402,8 +402,8 @@ namespace Action { public: virtual ~FixIso(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; private: virtual FixIso* clone_() const; @@ -420,8 +420,8 @@ namespace Action { public: virtual ~FixCom(); virtual int run(const std::string& path); - typedef std::auto_ptr AutoPtr; - AutoPtr clone() const; + typedef std::unique_ptr UniquePtr; + UniquePtr clone() const; private: virtual FixCom* clone_() const; diff --git a/src/asfvideo.cpp b/src/asfvideo.cpp index d24413b6b3..11400e0353 100644 --- a/src/asfvideo.cpp +++ b/src/asfvideo.cpp @@ -290,8 +290,8 @@ namespace Exiv2 { using namespace Exiv2::Internal; - AsfVideo::AsfVideo(BasicIo::AutoPtr io) - : Image(ImageType::asf, mdNone, io) + AsfVideo::AsfVideo(BasicIo::UniquePtr io) + : Image(ImageType::asf, mdNone, std::move(io)) { } // AsfVideo::AsfVideo @@ -370,7 +370,7 @@ namespace Exiv2 { DataBuf buf(1000); unsigned long count = 0, tempLength = 0; buf.pData_[4] = '\0' ; - Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpSeq); + Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpSeq); if(compareTag( exvGettext(tv->label_), "Header")) { localPosition_ = 0; @@ -622,7 +622,7 @@ namespace Exiv2 { DataBuf buf(5000); io_->read(buf.pData_, 2); int recordCount = Exiv2::getUShort(buf.pData_, littleEndian), nameLength = 0, dataLength = 0, dataType = 0; - Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpSeq); + Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpSeq); byte guidBuf[16]; char fileID[37] = ""; while(recordCount--) { @@ -784,9 +784,9 @@ namespace Exiv2 { } // AsfVideo::aspectRatio - Image::AutoPtr newAsfInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new AsfVideo(io)); + Image::UniquePtr image(new AsfVideo(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/bigtiffimage.cpp b/src/bigtiffimage.cpp index cb4ace63cd..6c32c84a21 100644 --- a/src/bigtiffimage.cpp +++ b/src/bigtiffimage.cpp @@ -147,8 +147,8 @@ namespace Exiv2 class BigTiffImage: public Image { public: - BigTiffImage(BasicIo::AutoPtr io): - Image(ImageType::bigtiff, mdExif, io), + BigTiffImage(BasicIo::UniquePtr io): + Image(ImageType::bigtiff, mdExif, std::move(io)), header_(), dataSize_(0), doSwap_(false) @@ -439,9 +439,9 @@ namespace Exiv2 } - Image::AutoPtr newBigTiffInstance(BasicIo::AutoPtr io, bool) + Image::UniquePtr newBigTiffInstance(BasicIo::UniquePtr io, bool) { - return Image::AutoPtr(new BigTiffImage(io)); + return Image::UniquePtr(new BigTiffImage(std::move(io))); } diff --git a/src/bmpimage.cpp b/src/bmpimage.cpp index 3a021c2316..06d9336b0c 100644 --- a/src/bmpimage.cpp +++ b/src/bmpimage.cpp @@ -41,7 +41,7 @@ // class member definitions namespace Exiv2 { - BmpImage::BmpImage(BasicIo::AutoPtr io) : Image(ImageType::bmp, mdNone, io) + BmpImage::BmpImage(BasicIo::UniquePtr io) : Image(ImageType::bmp, mdNone, std::move(io)) { } @@ -120,9 +120,9 @@ namespace Exiv2 // ************************************************************************* // free functions - Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newBmpInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new BmpImage(io)); + Image::UniquePtr image(new BmpImage(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/cr2image.cpp b/src/cr2image.cpp index fcfff75b45..c3aa8670c8 100644 --- a/src/cr2image.cpp +++ b/src/cr2image.cpp @@ -46,8 +46,8 @@ namespace Exiv2 { using namespace Internal; - Cr2Image::Cr2Image(BasicIo::AutoPtr io, bool /*create*/) - : Image(ImageType::cr2, mdExif | mdIptc | mdXmp, io) + Cr2Image::Cr2Image(BasicIo::UniquePtr io, bool /*create*/) + : Image(ImageType::cr2, mdExif | mdIptc | mdXmp, std::move(io)) { } // Cr2Image::Cr2Image @@ -183,7 +183,7 @@ namespace Exiv2 { ed.end()); } - std::auto_ptr header(new Cr2Header(byteOrder)); + std::unique_ptr header(new Cr2Header(byteOrder)); OffsetWriter offsetWriter; offsetWriter.setOrigin(OffsetWriter::cr2RawIfdOffset, Cr2Header::offset2addr(), byteOrder); return TiffParserWorker::encode(io, @@ -200,9 +200,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newCr2Instance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newCr2Instance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new Cr2Image(io, create)); + Image::UniquePtr image(new Cr2Image(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/crwimage.cpp b/src/crwimage.cpp index d11249927d..894aa7c52c 100644 --- a/src/crwimage.cpp +++ b/src/crwimage.cpp @@ -52,8 +52,8 @@ namespace Exiv2 { using namespace Internal; - CrwImage::CrwImage(BasicIo::AutoPtr io, bool /*create*/) - : Image(ImageType::crw, mdExif | mdComment, io) + CrwImage::CrwImage(BasicIo::UniquePtr io, bool /*create*/) + : Image(ImageType::crw, mdExif | mdComment, std::move(io)) { } // CrwImage::CrwImage @@ -132,7 +132,7 @@ namespace Exiv2 { CrwParser::encode(blob, buf.pData_, buf.size_, this); // Write new buffer to file - MemIo::AutoPtr tempIo(new MemIo); + MemIo::UniquePtr tempIo(new MemIo); assert(tempIo.get() != 0); tempIo->write((blob.size() > 0 ? &blob[0] : 0), static_cast(blob.size())); io_->close(); @@ -146,7 +146,7 @@ namespace Exiv2 { assert(pData != 0); // Parse the image, starting with a CIFF header component - CiffHeader::AutoPtr head(new CiffHeader); + CiffHeader::UniquePtr head(new CiffHeader); head->read(pData, size); #ifdef DEBUG head->print(std::cerr); @@ -169,7 +169,7 @@ namespace Exiv2 { ) { // Parse image, starting with a CIFF header component - CiffHeader::AutoPtr head(new CiffHeader); + CiffHeader::UniquePtr head(new CiffHeader); if (size != 0) { head->read(pData, size); } @@ -183,9 +183,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newCrwInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new CrwImage(io, create)); + Image::UniquePtr image(new CrwImage(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 704338bd49..ce47b472e9 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -176,17 +176,17 @@ namespace Exiv2 { } } - void CiffComponent::add(AutoPtr component) + void CiffComponent::add(UniquePtr component) { - doAdd(component); + doAdd(std::move(component)); } - void CiffEntry::doAdd(AutoPtr /*component*/) + void CiffEntry::doAdd(UniquePtr /*component*/) { throw Error(kerFunctionNotSupported, "CiffEntry::add"); } // CiffEntry::doAdd - void CiffDirectory::doAdd(AutoPtr component) + void CiffDirectory::doAdd(UniquePtr component) { components_.push_back(component.release()); } // CiffDirectory::doAdd @@ -292,14 +292,14 @@ namespace Exiv2 { for (uint16_t i = 0; i < count; ++i) { uint16_t tag = getUShort(pData + o, byteOrder); - CiffComponent::AutoPtr m; + CiffComponent::UniquePtr m; switch (CiffComponent::typeId(tag)) { - case directory: m = CiffComponent::AutoPtr(new CiffDirectory); break; - default: m = CiffComponent::AutoPtr(new CiffEntry); break; + case directory: m = CiffComponent::UniquePtr(new CiffDirectory); break; + default: m = CiffComponent::UniquePtr(new CiffEntry); break; } m->setDir(this->tag()); m->read(pData, size, o, byteOrder); - add(m); + add(std::move(m)); o += 10; } } // CiffDirectory::readDirectory @@ -513,7 +513,7 @@ namespace Exiv2 { << ", " << _("size") << " = " << std::dec << size_ << ", " << _("offset") << " = " << offset_ << "\n"; - Value::AutoPtr value; + Value::UniquePtr value; if (typeId() != directory) { value = Value::create(typeId()); value->read(pData_, size_, byteOrder); @@ -670,9 +670,9 @@ namespace Exiv2 { } if (cc_ == 0) { // Directory doesn't exist yet, add it - m_ = AutoPtr(new CiffDirectory(csd.crwDir_, csd.parent_)); + m_ = UniquePtr(new CiffDirectory(csd.crwDir_, csd.parent_)); cc_ = m_.get(); - add(m_); + add(std::move(m_)); } // Recursive call to next lower level directory cc_ = cc_->add(crwDirs, crwTagId); @@ -687,9 +687,9 @@ namespace Exiv2 { } if (cc_ == 0) { // Tag doesn't exist yet, add it - m_ = AutoPtr(new CiffEntry(crwTagId, tag())); + m_ = UniquePtr(new CiffEntry(crwTagId, tag())); cc_ = m_.get(); - add(m_); + add(std::move(m_)); } } return cc_; @@ -805,7 +805,7 @@ namespace Exiv2 { // Make ExifKey key1("Exif.Image.Make"); - Value::AutoPtr value1 = Value::create(ciffComponent.typeId()); + Value::UniquePtr value1 = Value::create(ciffComponent.typeId()); uint32_t i = 0; for (; i < ciffComponent.size() && ciffComponent.pData()[i] != '\0'; ++i) { @@ -816,7 +816,7 @@ namespace Exiv2 { // Model ExifKey key2("Exif.Image.Model"); - Value::AutoPtr value2 = Value::create(ciffComponent.typeId()); + Value::UniquePtr value2 = Value::create(ciffComponent.typeId()); uint32_t j = i; for (; i < ciffComponent.size() && ciffComponent.pData()[i] != '\0'; ++i) { @@ -951,7 +951,7 @@ namespace Exiv2 { assert(pCrwMapping != 0); // create a key and value pair ExifKey key(pCrwMapping->tag_, Internal::groupName(pCrwMapping->ifdId_)); - Value::AutoPtr value; + Value::UniquePtr value; if (ciffComponent.typeId() != directory) { value = Value::create(ciffComponent.typeId()); uint32_t size = 0; diff --git a/src/crwimage_int.hpp b/src/crwimage_int.hpp index 3e45bb73ba..585be98a2b 100644 --- a/src/crwimage_int.hpp +++ b/src/crwimage_int.hpp @@ -92,7 +92,7 @@ namespace Exiv2 { class CiffComponent { public: //! CiffComponent auto_ptr type - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! Container type to hold all metadata typedef std::vector Components; @@ -115,7 +115,7 @@ namespace Exiv2 { // Default assignment operator is fine //! Add a component to the composition - void add(AutoPtr component); + void add(UniquePtr component); /*! @brief Add \em crwTagId to the parse tree, if it doesn't exist yet. \em crwDirs contains the path of subdirectories, starting @@ -258,7 +258,7 @@ namespace Exiv2 { //! @name Manipulators //@{ //! Implements add() - virtual void doAdd(AutoPtr component) =0; + virtual void doAdd(UniquePtr component) =0; //! Implements add(). The default implementation does nothing. virtual CiffComponent* doAdd(CrwDirs& crwDirs, uint16_t crwTagId); //! Implements remove(). The default implementation does nothing. @@ -329,7 +329,7 @@ namespace Exiv2 { //@{ using CiffComponent::doAdd; // See base class comment - virtual void doAdd(AutoPtr component); + virtual void doAdd(UniquePtr component); /*! @brief Implements write(). Writes only the value data of the entry, using writeValueData(). @@ -381,7 +381,7 @@ namespace Exiv2 { //! @name Manipulators //@{ // See base class comment - virtual void doAdd(AutoPtr component); + virtual void doAdd(UniquePtr component); // See base class comment virtual CiffComponent* doAdd(CrwDirs& crwDirs, uint16_t crwTagId); // See base class comment @@ -422,7 +422,7 @@ namespace Exiv2 { private: // DATA Components components_; //!< List of components in this dir - AutoPtr m_; // used by recursive doAdd + UniquePtr m_; // used by recursive doAdd CiffComponent* cc_; }; // class CiffDirectory @@ -436,7 +436,7 @@ namespace Exiv2 { class CiffHeader { public: //! CiffHeader auto_ptr type - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ diff --git a/src/datasets.cpp b/src/datasets.cpp index 970420378a..c7f72ebfb5 100644 --- a/src/datasets.cpp +++ b/src/datasets.cpp @@ -656,9 +656,9 @@ namespace Exiv2 { return record_; } - IptcKey::AutoPtr IptcKey::clone() const + IptcKey::UniquePtr IptcKey::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } IptcKey* IptcKey::clone_() const diff --git a/src/epsimage.cpp b/src/epsimage.cpp index 2d91cee723..7c49cfb1d4 100644 --- a/src/epsimage.cpp +++ b/src/epsimage.cpp @@ -805,7 +805,7 @@ namespace { } // create temporary output file - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); if (!tempIo->isopen()) { #ifndef SUPPRESS_WARNINGS @@ -1075,8 +1075,8 @@ namespace { namespace Exiv2 { - EpsImage::EpsImage(BasicIo::AutoPtr io, bool create) - : Image(ImageType::eps, mdXmp, io) + EpsImage::EpsImage(BasicIo::UniquePtr io, bool create) + : Image(ImageType::eps, mdXmp, std::move(io)) { //LogMsg::setLevel(LogMsg::debug); if (create) { @@ -1151,9 +1151,9 @@ namespace Exiv2 // ************************************************************************* // free functions - Image::AutoPtr newEpsInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newEpsInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new EpsImage(io, create)); + Image::UniquePtr image(new EpsImage(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/exif.cpp b/src/exif.cpp index 254d3da618..6350bea178 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -80,7 +80,7 @@ namespace { class Thumbnail { public: //! Shortcut for a %Thumbnail auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Creators //@{ @@ -89,7 +89,7 @@ namespace { //@} //! Factory function to create a thumbnail for the Exif metadata provided. - static AutoPtr create(const Exiv2::ExifData& exifData); + static UniquePtr create(const Exiv2::ExifData& exifData); //! @name Accessors //@{ @@ -123,7 +123,7 @@ namespace { class TiffThumbnail : public Thumbnail { public: //! Shortcut for a %TiffThumbnail auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Manipulators //@{ @@ -147,7 +147,7 @@ namespace { class JpegThumbnail : public Thumbnail { public: //! Shortcut for a %JpegThumbnail auto pointer. - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! @name Manipulators //@{ @@ -192,10 +192,10 @@ namespace Exiv2 { template Exiv2::Exifdatum& setValue(Exiv2::Exifdatum& exifDatum, const T& value) { - std::auto_ptr > v - = std::auto_ptr >(new Exiv2::ValueType); + std::unique_ptr > v + = std::unique_ptr >(new Exiv2::ValueType); v->value_.push_back(value); - exifDatum.value_ = v; + exifDatum.value_ = std::move(v); return exifDatum; } @@ -407,9 +407,9 @@ namespace Exiv2 { return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n); } - Value::AutoPtr Exifdatum::getValue() const + Value::UniquePtr Exifdatum::getValue() const { - return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone(); + return value_.get() == 0 ? nullptr : value_->clone(); } long Exifdatum::sizeDataArea() const @@ -429,14 +429,14 @@ namespace Exiv2 { DataBuf ExifThumbC::copy() const { - Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_); + Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_); if (thumbnail.get() == 0) return DataBuf(); return thumbnail->copy(exifData_); } long ExifThumbC::writeFile(const std::string& path) const { - Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_); + Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_); if (thumbnail.get() == 0) return 0; std::string name = path + thumbnail->extension(); DataBuf buf(thumbnail->copy(exifData_)); @@ -447,7 +447,7 @@ namespace Exiv2 { #ifdef EXV_UNICODE_PATH long ExifThumbC::writeFile(const std::wstring& wpath) const { - Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_); + Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_); if (thumbnail.get() == 0) return 0; std::wstring name = wpath + thumbnail->wextension(); DataBuf buf(thumbnail->copy(exifData_)); @@ -458,14 +458,14 @@ namespace Exiv2 { #endif const char* ExifThumbC::mimeType() const { - Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_); + Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_); if (thumbnail.get() == 0) return ""; return thumbnail->mimeType(); } const char* ExifThumbC::extension() const { - Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_); + Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_); if (thumbnail.get() == 0) return ""; return thumbnail->extension(); } @@ -473,7 +473,7 @@ namespace Exiv2 { #ifdef EXV_UNICODE_PATH const wchar_t* ExifThumbC::wextension() const { - Thumbnail::AutoPtr thumbnail = Thumbnail::create(exifData_); + Thumbnail::UniquePtr thumbnail = Thumbnail::create(exifData_); if (thumbnail.get() == 0) return EXV_WIDEN(""); return thumbnail->wextension(); } @@ -701,7 +701,7 @@ namespace Exiv2 { // Encode and check if the result fits into a JPEG Exif APP1 segment MemIo mio1; - std::auto_ptr header(new TiffHeader(byteOrder, 0x00000008, false)); + std::unique_ptr header(new TiffHeader(byteOrder, 0x00000008, false)); WriteMethod wm = TiffParserWorker::encode(mio1, pData, size, @@ -835,26 +835,26 @@ namespace Exiv2 { namespace { //! @cond IGNORE - Thumbnail::AutoPtr Thumbnail::create(const Exiv2::ExifData& exifData) + Thumbnail::UniquePtr Thumbnail::create(const Exiv2::ExifData& exifData) { - Thumbnail::AutoPtr thumbnail; + Thumbnail::UniquePtr thumbnail; const Exiv2::ExifKey k1("Exif.Thumbnail.Compression"); Exiv2::ExifData::const_iterator pos = exifData.findKey(k1); if (pos != exifData.end()) { if (pos->count() == 0) return thumbnail; long compression = pos->toLong(); if (compression == 6) { - thumbnail = Thumbnail::AutoPtr(new JpegThumbnail); + thumbnail = Thumbnail::UniquePtr(new JpegThumbnail); } else { - thumbnail = Thumbnail::AutoPtr(new TiffThumbnail); + thumbnail = Thumbnail::UniquePtr(new TiffThumbnail); } } else { const Exiv2::ExifKey k2("Exif.Thumbnail.JPEGInterchangeFormat"); pos = exifData.findKey(k2); if (pos != exifData.end()) { - thumbnail = Thumbnail::AutoPtr(new JpegThumbnail); + thumbnail = Thumbnail::UniquePtr(new JpegThumbnail); } } return thumbnail; diff --git a/src/exiv2.cpp b/src/exiv2.cpp index df226f3e6e..9b2d925d8b 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -154,7 +154,7 @@ int main(int argc, char* const argv[]) try { // Create the required action class Action::TaskFactory& taskFactory = Action::TaskFactory::instance(); - Action::Task::AutoPtr task = taskFactory.create(Action::TaskType(params.action_)); + Action::Task::UniquePtr task = taskFactory.create(Action::TaskType(params.action_)); assert(task.get()); // Process all files diff --git a/src/gifimage.cpp b/src/gifimage.cpp index 2583d17a95..43a3dce679 100644 --- a/src/gifimage.cpp +++ b/src/gifimage.cpp @@ -41,8 +41,8 @@ // class member definitions namespace Exiv2 { - GifImage::GifImage(BasicIo::AutoPtr io) - : Image(ImageType::gif, mdNone, io) + GifImage::GifImage(BasicIo::UniquePtr io) + : Image(ImageType::gif, mdNone, std::move(io)) { } // GifImage::GifImage @@ -103,9 +103,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newGifInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new GifImage(io)); + Image::UniquePtr image(new GifImage(std::move(io))); if (!image->good()) { image.reset(); diff --git a/src/image.cpp b/src/image.cpp index 781d84ad04..a813ea0355 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -150,8 +150,8 @@ namespace Exiv2 { Image::Image(int imageType, uint16_t supportedMetadata, - BasicIo::AutoPtr io) - : io_(io), + BasicIo::UniquePtr io) + : io_(std::move(io)), pixelWidth_(0), pixelHeight_(0), imageType_(imageType), @@ -839,143 +839,144 @@ namespace Exiv2 { return ImageType::none; } // ImageFactory::getType - BasicIo::AutoPtr ImageFactory::createIo(const std::string& path, bool useCurl) + BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, bool useCurl) { Protocol fProt = fileProtocol(path); #ifdef EXV_USE_SSH if (fProt == pSsh || fProt == pSftp) { - return BasicIo::AutoPtr(new SshIo(path)); // may throw + return BasicIo::UniquePtr(new SshIo(path)); // may throw } #endif #ifdef EXV_USE_CURL if (useCurl && (fProt == pHttp || fProt == pHttps || fProt == pFtp)) { - return BasicIo::AutoPtr(new CurlIo(path)); // may throw + return BasicIo::UniquePtr(new CurlIo(path)); // may throw } #endif if (fProt == pHttp) - return BasicIo::AutoPtr(new HttpIo(path)); // may throw + return BasicIo::UniquePtr(new HttpIo(path)); // may throw if (fProt == pFileUri) - return BasicIo::AutoPtr(new FileIo(pathOfFileUrl(path))); + return BasicIo::UniquePtr(new FileIo(pathOfFileUrl(path))); if (fProt == pStdin || fProt == pDataUri) - return BasicIo::AutoPtr(new XPathIo(path)); // may throw + return BasicIo::UniquePtr(new XPathIo(path)); // may throw - return BasicIo::AutoPtr(new FileIo(path)); + return BasicIo::UniquePtr(new FileIo(path)); (void)(useCurl); } // ImageFactory::createIo #ifdef EXV_UNICODE_PATH - BasicIo::AutoPtr ImageFactory::createIo(const std::wstring& wpath, bool useCurl) + BasicIo::UniquePtr ImageFactory::createIo(const std::wstring& wpath, bool useCurl) { Protocol fProt = fileProtocol(wpath); #if EXV_USE_SSH == 1 if (fProt == pSsh || fProt == pSftp) { - return BasicIo::AutoPtr(new SshIo(wpath)); + return BasicIo::UniquePtr(new SshIo(wpath)); } #endif #if EXV_USE_CURL == 1 if (useCurl && (fProt == pHttp || fProt == pHttps || fProt == pFtp)) { - return BasicIo::AutoPtr(new CurlIo(wpath)); + return BasicIo::UniquePtr(new CurlIo(wpath)); } #endif if (fProt == pHttp) - return BasicIo::AutoPtr(new HttpIo(wpath)); + return BasicIo::UniquePtr(new HttpIo(wpath)); if (fProt == pFileUri) - return BasicIo::AutoPtr(new FileIo(pathOfFileUrl(wpath))); + return BasicIo::UniquePtr(new FileIo(pathOfFileUrl(wpath))); if (fProt == pStdin || fProt == pDataUri) - return BasicIo::AutoPtr(new XPathIo(wpath)); // may throw - return BasicIo::AutoPtr(new FileIo(wpath)); + return BasicIo::UniquePtr(new XPathIo(wpath)); // may throw + return BasicIo::UniquePtr(new FileIo(wpath)); } // ImageFactory::createIo #endif - Image::AutoPtr ImageFactory::open(const std::string& path, bool useCurl) + Image::UniquePtr ImageFactory::open(const std::string& path, bool useCurl) { - Image::AutoPtr image = open(ImageFactory::createIo(path, useCurl)); // may throw + Image::UniquePtr image = open(ImageFactory::createIo(path, useCurl)); // may throw if (image.get() == 0) throw Error(kerFileContainsUnknownImageType, path); return image; } #ifdef EXV_UNICODE_PATH - Image::AutoPtr ImageFactory::open(const std::wstring& wpath, bool useCurl) + Image::UniquePtr ImageFactory::open(const std::wstring& wpath, bool useCurl) { - Image::AutoPtr image = open(ImageFactory::createIo(wpath, useCurl)); // may throw + Image::UniquePtr image = open(ImageFactory::createIo(wpath, useCurl)); // may throw if (image.get() == 0) throw WError(kerFileContainsUnknownImageType, wpath); return image; } #endif - Image::AutoPtr ImageFactory::open(const byte* data, long size) + Image::UniquePtr ImageFactory::open(const byte* data, long size) { - BasicIo::AutoPtr io(new MemIo(data, size)); - Image::AutoPtr image = open(io); // may throw + BasicIo::UniquePtr io(new MemIo(data, size)); + Image::UniquePtr image = open(std::move(io)); // may throw if (image.get() == 0) throw Error(kerMemoryContainsUnknownImageType); return image; } - Image::AutoPtr ImageFactory::open(BasicIo::AutoPtr io) + Image::UniquePtr ImageFactory::open(BasicIo::UniquePtr io) { if (io->open() != 0) { throw Error(kerDataSourceOpenFailed, io->path(), strError()); } for (unsigned int i = 0; registry[i].imageType_ != ImageType::none; ++i) { if (registry[i].isThisType_(*io, false)) { - return registry[i].newInstance_(io, false); + return registry[i].newInstance_(std::move(io), false); } } - return Image::AutoPtr(); + return Image::UniquePtr(); } // ImageFactory::open - Image::AutoPtr ImageFactory::create(int type, + Image::UniquePtr ImageFactory::create(int type, const std::string& path) { - std::auto_ptr fileIo(new FileIo(path)); + std::unique_ptr fileIo(new FileIo(path)); // Create or overwrite the file, then close it if (fileIo->open("w+b") != 0) { throw Error(kerFileOpenFailed, path, "w+b", strError()); } fileIo->close(); - BasicIo::AutoPtr io(fileIo); - Image::AutoPtr image = create(type, io); - if (image.get() == 0) throw Error(kerUnsupportedImageType, type); + BasicIo::UniquePtr io(std::move(fileIo)); + Image::UniquePtr image = create(type, std::move(io)); + if (!image) + throw Error(kerUnsupportedImageType, type); return image; } #ifdef EXV_UNICODE_PATH - Image::AutoPtr ImageFactory::create(int type, + Image::UniquePtr ImageFactory::create(int type, const std::wstring& wpath) { - std::auto_ptr fileIo(new FileIo(wpath)); + std::unique_ptr fileIo(new FileIo(wpath)); // Create or overwrite the file, then close it if (fileIo->open("w+b") != 0) { throw WError(kerFileOpenFailed, wpath, "w+b", strError().c_str()); } fileIo->close(); - BasicIo::AutoPtr io(fileIo); - Image::AutoPtr image = create(type, io); + BasicIo::UniquePtr io(fileIo); + Image::UniquePtr image = create(type, io); if (image.get() == 0) throw Error(kerUnsupportedImageType, type); return image; } #endif - Image::AutoPtr ImageFactory::create(int type) + Image::UniquePtr ImageFactory::create(int type) { - BasicIo::AutoPtr io(new MemIo); - Image::AutoPtr image = create(type, io); + BasicIo::UniquePtr io(new MemIo); + Image::UniquePtr image = create(type, std::move(io)); if (image.get() == 0) throw Error(kerUnsupportedImageType, type); return image; } - Image::AutoPtr ImageFactory::create(int type, - BasicIo::AutoPtr io) + Image::UniquePtr ImageFactory::create(int type, + BasicIo::UniquePtr io) { // BasicIo instance does not need to be open const Registry* r = find(registry, type); if (0 != r) { - return r->newInstance_(io, true); + return r->newInstance_(std::move(io), true); } - return Image::AutoPtr(); + return Image::UniquePtr(); } // ImageFactory::create // ***************************************************************************** diff --git a/src/iptc.cpp b/src/iptc.cpp index e1bece4777..c9f1d1ff0a 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -202,9 +202,9 @@ namespace Exiv2 { return value_.get() == 0 ? Rational(-1, 1) : value_->toRational(n); } - Value::AutoPtr Iptcdatum::getValue() const + Value::UniquePtr Iptcdatum::getValue() const { - return value_.get() == 0 ? Value::AutoPtr(0) : value_->clone(); + return value_.get() == 0 ? nullptr : value_->clone(); } const Value& Iptcdatum::value() const @@ -229,9 +229,9 @@ namespace Exiv2 { Iptcdatum& Iptcdatum::operator=(const uint16_t& value) { - UShortValue::AutoPtr v(new UShortValue); + UShortValue::UniquePtr v(new UShortValue); v->value_.push_back(value); - value_ = v; + value_ = std::move(v); return *this; } @@ -554,7 +554,7 @@ namespace { uint32_t sizeData ) { - Exiv2::Value::AutoPtr value; + Exiv2::Value::UniquePtr value; Exiv2::TypeId type = Exiv2::IptcDataSets::dataSetType(dataSet, record); value = Exiv2::Value::create(type); int rc = value->read(data, sizeData, Exiv2::bigEndian); diff --git a/src/jp2image.cpp b/src/jp2image.cpp index 07afef0a91..0467949894 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -137,8 +137,8 @@ struct Jp2UuidBox namespace Exiv2 { - Jp2Image::Jp2Image(BasicIo::AutoPtr io, bool create) - : Image(ImageType::jp2, mdExif | mdIptc | mdXmp, io) + Jp2Image::Jp2Image(BasicIo::UniquePtr io, bool create) + : Image(ImageType::jp2, mdExif | mdIptc | mdXmp, std::move(io)) { if (create) { @@ -570,7 +570,7 @@ namespace Exiv2 if ( (rawData.pData_[0] == rawData.pData_[1]) && (rawData.pData_[0]=='I' || rawData.pData_[0]=='M' ) ) { - BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(rawData.pData_,rawData.size_)); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(rawData.pData_,rawData.size_)); printTiffStructure(*p,out,option,depth); } } @@ -605,7 +605,7 @@ namespace Exiv2 throw Error(kerDataSourceOpenFailed, io_->path(), strError()); } IoCloser closer(*io_); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); doWriteMetadata(*tempIo); // may throw @@ -925,9 +925,9 @@ namespace Exiv2 // ************************************************************************* // free functions - Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new Jp2Image(io, create)); + Image::UniquePtr image(new Jp2Image(std::move(io), create)); if (!image->good()) { image.reset(); diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp index 208067d8b4..31261dcf7c 100644 --- a/src/jpgimage.cpp +++ b/src/jpgimage.cpp @@ -300,9 +300,9 @@ namespace Exiv2 { } // Photoshop::setIptcIrb - JpegBase::JpegBase(int type, BasicIo::AutoPtr io, bool create, + JpegBase::JpegBase(int type, BasicIo::UniquePtr io, bool create, const byte initData[], long dataSize) - : Image(type, mdExif | mdIptc | mdXmp | mdComment, io) + : Image(type, mdExif | mdIptc | mdXmp | mdComment, std::move(io)) { if (create) { initImage(initData, dataSize); @@ -783,7 +783,7 @@ namespace Exiv2 { IptcData::printStructure(out, makeSlice(exif, 0, size), depth); } else { // create a copy on write memio object with the data, then print the structure - BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(exif + start, size - start)); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(exif + start, size - start)); if (start < max) printTiffStructure(*p, out, option, depth); } @@ -861,7 +861,7 @@ namespace Exiv2 { // exiv2 -pS E.jpg // binary copy io_ to a temporary file - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert(tempIo.get() != 0); for (uint64_t i = 0; i < (count / 2) + 1; i++) { @@ -894,7 +894,7 @@ namespace Exiv2 { throw Error(kerDataSourceOpenFailed, io_->path(), strError()); } IoCloser closer(*io_); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); doWriteMetadata(*tempIo); // may throw @@ -1313,8 +1313,8 @@ namespace Exiv2 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xDA,0x00,0x0C,0x03,0x01,0x00,0x02, 0x11,0x03,0x11,0x00,0x3F,0x00,0xA0,0x00,0x0F,0xFF,0xD9 }; - JpegImage::JpegImage(BasicIo::AutoPtr io, bool create) - : JpegBase(ImageType::jpeg, io, create, blank_, sizeof(blank_)) + JpegImage::JpegImage(BasicIo::UniquePtr io, bool create) + : JpegBase(ImageType::jpeg, std::move(io), create, blank_, sizeof(blank_)) { } @@ -1339,9 +1339,9 @@ namespace Exiv2 { return isJpegType(iIo, advance); } - Image::AutoPtr newJpegInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newJpegInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new JpegImage(io, create)); + Image::UniquePtr image(new JpegImage(std::move(io), create)); if (!image->good()) { image.reset(); } @@ -1365,8 +1365,8 @@ namespace Exiv2 { const char ExvImage::exiv2Id_[] = "Exiv2"; const byte ExvImage::blank_[] = { 0xff,0x01,'E','x','i','v','2',0xff,0xd9 }; - ExvImage::ExvImage(BasicIo::AutoPtr io, bool create) - : JpegBase(ImageType::exv, io, create, blank_, sizeof(blank_)) + ExvImage::ExvImage(BasicIo::UniquePtr io, bool create) + : JpegBase(ImageType::exv, std::move(io), create, blank_, sizeof(blank_)) { } @@ -1392,10 +1392,10 @@ namespace Exiv2 { return isExvType(iIo, advance); } - Image::AutoPtr newExvInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newExvInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image; - image = Image::AutoPtr(new ExvImage(io, create)); + Image::UniquePtr image; + image = Image::UniquePtr(new ExvImage(std::move(io), create)); if (!image->good()) image.reset(); return image; } diff --git a/src/matroskavideo.cpp b/src/matroskavideo.cpp index 10de952590..b623233204 100644 --- a/src/matroskavideo.cpp +++ b/src/matroskavideo.cpp @@ -476,8 +476,8 @@ namespace Exiv2 { using namespace Exiv2::Internal; - MatroskaVideo::MatroskaVideo(BasicIo::AutoPtr io) - : Image(ImageType::mkv, mdNone, io) + MatroskaVideo::MatroskaVideo(BasicIo::UniquePtr io) + : Image(ImageType::mkv, mdNone, std::move(io)) { } // MatroskaVideo::MatroskaVideo @@ -735,9 +735,9 @@ namespace Exiv2 { else return 0; } // MatroskaVideo::findBlockSize - Image::AutoPtr newMkvInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newMkvInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new MatroskaVideo(io)); + Image::UniquePtr image(new MatroskaVideo(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/metadatum.cpp b/src/metadatum.cpp index 2d995ea40a..9030dde22b 100644 --- a/src/metadatum.cpp +++ b/src/metadatum.cpp @@ -41,9 +41,9 @@ namespace Exiv2 { { } - Key::AutoPtr Key::clone() const + Key::UniquePtr Key::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } Key& Key::operator=(const Key& /*rhs*/) diff --git a/src/mrwimage.cpp b/src/mrwimage.cpp index 29ec409269..56b95a8928 100644 --- a/src/mrwimage.cpp +++ b/src/mrwimage.cpp @@ -44,8 +44,8 @@ // class member definitions namespace Exiv2 { - MrwImage::MrwImage(BasicIo::AutoPtr io, bool /*create*/) - : Image(ImageType::mrw, mdExif | mdIptc | mdXmp, io) + MrwImage::MrwImage(BasicIo::UniquePtr io, bool /*create*/) + : Image(ImageType::mrw, mdExif | mdIptc | mdXmp, std::move(io)) { } // MrwImage::MrwImage @@ -151,9 +151,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newMrwInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new MrwImage(io, create)); + Image::UniquePtr image(new MrwImage(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/orfimage.cpp b/src/orfimage.cpp index 8a36a6bb8f..95a096611f 100644 --- a/src/orfimage.cpp +++ b/src/orfimage.cpp @@ -49,8 +49,8 @@ namespace Exiv2 { using namespace Internal; - OrfImage::OrfImage(BasicIo::AutoPtr io, bool create) - : TiffImage(/*ImageType::orf, mdExif | mdIptc | mdXmp,*/ io,create) + OrfImage::OrfImage(BasicIo::UniquePtr io, bool create) + : TiffImage(/*ImageType::orf, mdExif | mdIptc | mdXmp,*/ std::move(io),create) { setTypeSupported(ImageType::orf, mdExif | mdIptc | mdXmp); } // OrfImage::OrfImage @@ -195,7 +195,7 @@ namespace Exiv2 { ed.end()); } - std::auto_ptr header(new OrfHeader(byteOrder)); + std::unique_ptr header(new OrfHeader(byteOrder)); return TiffParserWorker::encode(io, pData, size, @@ -210,9 +210,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newOrfInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newOrfInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new OrfImage(io, create)); + Image::UniquePtr image(new OrfImage(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/pgfimage.cpp b/src/pgfimage.cpp index d7bbea3f70..24dfe18a06 100644 --- a/src/pgfimage.cpp +++ b/src/pgfimage.cpp @@ -81,8 +81,8 @@ namespace Exiv2 { return result; } - PgfImage::PgfImage(BasicIo::AutoPtr io, bool create) - : Image(ImageType::pgf, mdExif | mdIptc| mdXmp | mdComment, io) + PgfImage::PgfImage(BasicIo::UniquePtr io, bool create) + : Image(ImageType::pgf, mdExif | mdIptc| mdXmp | mdComment, std::move(io)) , bSwap_(isBigEndianPlatform()) { if (create) @@ -143,7 +143,7 @@ namespace Exiv2 { if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != imgData.size_) throw Error(kerInputDataReadFailed); - Image::AutoPtr image = Exiv2::ImageFactory::open(imgData.pData_, imgData.size_); + Image::UniquePtr image = Exiv2::ImageFactory::open(imgData.pData_, imgData.size_); image->readMetadata(); exifData() = image->exifData(); iptcData() = image->iptcData(); @@ -158,7 +158,7 @@ namespace Exiv2 { throw Error(kerDataSourceOpenFailed, io_->path(), strError()); } IoCloser closer(*io_); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); doWriteMetadata(*tempIo); // may throw @@ -192,7 +192,7 @@ namespace Exiv2 { int w, h; DataBuf header = readPgfHeaderStructure(*io_, w, h); - Image::AutoPtr img = ImageFactory::create(ImageType::png); + Image::UniquePtr img = ImageFactory::create(ImageType::png); img->setExifData(exifData_); img->setIptcData(iptcData_); @@ -314,9 +314,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new PgfImage(io, create)); + Image::UniquePtr image(new PgfImage(std::move(io), create)); if (!image->good()) { image.reset(); diff --git a/src/pngimage.cpp b/src/pngimage.cpp index 90844d0953..6a75223777 100644 --- a/src/pngimage.cpp +++ b/src/pngimage.cpp @@ -72,8 +72,8 @@ namespace Exiv2 { using namespace Internal; - PngImage::PngImage(BasicIo::AutoPtr io, bool create) - : Image(ImageType::png, mdExif | mdIptc | mdXmp | mdComment, io) + PngImage::PngImage(BasicIo::UniquePtr io, bool create) + : Image(ImageType::png, mdExif | mdIptc | mdXmp | mdComment, std::move(io)) { if (create) { @@ -352,7 +352,7 @@ namespace Exiv2 { if ( parsedBuf.size_ ) { if ( bExif ) { // create memio object with the data, then print the structure - BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(parsedBuf.pData_+6,parsedBuf.size_-6)); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(parsedBuf.pData_+6,parsedBuf.size_-6)); printTiffStructure(*p,out,option,depth); } if ( bIptc ) { @@ -531,7 +531,7 @@ namespace Exiv2 { throw Error(kerDataSourceOpenFailed, io_->path(), strError()); } IoCloser closer(*io_); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); doWriteMetadata(*tempIo); // may throw @@ -742,9 +742,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newPngInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newPngInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new PngImage(io, create)); + Image::UniquePtr image(new PngImage(std::move(io), create)); if (!image->good()) { image.reset(); diff --git a/src/preview.cpp b/src/preview.cpp index f22428053a..f7e74840bc 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -93,10 +93,10 @@ namespace { virtual ~Loader() {} //! Loader auto pointer - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! Create a Loader subclass for requested id - static AutoPtr create(PreviewId id, const Image &image); + static UniquePtr create(PreviewId id, const Image &image); //! Check if a preview image with given params exists in the image virtual bool valid() const { return valid_; } @@ -118,7 +118,7 @@ namespace { Loader(PreviewId id, const Image &image); //! Functions that creates a loader from given parameters - typedef AutoPtr (*CreateFunc)(PreviewId id, const Image &image, int parIdx); + typedef UniquePtr (*CreateFunc)(PreviewId id, const Image &image, int parIdx); //! Structure to list possible loaders struct LoaderList { @@ -170,7 +170,7 @@ namespace { }; //! Function to create new LoaderNative - Loader::AutoPtr createLoaderNative(PreviewId id, const Image &image, int parIdx); + Loader::UniquePtr createLoaderNative(PreviewId id, const Image &image, int parIdx); //! Loader for Jpeg previews that are not read into ExifData directly class LoaderExifJpeg : public Loader { @@ -204,7 +204,7 @@ namespace { }; //! Function to create new LoaderExifJpeg - Loader::AutoPtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx); + Loader::UniquePtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx); //! Loader for Jpeg previews that are read into ExifData class LoaderExifDataJpeg : public Loader { @@ -237,7 +237,7 @@ namespace { }; //! Function to create new LoaderExifDataJpeg - Loader::AutoPtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx); + Loader::UniquePtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx); //! Loader for Tiff previews - it can get image data from ExifData or image_.io() as needed class LoaderTiff : public Loader { @@ -274,7 +274,7 @@ namespace { }; //! Function to create new LoaderTiff - Loader::AutoPtr createLoaderTiff(PreviewId id, const Image &image, int parIdx); + Loader::UniquePtr createLoaderTiff(PreviewId id, const Image &image, int parIdx); //! Loader for JPEG previews stored in the XMP metadata class LoaderXmpJpeg : public Loader { @@ -297,7 +297,7 @@ namespace { }; //! Function to create new LoaderXmpJpeg - Loader::AutoPtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx); + Loader::UniquePtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx); // ***************************************************************************** // class member definitions @@ -377,16 +377,16 @@ namespace { { "Image2", 0, 0 } // 7 }; - Loader::AutoPtr Loader::create(PreviewId id, const Image &image) + Loader::UniquePtr Loader::create(PreviewId id, const Image &image) { if (id < 0 || id >= Loader::getNumLoaders()) - return AutoPtr(); + return UniquePtr(); if (loaderList_[id].imageMimeType_ && std::string(loaderList_[id].imageMimeType_) != image.mimeType()) - return AutoPtr(); + return UniquePtr(); - AutoPtr loader = loaderList_[id].create_(id, image, loaderList_[id].parIdx_); + UniquePtr loader = loaderList_[id].create_(id, image, loaderList_[id].parIdx_); if (loader.get() && !loader->valid()) loader.reset(); return loader; @@ -430,9 +430,9 @@ namespace { } } - Loader::AutoPtr createLoaderNative(PreviewId id, const Image &image, int parIdx) + Loader::UniquePtr createLoaderNative(PreviewId id, const Image &image, int parIdx) { - return Loader::AutoPtr(new LoaderNative(id, image, parIdx)); + return Loader::UniquePtr(new LoaderNative(id, image, parIdx)); } PreviewProperties LoaderNative::getProperties() const @@ -506,7 +506,7 @@ namespace { const DataBuf data = getData(); if (data.size_ == 0) return false; try { - Image::AutoPtr image = ImageFactory::open(data.pData_, data.size_); + Image::UniquePtr image = ImageFactory::open(data.pData_, data.size_); if (image.get() == 0) return false; image->readMetadata(); @@ -552,9 +552,9 @@ namespace { valid_ = true; } - Loader::AutoPtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx) + Loader::UniquePtr createLoaderExifJpeg(PreviewId id, const Image &image, int parIdx) { - return Loader::AutoPtr(new LoaderExifJpeg(id, image, parIdx)); + return Loader::UniquePtr(new LoaderExifJpeg(id, image, parIdx)); } PreviewProperties LoaderExifJpeg::getProperties() const @@ -597,7 +597,7 @@ namespace { const Exiv2::byte* base = io.mmap(); try { - Image::AutoPtr image = ImageFactory::open(base + offset_, size_); + Image::UniquePtr image = ImageFactory::open(base + offset_, size_); if (image.get() == 0) return false; image->readMetadata(); @@ -630,9 +630,9 @@ namespace { valid_ = true; } - Loader::AutoPtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx) + Loader::UniquePtr createLoaderExifDataJpeg(PreviewId id, const Image &image, int parIdx) { - return Loader::AutoPtr(new LoaderExifDataJpeg(id, image, parIdx)); + return Loader::UniquePtr(new LoaderExifDataJpeg(id, image, parIdx)); } PreviewProperties LoaderExifDataJpeg::getProperties() const @@ -674,7 +674,7 @@ namespace { if (buf.size_ == 0) return false; try { - Image::AutoPtr image = ImageFactory::open(buf.pData_, buf.size_); + Image::UniquePtr image = ImageFactory::open(buf.pData_, buf.size_); if (image.get() == 0) return false; image->readMetadata(); @@ -742,9 +742,9 @@ namespace { valid_ = true; } - Loader::AutoPtr createLoaderTiff(PreviewId id, const Image &image, int parIdx) + Loader::UniquePtr createLoaderTiff(PreviewId id, const Image &image, int parIdx) { - return Loader::AutoPtr(new LoaderTiff(id, image, parIdx)); + return Loader::UniquePtr(new LoaderTiff(id, image, parIdx)); } PreviewProperties LoaderTiff::getProperties() const @@ -864,9 +864,9 @@ namespace { valid_ = true; } - Loader::AutoPtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx) + Loader::UniquePtr createLoaderXmpJpeg(PreviewId id, const Image &image, int parIdx) { - return Loader::AutoPtr(new LoaderXmpJpeg(id, image, parIdx)); + return Loader::UniquePtr(new LoaderXmpJpeg(id, image, parIdx)); } PreviewProperties LoaderXmpJpeg::getProperties() const @@ -1145,7 +1145,7 @@ namespace Exiv2 { PreviewPropertiesList list; // go through the loader table and store all successfully created loaders in the list for (PreviewId id = 0; id < Loader::getNumLoaders(); ++id) { - Loader::AutoPtr loader = Loader::create(id, image_); + Loader::UniquePtr loader = Loader::create(id, image_); if (loader.get() && loader->readDimensions()) { PreviewProperties props = loader->getProperties(); DataBuf buf = loader->getData(); // #16 getPreviewImage() @@ -1159,7 +1159,7 @@ namespace Exiv2 { PreviewImage PreviewManager::getPreviewImage(const PreviewProperties &properties) const { - Loader::AutoPtr loader = Loader::create(properties.id_, image_); + Loader::UniquePtr loader = Loader::create(properties.id_, image_); DataBuf buf; if (loader.get()) { buf = loader->getData(); diff --git a/src/properties.cpp b/src/properties.cpp index 084f5af171..b81f372e28 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -2754,9 +2754,9 @@ namespace Exiv2 { return *this; } - XmpKey::AutoPtr XmpKey::clone() const + XmpKey::UniquePtr XmpKey::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } XmpKey* XmpKey::clone_() const diff --git a/src/psdimage.cpp b/src/psdimage.cpp index 8ed67544d7..f4878eb336 100644 --- a/src/psdimage.cpp +++ b/src/psdimage.cpp @@ -123,8 +123,8 @@ enum { // class member definitions namespace Exiv2 { - PsdImage::PsdImage(BasicIo::AutoPtr io) - : Image(ImageType::psd, mdExif | mdIptc | mdXmp, io) + PsdImage::PsdImage(BasicIo::UniquePtr io) + : Image(ImageType::psd, mdExif | mdIptc | mdXmp, std::move(io)) { } // PsdImage::PsdImage @@ -349,7 +349,7 @@ namespace Exiv2 { throw Error(kerDataSourceOpenFailed, io_->path(), strError()); } IoCloser closer(*io_); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); doWriteMetadata(*tempIo); // may throw @@ -682,9 +682,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newPsdInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new PsdImage(io)); + Image::UniquePtr image(new PsdImage(std::move(io))); if (!image->good()) { image.reset(); diff --git a/src/quicktimevideo.cpp b/src/quicktimevideo.cpp index e4d068a4fa..b43accca2c 100644 --- a/src/quicktimevideo.cpp +++ b/src/quicktimevideo.cpp @@ -606,8 +606,8 @@ namespace Exiv2 { using namespace Exiv2::Internal; - QuickTimeVideo::QuickTimeVideo(BasicIo::AutoPtr io) - : Image(ImageType::qtime, mdNone, io) + QuickTimeVideo::QuickTimeVideo(BasicIo::UniquePtr io) + : Image(ImageType::qtime, mdNone, std::move(io)) , timeScale_(1) { } // QuickTimeVideo::QuickTimeVideo @@ -1393,7 +1393,7 @@ namespace Exiv2 { DataBuf buf(5); std::memset(buf.pData_, 0x0, buf.size_); buf.pData_[4] = '\0'; - Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpSeq); + Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpSeq); const TagVocabulary* td; for (int i = 0; size/4 != 0; size -=4, i++) { @@ -1629,8 +1629,8 @@ namespace Exiv2 { } // QuickTimeVideo::aspectRatio - Image::AutoPtr newQTimeInstance(BasicIo::AutoPtr io, bool /*create*/) { - Image::AutoPtr image(new QuickTimeVideo(io)); + Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, bool /*create*/) { + Image::UniquePtr image(new QuickTimeVideo(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/rafimage.cpp b/src/rafimage.cpp index 0c23712ebc..8bfb349238 100644 --- a/src/rafimage.cpp +++ b/src/rafimage.cpp @@ -45,8 +45,8 @@ // class member definitions namespace Exiv2 { - RafImage::RafImage(BasicIo::AutoPtr io, bool /*create*/) - : Image(ImageType::raf, mdExif | mdIptc | mdXmp, io) + RafImage::RafImage(BasicIo::UniquePtr io, bool /*create*/) + : Image(ImageType::raf, mdExif | mdIptc | mdXmp, std::move(io)) { } // RafImage::RafImage @@ -324,9 +324,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newRafInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newRafInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new RafImage(io, create)); + Image::UniquePtr image(new RafImage(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/riffvideo.cpp b/src/riffvideo.cpp index 107e5a88e2..f043dc6cbd 100644 --- a/src/riffvideo.cpp +++ b/src/riffvideo.cpp @@ -501,8 +501,8 @@ namespace Exiv2 { namespace Exiv2 { using namespace Exiv2::Internal; - RiffVideo::RiffVideo(BasicIo::AutoPtr io) - : Image(ImageType::riff, mdNone, io) + RiffVideo::RiffVideo(BasicIo::UniquePtr io) + : Image(ImageType::riff, mdNone, std::move(io)) { } // RiffVideo::RiffVideo @@ -577,7 +577,7 @@ namespace Exiv2 { if ( equalsRiffTag(chunkId, RIFF_CHUNK_HEADER_EXIF) && option==kpsRecursive ) { // create memio object with the payload, then print the structure - BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(payload.pData_,payload.size_)); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(payload.pData_,payload.size_)); printTiffStructure(*p,out,option,depth); } @@ -1305,9 +1305,9 @@ namespace Exiv2 { xmpData_["Xmp.video.Duration"] = duration; //Duration in number of seconds } // RiffVideo::fillDuration - Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new RiffVideo(io)); + Image::UniquePtr image(new RiffVideo(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/rw2image.cpp b/src/rw2image.cpp index faf5126168..9a7e7a5719 100644 --- a/src/rw2image.cpp +++ b/src/rw2image.cpp @@ -47,8 +47,8 @@ namespace Exiv2 { using namespace Internal; - Rw2Image::Rw2Image(BasicIo::AutoPtr io) - : Image(ImageType::rw2, mdExif | mdIptc | mdXmp, io) + Rw2Image::Rw2Image(BasicIo::UniquePtr io) + : Image(ImageType::rw2, mdExif | mdIptc | mdXmp, std::move(io)) { } // Rw2Image::Rw2Image @@ -145,7 +145,7 @@ namespace Exiv2 { if (list.size() != 1) return; ExifData exifData; PreviewImage preview = loader.getPreviewImage(*list.begin()); - Image::AutoPtr image = ImageFactory::open(preview.pData(), preview.size()); + Image::UniquePtr image = ImageFactory::open(preview.pData(), preview.size()); if (image.get() == 0) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to open RW2 preview image.\n"; @@ -244,9 +244,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newRw2Instance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newRw2Instance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new Rw2Image(io)); + Image::UniquePtr image(new Rw2Image(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/tags.cpp b/src/tags.cpp index fa897afa11..7a7277bd9b 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -415,9 +415,9 @@ namespace Exiv2 { return p_->tag_; } - ExifKey::AutoPtr ExifKey::clone() const + ExifKey::UniquePtr ExifKey::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } ExifKey* ExifKey::clone_() const diff --git a/src/tgaimage.cpp b/src/tgaimage.cpp index e07e03107a..cbbe875e72 100644 --- a/src/tgaimage.cpp +++ b/src/tgaimage.cpp @@ -41,8 +41,8 @@ // class member definitions namespace Exiv2 { - TgaImage::TgaImage(BasicIo::AutoPtr io) - : Image(ImageType::tga, mdNone, io) + TgaImage::TgaImage(BasicIo::UniquePtr io) + : Image(ImageType::tga, mdNone, std::move(io)) { } // TgaImage::TgaImage @@ -125,9 +125,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newTgaInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newTgaInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new TgaImage(io)); + Image::UniquePtr image(new TgaImage(std::move(io))); if (!image->good()) { image.reset(); diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 3fe73263e0..426b999fd0 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -289,9 +289,9 @@ namespace Exiv2 { { } - TiffComponent::AutoPtr TiffComponent::clone() const + TiffComponent::UniquePtr TiffComponent::clone() const { - return AutoPtr(doClone()); + return UniquePtr(doClone()); } TiffEntry* TiffEntry::doClone() const @@ -373,9 +373,10 @@ namespace Exiv2 { if (pData_ == 0) size_ = 0; } - void TiffEntryBase::updateValue(Value::AutoPtr value, ByteOrder byteOrder) + void TiffEntryBase::updateValue(Value::UniquePtr value, ByteOrder byteOrder) { - if (value.get() == 0) return; + if (value.get() == 0) + return; uint32_t newSize = value->size(); if (newSize > size_) { setData(DataBuf(newSize)); @@ -385,10 +386,10 @@ namespace Exiv2 { } size_ = value->copy(pData_, byteOrder); assert(size_ == newSize); - setValue(value); + setValue(std::move(value)); } // TiffEntryBase::updateValue - void TiffEntryBase::setValue(Value::AutoPtr value) + void TiffEntryBase::setValue(Value::UniquePtr value) { if (value.get() == 0) return; tiffType_ = toTiffType(value->typeId()); @@ -615,7 +616,7 @@ namespace Exiv2 { { uint16_t tag = static_cast(idx / cfg()->tagStep()); int32_t sz = EXV_MIN(def.size(tag, cfg()->group_), TiffEntryBase::doSize() - idx); - TiffComponent::AutoPtr tc = TiffCreator::create(tag, cfg()->group_); + TiffComponent::UniquePtr tc = TiffCreator::create(tag, cfg()->group_); TiffBinaryElement* tp = dynamic_cast(tc.get()); // The assertion typically fails if a component is not configured in // the TIFF structure table (TiffCreator::tiffTreeStruct_) @@ -624,22 +625,22 @@ namespace Exiv2 { tp->setData(const_cast(pData() + idx), sz); tp->setElDef(def); tp->setElByteOrder(cfg()->byteOrder_); - addChild(tc); + addChild(std::move(tc)); return sz; } // TiffBinaryArray::addElement TiffComponent* TiffComponent::addPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object) + TiffComponent::UniquePtr object) { - return doAddPath(tag, tiffPath, pRoot, object); + return doAddPath(tag, tiffPath, pRoot, std::move(object)); } // TiffComponent::addPath TiffComponent* TiffComponent::doAddPath(uint16_t /*tag*/, TiffPath& /*tiffPath*/, TiffComponent* const /*pRoot*/, - TiffComponent::AutoPtr /*object*/) + TiffComponent::UniquePtr /*object*/) { return this; } // TiffComponent::doAddPath @@ -647,7 +648,7 @@ namespace Exiv2 { TiffComponent* TiffDirectory::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object) + TiffComponent::UniquePtr object) { assert(tiffPath.size() > 1); tiffPath.pop(); @@ -673,9 +674,9 @@ namespace Exiv2 { } } if (tc == 0) { - TiffComponent::AutoPtr atc; + TiffComponent::UniquePtr atc; if (tiffPath.size() == 1 && object.get() != 0) { - atc = object; + atc = std::move(object); } else { atc = TiffCreator::create(tpi.extendedTag(), tpi.group()); @@ -687,19 +688,19 @@ namespace Exiv2 { if (tiffPath.size() == 1 && dynamic_cast(atc.get()) != 0) return 0; if (tpi.extendedTag() == Tag::next) { - tc = this->addNext(atc); + tc = this->addNext(std::move(atc)); } else { - tc = this->addChild(atc); + tc = this->addChild(std::move(atc)); } } - return tc->addPath(tag, tiffPath, pRoot, object); + return tc->addPath(tag, tiffPath, pRoot, std::move(object)); } // TiffDirectory::doAddPath TiffComponent* TiffSubIfd::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object) + TiffComponent::UniquePtr object) { assert(!tiffPath.empty()); const TiffPathItem tpi1 = tiffPath.top(); @@ -720,21 +721,21 @@ namespace Exiv2 { } if (tc == 0) { if (tiffPath.size() == 1 && object.get() != 0) { - tc = addChild(object); + tc = addChild(std::move(object)); } else { - TiffComponent::AutoPtr atc(new TiffDirectory(tpi1.tag(), tpi2.group())); - tc = addChild(atc); + TiffComponent::UniquePtr atc(new TiffDirectory(tpi1.tag(), tpi2.group())); + tc = addChild(std::move(atc)); } setCount(static_cast(ifds_.size())); } - return tc->addPath(tag, tiffPath, pRoot, object); + return tc->addPath(tag, tiffPath, pRoot, std::move(object)); } // TiffSubIfd::doAddPath TiffComponent* TiffMnEntry::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object) + TiffComponent::UniquePtr object) { assert(!tiffPath.empty()); const TiffPathItem tpi1 = tiffPath.top(); @@ -750,21 +751,21 @@ namespace Exiv2 { mn_ = TiffMnCreator::create(tpi1.tag(), tpi1.group(), mnGroup_); assert(mn_); } - return mn_->addPath(tag, tiffPath, pRoot, object); + return mn_->addPath(tag, tiffPath, pRoot, std::move(object)); } // TiffMnEntry::doAddPath TiffComponent* TiffIfdMakernote::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object) + TiffComponent::UniquePtr object) { - return ifd_.addPath(tag, tiffPath, pRoot, object); + return ifd_.addPath(tag, tiffPath, pRoot, std::move(object)); } TiffComponent* TiffBinaryArray::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object) + TiffComponent::UniquePtr object) { pRoot_ = pRoot; if (tiffPath.size() == 1) { @@ -788,39 +789,39 @@ namespace Exiv2 { } } if (tc == 0) { - TiffComponent::AutoPtr atc; + TiffComponent::UniquePtr atc; if (tiffPath.size() == 1 && object.get() != 0) { - atc = object; + atc = std::move(object); } else { atc = TiffCreator::create(tpi.extendedTag(), tpi.group()); } assert(atc.get() != 0); assert(tpi.extendedTag() != Tag::next); - tc = addChild(atc); + tc = addChild(std::move(atc)); setCount(static_cast(elements_.size())); } - return tc->addPath(tag, tiffPath, pRoot, object); + return tc->addPath(tag, tiffPath, pRoot, std::move(object)); } // TiffBinaryArray::doAddPath - TiffComponent* TiffComponent::addChild(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffComponent::addChild(TiffComponent::UniquePtr tiffComponent) { - return doAddChild(tiffComponent); + return doAddChild(std::move(tiffComponent)); } // TiffComponent::addChild - TiffComponent* TiffComponent::doAddChild(AutoPtr /*tiffComponent*/) + TiffComponent* TiffComponent::doAddChild(UniquePtr /*tiffComponent*/) { return 0; } // TiffComponent::doAddChild - TiffComponent* TiffDirectory::doAddChild(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffDirectory::doAddChild(TiffComponent::UniquePtr tiffComponent) { TiffComponent* tc = tiffComponent.release(); components_.push_back(tc); return tc; } // TiffDirectory::doAddChild - TiffComponent* TiffSubIfd::doAddChild(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffSubIfd::doAddChild(TiffComponent::UniquePtr tiffComponent) { TiffDirectory* d = dynamic_cast(tiffComponent.release()); assert(d); @@ -828,21 +829,21 @@ namespace Exiv2 { return d; } // TiffSubIfd::doAddChild - TiffComponent* TiffMnEntry::doAddChild(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffMnEntry::doAddChild(TiffComponent::UniquePtr tiffComponent) { TiffComponent* tc = 0; if (mn_) { - tc = mn_->addChild(tiffComponent); + tc = mn_->addChild(std::move(tiffComponent)); } return tc; } // TiffMnEntry::doAddChild - TiffComponent* TiffIfdMakernote::doAddChild(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffIfdMakernote::doAddChild(TiffComponent::UniquePtr tiffComponent) { - return ifd_.addChild(tiffComponent); + return ifd_.addChild(std::move(tiffComponent)); } - TiffComponent* TiffBinaryArray::doAddChild(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffBinaryArray::doAddChild(TiffComponent::UniquePtr tiffComponent) { TiffComponent* tc = tiffComponent.release(); elements_.push_back(tc); @@ -850,17 +851,17 @@ namespace Exiv2 { return tc; } // TiffBinaryArray::doAddChild - TiffComponent* TiffComponent::addNext(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffComponent::addNext(TiffComponent::UniquePtr tiffComponent) { - return doAddNext(tiffComponent); + return doAddNext(std::move(tiffComponent)); } // TiffComponent::addNext - TiffComponent* TiffComponent::doAddNext(AutoPtr /*tiffComponent*/) + TiffComponent* TiffComponent::doAddNext(UniquePtr /*tiffComponent*/) { return 0; } // TiffComponent::doAddNext - TiffComponent* TiffDirectory::doAddNext(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffDirectory::doAddNext(TiffComponent::UniquePtr tiffComponent) { TiffComponent* tc = 0; if (hasNext_) { @@ -870,18 +871,18 @@ namespace Exiv2 { return tc; } // TiffDirectory::doAddNext - TiffComponent* TiffMnEntry::doAddNext(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffMnEntry::doAddNext(TiffComponent::UniquePtr tiffComponent) { TiffComponent* tc = 0; if (mn_) { - tc = mn_->addNext(tiffComponent); + tc = mn_->addNext(std::move(tiffComponent)); } return tc; } // TiffMnEntry::doAddNext - TiffComponent* TiffIfdMakernote::doAddNext(TiffComponent::AutoPtr tiffComponent) + TiffComponent* TiffIfdMakernote::doAddNext(TiffComponent::UniquePtr tiffComponent) { - return ifd_.addNext(tiffComponent); + return ifd_.addNext(std::move(tiffComponent)); } void TiffComponent::accept(TiffVisitor& visitor) @@ -1883,19 +1884,19 @@ namespace Exiv2 { return lhs->group() < rhs->group(); } - TiffComponent::AutoPtr newTiffEntry(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffEntry(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr(new TiffEntry(tag, group)); + return TiffComponent::UniquePtr(new TiffEntry(tag, group)); } - TiffComponent::AutoPtr newTiffMnEntry(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffMnEntry(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr(new TiffMnEntry(tag, group, mnId)); + return TiffComponent::UniquePtr(new TiffMnEntry(tag, group, mnId)); } - TiffComponent::AutoPtr newTiffBinaryElement(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffBinaryElement(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr(new TiffBinaryElement(tag, group)); + return TiffComponent::UniquePtr(new TiffBinaryElement(tag, group)); } }} // namespace Internal, Exiv2 diff --git a/src/tiffcomposite_int.hpp b/src/tiffcomposite_int.hpp index 63812c1c78..96d398f6bb 100644 --- a/src/tiffcomposite_int.hpp +++ b/src/tiffcomposite_int.hpp @@ -174,7 +174,7 @@ namespace Exiv2 { class TiffComponent { public: //! TiffComponent auto_ptr type - typedef std::auto_ptr AutoPtr; + typedef std::unique_ptr UniquePtr; //! Container type to hold all metadata typedef std::vector Components; @@ -203,20 +203,20 @@ namespace Exiv2 { TiffComponent* addPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - AutoPtr object =AutoPtr(0)); + UniquePtr object =UniquePtr(nullptr)); /*! @brief Add a child to the component. Default is to do nothing. @param tiffComponent Auto pointer to the component to add. @return Return a pointer to the newly added child element or 0. */ - TiffComponent* addChild(AutoPtr tiffComponent); + TiffComponent* addChild(UniquePtr tiffComponent); /*! @brief Add a "next" component to the component. Default is to do nothing. @param tiffComponent Auto pointer to the component to add. @return Return a pointer to the newly added "next" element or 0. */ - TiffComponent* addNext(AutoPtr tiffComponent); + TiffComponent* addNext(UniquePtr tiffComponent); /*! @brief Interface to accept visitors (Visitor pattern). Visitors can perform operations on all components of the composite. @@ -265,7 +265,7 @@ namespace Exiv2 { without any children). The caller owns this copy and the auto-pointer ensures that it will be deleted. */ - AutoPtr clone() const; + UniquePtr clone() const; /*! @brief Write the IFD data of this component to a binary image. Return the number of bytes written. Components derived from @@ -321,11 +321,11 @@ namespace Exiv2 { virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object); + TiffComponent::UniquePtr object); //! Implements addChild(). The default implementation does nothing. - virtual TiffComponent* doAddChild(AutoPtr tiffComponent); + virtual TiffComponent* doAddChild(UniquePtr tiffComponent); //! Implements addNext(). The default implementation does nothing. - virtual TiffComponent* doAddNext(AutoPtr tiffComponent); + virtual TiffComponent* doAddNext(UniquePtr tiffComponent); //! Implements accept(). virtual void doAccept(TiffVisitor& visitor) =0; //! Implements write(). @@ -445,13 +445,13 @@ namespace Exiv2 { Update binary value data and call setValue(). */ - void updateValue(Value::AutoPtr value, ByteOrder byteOrder); + void updateValue(Value::UniquePtr value, ByteOrder byteOrder); /*! @brief Set tag value. Takes ownership of the pointer passed in. Update type, count and the pointer to the value. */ - void setValue(Value::AutoPtr value); + void setValue(Value::UniquePtr value); //@} //! @name Accessors @@ -888,9 +888,9 @@ namespace Exiv2 { virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object); - virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent); - virtual TiffComponent* doAddNext(TiffComponent::AutoPtr tiffComponent); + TiffComponent::UniquePtr object); + virtual TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent); + virtual TiffComponent* doAddNext(TiffComponent::UniquePtr tiffComponent); virtual void doAccept(TiffVisitor& visitor); /*! @brief Implements write(). Write the TIFF directory, values and @@ -1004,8 +1004,8 @@ namespace Exiv2 { virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object); - virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent); + TiffComponent::UniquePtr object); + virtual TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent); virtual void doAccept(TiffVisitor& visitor); virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum); /*! @@ -1089,9 +1089,9 @@ namespace Exiv2 { virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object); - virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent); - virtual TiffComponent* doAddNext(TiffComponent::AutoPtr tiffComponent); + TiffComponent::UniquePtr object); + virtual TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent); + virtual TiffComponent* doAddNext(TiffComponent::UniquePtr tiffComponent); virtual void doAccept(TiffVisitor& visitor); virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum); /*! @@ -1221,9 +1221,9 @@ namespace Exiv2 { virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object); - virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent); - virtual TiffComponent* doAddNext(TiffComponent::AutoPtr tiffComponent); + TiffComponent::UniquePtr object); + virtual TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent); + virtual TiffComponent* doAddNext(TiffComponent::UniquePtr tiffComponent); virtual void doAccept(TiffVisitor& visitor); /*! @brief Implements write(). Write the Makernote header, TIFF directory, @@ -1435,11 +1435,11 @@ namespace Exiv2 { virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* const pRoot, - TiffComponent::AutoPtr object); + TiffComponent::UniquePtr object); /*! @brief Implements addChild(). Todo: Document it! */ - virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent); + virtual TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent); virtual void doAccept(TiffVisitor& visitor); virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum); /*! @@ -1583,83 +1583,83 @@ namespace Exiv2 { bool cmpGroupLt(TiffComponent const* lhs, TiffComponent const* rhs); //! Function to create and initialize a new TIFF entry - TiffComponent::AutoPtr newTiffEntry(uint16_t tag, IfdId group); + TiffComponent::UniquePtr newTiffEntry(uint16_t tag, IfdId group); //! Function to create and initialize a new TIFF makernote entry - TiffComponent::AutoPtr newTiffMnEntry(uint16_t tag, IfdId group); + TiffComponent::UniquePtr newTiffMnEntry(uint16_t tag, IfdId group); //! Function to create and initialize a new binary array element - TiffComponent::AutoPtr newTiffBinaryElement(uint16_t tag, IfdId group); + TiffComponent::UniquePtr newTiffBinaryElement(uint16_t tag, IfdId group); //! Function to create and initialize a new TIFF directory template - TiffComponent::AutoPtr newTiffDirectory(uint16_t tag, IfdId /*group*/) + TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) { - return TiffComponent::AutoPtr(new TiffDirectory(tag, newGroup)); + return TiffComponent::UniquePtr(new TiffDirectory(tag, newGroup)); } //! Function to create and initialize a new TIFF sub-directory template - TiffComponent::AutoPtr newTiffSubIfd(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr(new TiffSubIfd(tag, group, newGroup)); + return TiffComponent::UniquePtr(new TiffSubIfd(tag, group, newGroup)); } //! Function to create and initialize a new binary array entry template - TiffComponent::AutoPtr newTiffBinaryArray0(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) { // *& acrobatics is a workaround for a MSVC 7.1 bug - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffBinaryArray(tag, group, arrayCfg, *(&arrayDef), N)); } //! Function to create and initialize a new simple binary array entry template - TiffComponent::AutoPtr newTiffBinaryArray1(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffBinaryArray(tag, group, arrayCfg, 0, 0)); } //! Function to create and initialize a new complex binary array entry template - TiffComponent::AutoPtr newTiffBinaryArray2(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffBinaryArray(tag, group, arraySet, N, cfgSelFct)); } //! Function to create and initialize a new TIFF entry for a thumbnail (data) template - TiffComponent::AutoPtr newTiffThumbData(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffDataEntry(tag, group, szTag, szGroup)); } //! Function to create and initialize a new TIFF entry for a thumbnail (size) template - TiffComponent::AutoPtr newTiffThumbSize(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffSizeEntry(tag, group, dtTag, dtGroup)); } //! Function to create and initialize a new TIFF entry for image data template - TiffComponent::AutoPtr newTiffImageData(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) { - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffImageEntry(tag, group, szTag, szGroup)); } //! Function to create and initialize a new TIFF entry for image data (size) template - TiffComponent::AutoPtr newTiffImageSize(uint16_t tag, IfdId group) + TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) { // Todo: Same as newTiffThumbSize - consolidate (rename)? - return TiffComponent::AutoPtr( + return TiffComponent::UniquePtr( new TiffSizeEntry(tag, group, dtTag, dtGroup)); } diff --git a/src/tifffwd_int.hpp b/src/tifffwd_int.hpp index 616c5a5fc8..ae89d014e1 100644 --- a/src/tifffwd_int.hpp +++ b/src/tifffwd_int.hpp @@ -102,10 +102,10 @@ namespace Exiv2 { ); /*! @brief Type for a function pointer for a function to create a TIFF component. - Use TiffComponent::AutoPtr, it is not used in this declaration only + Use TiffComponent::UniquePtr, it is not used in this declaration only to reduce dependencies. */ - typedef std::auto_ptr (*NewTiffCompFct)(uint16_t tag, IfdId group); + typedef std::unique_ptr (*NewTiffCompFct)(uint16_t tag, IfdId group); //! Stack to hold a path from the TIFF root element to a TIFF entry typedef std::stack TiffPath; diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index c255d0a6cc..eb8892ad76 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -70,8 +70,8 @@ namespace Exiv2 { using namespace Internal; - TiffImage::TiffImage(BasicIo::AutoPtr io, bool /*create*/) - : Image(ImageType::tiff, mdExif | mdIptc | mdXmp, io), + TiffImage::TiffImage(BasicIo::UniquePtr io, bool /*create*/) + : Image(ImageType::tiff, mdExif | mdIptc | mdXmp, std::move(io)), pixelWidth_(0), pixelHeight_(0) { } // TiffImage::TiffImage @@ -292,7 +292,7 @@ namespace Exiv2 { ed.end()); } - std::auto_ptr header(new TiffHeader(byteOrder)); + std::unique_ptr header(new TiffHeader(byteOrder)); return TiffParserWorker::encode(io, pData, size, @@ -307,9 +307,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new TiffImage(io, create)); + Image::UniquePtr image(new TiffImage(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index 7cd6656d16..278c4985fe 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -1492,10 +1492,10 @@ namespace Exiv2 { return key.r_ == root_ && key.g_ == group_; } - TiffComponent::AutoPtr TiffCreator::create(uint32_t extendedTag, + TiffComponent::UniquePtr TiffCreator::create(uint32_t extendedTag, IfdId group) { - TiffComponent::AutoPtr tc(0); + TiffComponent::UniquePtr tc; uint16_t tag = static_cast(extendedTag & 0xffff); const TiffGroupStruct* ts = find(tiffGroupStruct_, TiffGroupStruct::Key(extendedTag, group)); @@ -1546,12 +1546,12 @@ namespace Exiv2 { ) { // Create standard TIFF header if necessary - std::auto_ptr ph; + std::unique_ptr ph; if (!pHeader) { - ph = std::auto_ptr(new TiffHeader); + ph = std::unique_ptr(new TiffHeader); pHeader = ph.get(); } - TiffComponent::AutoPtr rootDir = parse(pData, size, root, pHeader); + TiffComponent::UniquePtr rootDir = parse(pData, size, root, pHeader); if (0 != rootDir.get()) { TiffDecoder decoder(exifData, iptcData, @@ -1587,7 +1587,7 @@ namespace Exiv2 { assert(pHeader); assert(pHeader->byteOrder() != invalidByteOrder); WriteMethod writeMethod = wmIntrusive; - TiffComponent::AutoPtr parsedTree = parse(pData, size, root, pHeader); + TiffComponent::UniquePtr parsedTree = parse(pData, size, root, pHeader); PrimaryGroups primaryGroups; findPrimaryGroups(primaryGroups, parsedTree.get()); if (0 != parsedTree.get()) { @@ -1604,7 +1604,7 @@ namespace Exiv2 { if (!encoder.dirty()) writeMethod = wmNonIntrusive; } if (writeMethod == wmIntrusive) { - TiffComponent::AutoPtr createdTree = TiffCreator::create(root, ifdIdNotSet); + TiffComponent::UniquePtr createdTree = TiffCreator::create(root, ifdIdNotSet); if (0 != parsedTree.get()) { // Copy image tags from the original image to the composite TiffCopier copier(createdTree.get(), root, pHeader, &primaryGroups); @@ -1622,7 +1622,7 @@ namespace Exiv2 { encoder.add(createdTree.get(), parsedTree.get(), root); // Write binary representation from the composite tree DataBuf header = pHeader->write(); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert(tempIo.get() != 0); IoWrapper ioWrapper(*tempIo, header.pData_, header.size_, pOffsetWriter); uint32_t imageIdx(uint32_t(-1)); @@ -1646,18 +1646,19 @@ namespace Exiv2 { return writeMethod; } // TiffParserWorker::encode - TiffComponent::AutoPtr TiffParserWorker::parse( + TiffComponent::UniquePtr TiffParserWorker::parse( const byte* pData, uint32_t size, uint32_t root, TiffHeaderBase* pHeader ) { - if (pData == 0 || size == 0) return TiffComponent::AutoPtr(0); + if (pData == 0 || size == 0) + return nullptr; if (!pHeader->read(pData, size) || pHeader->offset() >= size) { throw Error(kerNotAnImage, "TIFF"); } - TiffComponent::AutoPtr rootDir = TiffCreator::create(root, ifdIdNotSet); + TiffComponent::UniquePtr rootDir = TiffCreator::create(root, ifdIdNotSet); if (0 != rootDir.get()) { rootDir->setStart(pData + pHeader->offset()); TiffRwState state(pHeader->byteOrder(), 0); diff --git a/src/tiffimage_int.hpp b/src/tiffimage_int.hpp index c3fa5eee99..49b1f43125 100644 --- a/src/tiffimage_int.hpp +++ b/src/tiffimage_int.hpp @@ -256,7 +256,7 @@ namespace Exiv2 { component creation function. If the pointer that is returned is 0, then the TIFF entry should be ignored. */ - static std::auto_ptr create(uint32_t extendedTag, + static std::unique_ptr create(uint32_t extendedTag, IfdId group); /*! @brief Get the path, i.e., a list of extended tag and group pairs, from @@ -349,7 +349,7 @@ namespace Exiv2 { composite structure. If \em pData is 0 or \em size is 0, the return value is a 0 pointer. */ - static std::auto_ptr parse( + static std::unique_ptr parse( const byte* pData, uint32_t size, uint32_t root, diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index b633a96aa2..7484790d26 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -212,11 +212,11 @@ namespace Exiv2 { assert(object != 0); if (pHeader_->isImageTag(object->tag(), object->group(), pPrimaryGroups_)) { - TiffComponent::AutoPtr clone = object->clone(); + TiffComponent::UniquePtr clone = object->clone(); // Assumption is that the corresponding TIFF entry doesn't exist TiffPath tiffPath; TiffCreator::getPath(tiffPath, object->tag(), object->group(), root_); - pRoot_->addPath(object->tag(), tiffPath, pRoot_, clone); + pRoot_->addPath(object->tag(), tiffPath, pRoot_, std::move(clone)); #ifdef DEBUG ExifKey key(object->tag(), groupName(object->group())); std::cerr << "Copied " << key << "\n"; @@ -572,7 +572,7 @@ namespace Exiv2 { irbKey.setIdx(pos->idx()); } if (rawIptc.size_ != 0 && (del || pos == exifData_.end())) { - Value::AutoPtr value = Value::create(unsignedLong); + Value::UniquePtr value = Value::create(unsignedLong); DataBuf buf; if (rawIptc.size_ % 4 != 0) { // Pad the last unsignedLong value with 0s @@ -596,7 +596,7 @@ namespace Exiv2 { irbBuf = Photoshop::setIptcIrb(irbBuf.pData_, irbBuf.size_, iptcData_); exifData_.erase(pos); if (irbBuf.size_ != 0) { - Value::AutoPtr value = Value::create(unsignedByte); + Value::UniquePtr value = Value::create(unsignedByte); value->read(irbBuf.pData_, irbBuf.size_, invalidByteOrder); Exifdatum iptcDatum(irbKey, value.get()); exifData_.add(iptcDatum); @@ -626,7 +626,7 @@ namespace Exiv2 { } if (!xmpPacket.empty()) { // Set the XMP Exif tag to the new value - Value::AutoPtr value = Value::create(unsignedByte); + Value::UniquePtr value = Value::create(unsignedByte); value->read(reinterpret_cast(&xmpPacket[0]), static_cast(xmpPacket.size()), invalidByteOrder); @@ -1290,10 +1290,10 @@ namespace Exiv2 { return; } uint16_t tag = getUShort(p, byteOrder()); - TiffComponent::AutoPtr tc = TiffCreator::create(tag, object->group()); + TiffComponent::UniquePtr tc = TiffCreator::create(tag, object->group()); if (tc.get()) { tc->setStart(p); - object->addChild(tc); + object->addChild(std::move(tc)); } else { EXV_WARNING << "Unable to handle tag " << tag << ".\n"; } @@ -1308,7 +1308,7 @@ namespace Exiv2 { #endif return; } - TiffComponent::AutoPtr tc(0); + TiffComponent::UniquePtr tc; uint32_t next = getLong(p, byteOrder()); if (next) { tc = TiffCreator::create(Tag::next, object->group()); @@ -1328,7 +1328,7 @@ namespace Exiv2 { return; } tc->setStart(pData_ + baseOffset() + next); - object->addNext(tc); + object->addNext(std::move(tc)); } } // object->hasNext() @@ -1367,10 +1367,10 @@ namespace Exiv2 { break; } // If there are multiple dirs, group is incremented for each - TiffComponent::AutoPtr td(new TiffDirectory(object->tag(), + TiffComponent::UniquePtr td(new TiffDirectory(object->tag(), static_cast(object->newGroup_ + i))); td->setStart(pData_ + baseOffset() + offset); - object->addChild(td); + object->addChild(std::move(td)); } } #ifndef SUPPRESS_WARNINGS @@ -1549,7 +1549,7 @@ namespace Exiv2 { size = 0; } } - Value::AutoPtr v = Value::create(typeId); + Value::UniquePtr v = Value::create(typeId); enforce(v.get() != NULL, kerCorruptedMetadata); if ( !isize ) { v->read(pData, size, byteOrder()); @@ -1563,7 +1563,7 @@ namespace Exiv2 { ::free(buffer); } - object->setValue(v); + object->setValue(std::move(v)); object->setData(pData, size); object->setOffset(offset); object->setIdx(nextIdx(object->group())); @@ -1658,11 +1658,11 @@ namespace Exiv2 { ByteOrder bo = object->elByteOrder(); if (bo == invalidByteOrder) bo = byteOrder(); TypeId typeId = toTypeId(object->elDef()->tiffType_, object->tag(), object->group()); - Value::AutoPtr v = Value::create(typeId); + Value::UniquePtr v = Value::create(typeId); enforce(v.get() != NULL, kerCorruptedMetadata); v->read(pData, size, bo); - object->setValue(v); + object->setValue(std::move(v)); object->setOffset(0); object->setIdx(nextIdx(object->group())); diff --git a/src/value.cpp b/src/value.cpp index 4df92221aa..0005386f0b 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -97,71 +97,71 @@ namespace Exiv2 { return *this; } - Value::AutoPtr Value::create(TypeId typeId) + Value::UniquePtr Value::create(TypeId typeId) { - AutoPtr value; + UniquePtr value; switch (typeId) { case invalidTypeId: case signedByte: case unsignedByte: - value = AutoPtr(new DataValue(typeId)); + value = UniquePtr(new DataValue(typeId)); break; case asciiString: - value = AutoPtr(new AsciiValue); + value = UniquePtr(new AsciiValue); break; case unsignedShort: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case unsignedLong: case tiffIfd: - value = AutoPtr(new ValueType(typeId)); + value = UniquePtr(new ValueType(typeId)); break; case unsignedRational: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case undefined: - value = AutoPtr(new DataValue); + value = UniquePtr(new DataValue); break; case signedShort: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case signedLong: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case signedRational: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case tiffFloat: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case tiffDouble: - value = AutoPtr(new ValueType); + value = UniquePtr(new ValueType); break; case string: - value = AutoPtr(new StringValue); + value = UniquePtr(new StringValue); break; case date: - value = AutoPtr(new DateValue); + value = UniquePtr(new DateValue); break; case time: - value = AutoPtr(new TimeValue); + value = UniquePtr(new TimeValue); break; case comment: - value = AutoPtr(new CommentValue); + value = UniquePtr(new CommentValue); break; case xmpText: - value = AutoPtr(new XmpTextValue); + value = UniquePtr(new XmpTextValue); break; case xmpBag: case xmpSeq: case xmpAlt: - value = AutoPtr(new XmpArrayValue(typeId)); + value = UniquePtr(new XmpArrayValue(typeId)); break; case langAlt: - value = AutoPtr(new LangAltValue); + value = UniquePtr(new LangAltValue); break; default: - value = AutoPtr(new DataValue(typeId)); + value = UniquePtr(new DataValue(typeId)); break; } return value; @@ -723,9 +723,9 @@ namespace Exiv2 { return 0; } - XmpTextValue::AutoPtr XmpTextValue::clone() const + XmpTextValue::UniquePtr XmpTextValue::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } long XmpTextValue::size() const @@ -793,9 +793,9 @@ namespace Exiv2 { return 0; } - XmpArrayValue::AutoPtr XmpArrayValue::clone() const + XmpArrayValue::UniquePtr XmpArrayValue::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } long XmpArrayValue::count() const @@ -867,9 +867,9 @@ namespace Exiv2 { return 0; } - LangAltValue::AutoPtr LangAltValue::clone() const + LangAltValue::UniquePtr LangAltValue::clone() const { - return AutoPtr(clone_()); + return UniquePtr(clone_()); } long LangAltValue::count() const diff --git a/src/webpimage.cpp b/src/webpimage.cpp index 63ecad836b..a667d6290e 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -62,8 +62,8 @@ namespace Exiv2 { namespace Exiv2 { using namespace Exiv2::Internal; - WebPImage::WebPImage(BasicIo::AutoPtr io) - : Image(ImageType::webp, mdNone, io) + WebPImage::WebPImage(BasicIo::UniquePtr io) + : Image(ImageType::webp, mdNone, std::move(io)) { } // WebPImage::WebPImage @@ -117,7 +117,7 @@ namespace Exiv2 { throw Error(kerDataSourceOpenFailed, io_->path(), strError()); } IoCloser closer(*io_); - BasicIo::AutoPtr tempIo(new MemIo); + BasicIo::UniquePtr tempIo(new MemIo); assert (tempIo.get() != 0); doWriteMetadata(*tempIo); // may throw @@ -456,7 +456,7 @@ namespace Exiv2 { if ( equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_EXIF) && option==kpsRecursive ) { // create memio object with the payload, then print the structure - BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(payload.pData_,payload.size_)); + BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(payload.pData_,payload.size_)); printTiffStructure(*p,out,option,depth); } @@ -694,9 +694,9 @@ namespace Exiv2 { /* =========================================== */ - Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool /*create*/) + Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, bool /*create*/) { - Image::AutoPtr image(new WebPImage(io)); + Image::UniquePtr image(new WebPImage(std::move(io))); if (!image->good()) { image.reset(); } diff --git a/src/xmp.cpp b/src/xmp.cpp index a880da3392..1923c5c18b 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -94,7 +94,7 @@ namespace { const XMP_OptionBits& opt); //! Make an XMP key from a schema namespace and property path - Exiv2::XmpKey::AutoPtr makeXmpKey(const std::string& schemaNs, + Exiv2::XmpKey::UniquePtr makeXmpKey(const std::string& schemaNs, const std::string& propPath); #endif // EXV_HAVE_XMP_TOOLKIT @@ -128,8 +128,8 @@ namespace Exiv2 { Impl& operator=(const Impl& rhs); //!< Assignment // DATA - XmpKey::AutoPtr key_; //!< Key - Value::AutoPtr value_; //!< Value + XmpKey::UniquePtr key_; //!< Key + Value::UniquePtr value_; //!< Value }; Xmpdatum::Impl::Impl(const XmpKey& key, const Value* pValue) @@ -256,9 +256,9 @@ namespace Exiv2 { return p_->value_.get() == 0 ? Rational(-1, 1) : p_->value_->toRational(n); } - Value::AutoPtr Xmpdatum::getValue() const + Value::UniquePtr Xmpdatum::getValue() const { - return p_->value_.get() == 0 ? Value::AutoPtr(0) : p_->value_->clone(); + return p_->value_.get() == 0 ? nullptr : p_->value_->clone(); } const Value& Xmpdatum::value() const @@ -624,10 +624,10 @@ namespace Exiv2 { } continue; } - XmpKey::AutoPtr key = makeXmpKey(schemaNs, propPath); + XmpKey::UniquePtr key = makeXmpKey(schemaNs, propPath); if (XMP_ArrayIsAltText(opt)) { // Read Lang Alt property - LangAltValue::AutoPtr val(new LangAltValue); + LangAltValue::UniquePtr val(new LangAltValue); XMP_Index count = meta.CountArrayItems(schemaNs.c_str(), propPath.c_str()); while (count-- > 0) { // Get the text @@ -674,7 +674,7 @@ namespace Exiv2 { } if (simpleArray) { // Read the array into an XmpArrayValue - XmpArrayValue::AutoPtr val(new XmpArrayValue(arrayValueTypeId(opt))); + XmpArrayValue::UniquePtr val(new XmpArrayValue(arrayValueTypeId(opt))); XMP_Index count = meta.CountArrayItems(schemaNs.c_str(), propPath.c_str()); while (count-- > 0) { iter.Next(&schemaNs, &propPath, &propValue, &opt); @@ -685,7 +685,7 @@ namespace Exiv2 { continue; } } - XmpTextValue::AutoPtr val(new XmpTextValue); + XmpTextValue::UniquePtr val(new XmpTextValue); if ( XMP_PropIsStruct(opt) || XMP_PropIsArray(opt)) { // Create a metadatum with only XMP options @@ -975,7 +975,7 @@ namespace { {} #endif // DEBUG - Exiv2::XmpKey::AutoPtr makeXmpKey(const std::string& schemaNs, + Exiv2::XmpKey::UniquePtr makeXmpKey(const std::string& schemaNs, const std::string& propPath) { std::string property; @@ -989,7 +989,7 @@ namespace { if (prefix.empty()) { throw Exiv2::Error(Exiv2::kerNoPrefixForNamespace, propPath, schemaNs); } - return Exiv2::XmpKey::AutoPtr(new Exiv2::XmpKey(prefix, property)); + return Exiv2::XmpKey::UniquePtr(new Exiv2::XmpKey(prefix, property)); } // makeXmpKey #endif // EXV_HAVE_XMP_TOOLKIT diff --git a/src/xmpsidecar.cpp b/src/xmpsidecar.cpp index 2c95866541..061e9a5bdb 100644 --- a/src/xmpsidecar.cpp +++ b/src/xmpsidecar.cpp @@ -51,8 +51,8 @@ namespace { namespace Exiv2 { - XmpSidecar::XmpSidecar(BasicIo::AutoPtr io, bool create) - : Image(ImageType::xmp, mdXmp, io) + XmpSidecar::XmpSidecar(BasicIo::UniquePtr io, bool create) + : Image(ImageType::xmp, mdXmp, std::move(io)) { if (create) { if (io_->open() == 0) { @@ -154,7 +154,7 @@ namespace Exiv2 { if (xmpPacket_.substr(0, 5) != "write(reinterpret_cast(xmpPacket_.data()), @@ -168,9 +168,9 @@ namespace Exiv2 { // ************************************************************************* // free functions - Image::AutoPtr newXmpInstance(BasicIo::AutoPtr io, bool create) + Image::UniquePtr newXmpInstance(BasicIo::UniquePtr io, bool create) { - Image::AutoPtr image(new XmpSidecar(io, create)); + Image::UniquePtr image(new XmpSidecar(std::move(io), create)); if (!image->good()) { image.reset(); } diff --git a/unitTests/test_XmpKey.cpp b/unitTests/test_XmpKey.cpp index 5c3fc9ede5..bb4b75cdd4 100644 --- a/unitTests/test_XmpKey.cpp +++ b/unitTests/test_XmpKey.cpp @@ -71,7 +71,7 @@ TEST_F(AXmpKey, canBeCopied) TEST_F(AXmpKey, canBeCloned) { XmpKey key(expectedPrefix, expectedProperty); - XmpKey::AutoPtr clonedKey = key.clone(); + XmpKey::UniquePtr clonedKey = key.clone(); checkValidity(*clonedKey); } From a1bd52cbaae797a449fc1918aa59d996ffebd16b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 2 Dec 2018 21:34:26 +0100 Subject: [PATCH 03/31] Remove old VS versions. Do not install ninja --- appveyor.yml | 69 ++++++++++------------------------------------------ 1 file changed, 13 insertions(+), 56 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 82a3d1829f..b120794e72 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,64 +1,21 @@ +image: Visual Studio 2017 environment: matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - CMAKE_GENERATOR: Visual Studio 9 2008 - INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 9 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat - ARCHITECTURE: x86 - UNIT_TESTS: 0 - WARNINGS_AS_ERRORS: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - CMAKE_GENERATOR: Visual Studio 10 2010 - INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 10 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat - ARCHITECTURE: x86 - UNIT_TESTS: 0 - WARNINGS_AS_ERRORS: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - CMAKE_GENERATOR: Visual Studio 11 2012 Win64 - INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 11 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat - ARCHITECTURE: x86_64 - UNIT_TESTS: 1 - WARNINGS_AS_ERRORS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - CMAKE_GENERATOR: Visual Studio 12 2013 Win64 - INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 12 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat - ARCHITECTURE: x86_64 - UNIT_TESTS: 1 - WARNINGS_AS_ERRORS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: Visual Studio 14 2015 Win64 - INTEGRATION_TESTS: 1 - VS_COMPILER_VERSION: 14 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat - ARCHITECTURE: x86_64 - UNIT_TESTS: 1 - WARNINGS_AS_ERRORS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_GENERATOR: Visual Studio 15 2017 Win64 - INTEGRATION_TESTS: 1 + - CMAKE_GENERATOR: Visual Studio 15 2017 Win64 VS_COMPILER_VERSION: 15 VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat ARCHITECTURE: x86_64 - UNIT_TESTS: 1 - WARNINGS_AS_ERRORS: ON shallow_clone: true -install: - - echo %APPVEYOR_BUILD_FOLDER% - - mkdir C:\projects\deps - - cd C:\projects\deps - - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip - - 7z x ninja.zip -oC:\projects\deps\ninja > nul - - set PATH=C:\projects\deps\ninja;%PATH% - - ninja --version +#install: +# - echo %APPVEYOR_BUILD_FOLDER% +# - mkdir C:\projects\deps +# - cd C:\projects\deps +# - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip +# - 7z x ninja.zip -oC:\projects\deps\ninja > nul +# - set PATH=C:\projects\deps\ninja;%PATH% +# - ninja --version before_build: - cmd: cd %APPVEYOR_BUILD_FOLDER% @@ -84,14 +41,14 @@ build_script: - cmd: call "%VCVARS%" x86_amd64 - cmd: conan install .. --build missing - cmd: echo %CMAKE_GENERATOR% - - cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=%WARNINGS_AS_ERRORS% -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=%UNIT_TESTS% -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - cmd: cmake --build . --config Release - cmd: cmake --build . --config Release --target install - cmd: cd bin - - cmd: if %UNIT_TESTS% == 1 unit_tests.exe + - cmd: unit_tests.exe - cmd: cd ../../tests/ - cmd: set EXIV2_EXT=.exe - - cmd: if %INTEGRATION_TESTS% == 1 c:\Python36\python.exe runner.py -v + - cmd: c:\Python36\python.exe runner.py -v cache: - envs # Conan installation From e406ee53401c7604650c8f4ce80173369dcbee95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 2 Dec 2018 21:45:05 +0100 Subject: [PATCH 04/31] Use ninja --- appveyor.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b120794e72..47725783a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,14 +8,14 @@ environment: shallow_clone: true -#install: -# - echo %APPVEYOR_BUILD_FOLDER% -# - mkdir C:\projects\deps -# - cd C:\projects\deps -# - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip -# - 7z x ninja.zip -oC:\projects\deps\ninja > nul -# - set PATH=C:\projects\deps\ninja;%PATH% -# - ninja --version +install: + - echo %APPVEYOR_BUILD_FOLDER% + - mkdir C:\projects\deps + - cd C:\projects\deps + - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip + - 7z x ninja.zip -oC:\projects\deps\ninja > nul + - set PATH=C:\projects\deps\ninja;%PATH% + - ninja --version before_build: - cmd: cd %APPVEYOR_BUILD_FOLDER% @@ -41,9 +41,11 @@ build_script: - cmd: call "%VCVARS%" x86_amd64 - cmd: conan install .. --build missing - cmd: echo %CMAKE_GENERATOR% - - cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - - cmd: cmake --build . --config Release - - cmd: cmake --build . --config Release --target install + - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. + - cmd: ninja + - cmd: ninja install + #- cmd: cmake --build . --config Release + #- cmd: cmake --build . --config Release --target install - cmd: cd bin - cmd: unit_tests.exe - cmd: cd ../../tests/ From 8d4aa12b980e8fdb5004c76d31bad2d4cc64c5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 2 Dec 2018 22:02:27 +0100 Subject: [PATCH 05/31] Different architectures and build types --- appveyor.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 47725783a7..de4a67652c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,22 @@ image: Visual Studio 2017 environment: matrix: - - CMAKE_GENERATOR: Visual Studio 15 2017 Win64 - VS_COMPILER_VERSION: 15 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + VC_ARCH: x86_amd64 ARCHITECTURE: x86_64 + BUILD_TYPE: Release + - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + VC_ARCH: x86 + ARCHITECTURE: x86 + BUILD_TYPE: Release + - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + VC_ARCH: x86_amd64 + ARCHITECTURE: x86_64 + BUILD_TYPE: Debug + - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + VC_ARCH: x86 + ARCHITECTURE: x86 + BUILD_TYPE: Debug shallow_clone: true @@ -30,22 +42,20 @@ before_build: - cmd: conan remote list - cmd: conan config set storage.path=c:\Users\appveyor\conanCache - cmd: conan profile new --detect default - - cmd: conan profile update settings.compiler.version=%VS_COMPILER_VERSION% default + - cmd: conan profile update settings.compiler.version=15 default - cmd: conan profile update settings.arch=%ARCHITECTURE% default - cmd: conan profile update settings.arch_build=%ARCHITECTURE% default + - cmd: conan profile update settings.build_type=%BUILD_TYPE% default - cmd: cat c:\Users\appveyor\.conan\conan.conf build_script: - cmd: md build - cmd: cd build - - cmd: call "%VCVARS%" x86_amd64 + - cmd: call "%VCVARS%" %VC_ARCH% - cmd: conan install .. --build missing - - cmd: echo %CMAKE_GENERATOR% - - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - cmd: ninja - cmd: ninja install - #- cmd: cmake --build . --config Release - #- cmd: cmake --build . --config Release --target install - cmd: cd bin - cmd: unit_tests.exe - cmd: cd ../../tests/ From b91f68f42386fa981c6b0bcd10a05df88bf54fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 2 Dec 2018 22:19:43 +0100 Subject: [PATCH 06/31] Cache ninja installation --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index de4a67652c..eab028bf29 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -64,4 +64,5 @@ build_script: cache: - envs # Conan installation + - deps # Ninja installation - c:\Users\appveyor\conanCache # Conan cache From 703cd3b6ea128a7bc47908fd086c2981e1fad022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 2 Dec 2018 22:41:47 +0100 Subject: [PATCH 07/31] Fix compilation for 32bits --- src/bigtiffimage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bigtiffimage.cpp b/src/bigtiffimage.cpp index 6c32c84a21..70de002f50 100644 --- a/src/bigtiffimage.cpp +++ b/src/bigtiffimage.cpp @@ -2,6 +2,7 @@ #include "bigtiffimage.hpp" #include +#include #include #include "safe_op.hpp" @@ -361,7 +362,7 @@ namespace Exiv2 const size_t restore = io.tell(); io.seek(offset, BasicIo::beg); // position - std::vector bytes((size_t)count) ; // allocate memory + std::vector bytes(static_cast(count)) ; // allocate memory // TODO: once we have C++11 use bytes.data() const long read_bytes = io.read(&bytes[0], static_cast(count)); io.seek(restore, BasicIo::beg); @@ -382,7 +383,7 @@ namespace Exiv2 if ( ::strcmp("Nikon",chars) == 0 ) { // tag is an embedded tiff - std::vector nikon_bytes((size_t)(count - jump)); + std::vector nikon_bytes(static_cast(count - jump)); io.read(&nikon_bytes.at(0), (long)nikon_bytes.size()); MemIo memIo(&nikon_bytes.at(0), (long)count - jump); // create a file From c0ccd9126d7dc621630c456c206b57c21bfc453e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 9 Dec 2018 23:35:30 +0100 Subject: [PATCH 08/31] Factor out VCVARS variable and cache deps directory --- appveyor.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index eab028bf29..265282e63d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,20 +1,19 @@ image: Visual Studio 2017 + environment: + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + matrix: - - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - VC_ARCH: x86_amd64 + - VC_ARCH: x86_amd64 ARCHITECTURE: x86_64 BUILD_TYPE: Release - - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - VC_ARCH: x86 + - VC_ARCH: x86 ARCHITECTURE: x86 BUILD_TYPE: Release - - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - VC_ARCH: x86_amd64 + - VC_ARCH: x86_amd64 ARCHITECTURE: x86_64 BUILD_TYPE: Debug - - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - VC_ARCH: x86 + - VC_ARCH: x86 ARCHITECTURE: x86 BUILD_TYPE: Debug @@ -22,12 +21,11 @@ shallow_clone: true install: - echo %APPVEYOR_BUILD_FOLDER% - - mkdir C:\projects\deps - - cd C:\projects\deps + - mkdir deps + - cd deps - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip - - 7z x ninja.zip -oC:\projects\deps\ninja > nul - - set PATH=C:\projects\deps\ninja;%PATH% - - ninja --version + - 7z x ninja.zip -o%APPVEYOR_BUILD_FOLDER%\deps\ninja > nul + - set PATH=%APPVEYOR_BUILD_FOLDER%\deps\ninja;%PATH% before_build: - cmd: cd %APPVEYOR_BUILD_FOLDER% From a0f0956871c8e55d93b6a3c8aa1132c890497c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 9 Dec 2018 23:57:59 +0100 Subject: [PATCH 09/31] Appveyor: use configuration variable to simplify build matrix --- appveyor.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 265282e63d..25c7796255 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,21 +1,17 @@ image: Visual Studio 2017 +configuration: + - Debug + - Release + environment: VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat matrix: - VC_ARCH: x86_amd64 ARCHITECTURE: x86_64 - BUILD_TYPE: Release - - VC_ARCH: x86 - ARCHITECTURE: x86 - BUILD_TYPE: Release - - VC_ARCH: x86_amd64 - ARCHITECTURE: x86_64 - BUILD_TYPE: Debug - VC_ARCH: x86 ARCHITECTURE: x86 - BUILD_TYPE: Debug shallow_clone: true @@ -43,7 +39,7 @@ before_build: - cmd: conan profile update settings.compiler.version=15 default - cmd: conan profile update settings.arch=%ARCHITECTURE% default - cmd: conan profile update settings.arch_build=%ARCHITECTURE% default - - cmd: conan profile update settings.build_type=%BUILD_TYPE% default + - cmd: conan profile update settings.build_type=%CONFIGURATION% default - cmd: cat c:\Users\appveyor\.conan\conan.conf build_script: @@ -51,7 +47,7 @@ build_script: - cmd: cd build - cmd: call "%VCVARS%" %VC_ARCH% - cmd: conan install .. --build missing - - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - cmd: ninja - cmd: ninja install - cmd: cd bin From 755129665bc9189a7a5fd6e02c2b539244438be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 10 Dec 2018 00:11:57 +0100 Subject: [PATCH 10/31] Appveyor: avoid to install stuff if already present --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 25c7796255..f6e671b292 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,19 +17,19 @@ shallow_clone: true install: - echo %APPVEYOR_BUILD_FOLDER% - - mkdir deps + - if not exist deps mkdir deps - cd deps - - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip - - 7z x ninja.zip -o%APPVEYOR_BUILD_FOLDER%\deps\ninja > nul + - if not exist ninja appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -FileName ninja.zip + - if not exist ninja 7z x ninja.zip -o%APPVEYOR_BUILD_FOLDER%\deps\ninja > nul - set PATH=%APPVEYOR_BUILD_FOLDER%\deps\ninja;%PATH% before_build: - cmd: cd %APPVEYOR_BUILD_FOLDER% - cmd: if not exist envs mkdir envs - cmd: cd envs - - cmd: python -m virtualenv conan + - cmd: if not exist conan python -m virtualenv conan - cmd: conan/Scripts/activate - - cmd: python -m pip install conan==1.9.0 + - cmd: if not exist conan/Scripts/conan.exe python -m pip install conan==1.9.0 - cmd: cd .. - cmd: conan --version - cmd: conan remote add conan-bincrafters https://api.bintray.com/conan/bincrafters/public-conan From f4609cacbc367832bbd9c881eaba05905ffe3b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 10 Dec 2018 08:11:04 +0100 Subject: [PATCH 11/31] Appveyor: Trying to simplify the platform settings --- appveyor.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f6e671b292..3e46285a4e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,15 +4,13 @@ configuration: - Debug - Release +platform: + - x86 + - x64 + environment: VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - matrix: - - VC_ARCH: x86_amd64 - ARCHITECTURE: x86_64 - - VC_ARCH: x86 - ARCHITECTURE: x86 - shallow_clone: true install: @@ -37,6 +35,7 @@ before_build: - cmd: conan config set storage.path=c:\Users\appveyor\conanCache - cmd: conan profile new --detect default - cmd: conan profile update settings.compiler.version=15 default + - cmd: if "%platform%"=="x64" (set ARCHITECTURE=x86_64) else (set ARCHITECTURE=x86) - cmd: conan profile update settings.arch=%ARCHITECTURE% default - cmd: conan profile update settings.arch_build=%ARCHITECTURE% default - cmd: conan profile update settings.build_type=%CONFIGURATION% default @@ -45,6 +44,7 @@ before_build: build_script: - cmd: md build - cmd: cd build + - cmd: if "%platform%"=="x64" (set VC_ARCH=x86_amd64) else (set VC_ARCH=x86) - cmd: call "%VCVARS%" %VC_ARCH% - cmd: conan install .. --build missing - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. From 13f2c0aff1ac6aca34ce4eb58b826eeaacd7bef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 10 Dec 2018 22:48:57 +0100 Subject: [PATCH 12/31] Appveyor: SHARED and STATIC --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3e46285a4e..d25905f94f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,10 @@ platform: environment: VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + matrix: + - SHARED=ON + - SHARED=OFF + shallow_clone: true install: @@ -47,7 +51,7 @@ build_script: - cmd: if "%platform%"=="x64" (set VC_ARCH=x86_amd64) else (set VC_ARCH=x86) - cmd: call "%VCVARS%" %VC_ARCH% - cmd: conan install .. --build missing - - cmd: cmake -GNinja -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -GNinja -DBUILD_SHARED_LIBS=%SHARED% -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - cmd: ninja - cmd: ninja install - cmd: cd bin From 952d80647838ab341646854ecf06cbfe247e1fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 10 Dec 2018 23:09:39 +0100 Subject: [PATCH 13/31] travis: Many updated. See message details - give names to jobs. - Use git settings. - Update Ubuntu version to xenial. - New travis jobs. - Simplify conan configuration. - create default conan profile. - gtest shared & libstdc++11 always - New OSX job. - Simplify Travis configuration. - simplify cmake options - Release and Debug builds --- .travis.yml | 80 ++++++++++++++++++++++++++++++++++++++++++++------- ci/install.sh | 12 ++------ ci/run.sh | 32 ++++++++++++--------- 3 files changed, 91 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 265e40d2c8..d0ba34d1c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,89 @@ language: cpp +git: + quiet: true + depth: 1 + +env: + global: + - COMMON_CMAKE_OPTIONS="-DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install" + matrix: include: - - os: linux - dist: trusty + - name: "Ubuntu 16.04 - gcc-5.4 (Release)" + os: linux + dist: xenial + sudo: required + compiler: gcc + env: + - BUILD_TYPE="Release" + + - name: "Ubuntu 16.04 - gcc-5.4 (Debug)" + os: linux + dist: xenial sudo: required compiler: gcc - env: COVERAGE=1 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DBUILD_WITH_COVERAGE=ON" + env: + - BUILD_TYPE="Debug" + + - name: "Ubuntu 16.04 - gcc-5.4 with coverage" + os: linux + dist: xenial + sudo: required + compiler: gcc + env: + - WITH_COVERAGE=1 + - BUILD_TYPE="Release" - - os: linux - dist: trusty + - name: "Ubuntu 16.04 - gcc-5.4 with Valgrind" + os: linux + dist: xenial sudo: required compiler: gcc env: - WITH_VALGRIND=1 - - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON" + - BUILD_TYPE="Release" + + - name: "Ubuntu 16.04 - gcc-5.4 with sanitizers" + os: linux + dist: xenial + sudo: required + compiler: gcc + env: + - WITH_SANITIZERS=1 + - BUILD_TYPE="Release" + + - name: "Ubuntu 16.04 - CLANG 7.0 (Release)" + os: linux + dist: xenial + sudo: required + compiler: clang + env: + - BUILD_TYPE="Release" - - os: linux - dist: trusty + - name: "Ubuntu 16.04 - CLANG 7.0 (Debug)" + os: linux + dist: xenial sudo: required compiler: clang - env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON" + env: + - BUILD_TYPE="Debug" - - os: osx + - name: "OS X 10.12 - XCode 9.0" + os: osx osx_image: xcode9 compiler: clang - env: PYTHON=3.6.2 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_NLS=OFF" + env: + - PYTHON=3.6.2 + - BUILD_TYPE="Release" + + - name: "OS X 10.13 - XCode 10.1" + os: osx + osx_image: xcode10.1 + compiler: clang + env: + - PYTHON=3.6.2 + - BUILD_TYPE="Release" install: ./ci/install.sh script: ./ci/run.sh diff --git a/ci/install.sh b/ci/install.sh index bbe878d4a8..5e59667dcb 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -4,7 +4,7 @@ set -x # Prints every command if [[ "$(uname -s)" == 'Linux' ]]; then sudo apt-get update - sudo apt-get install cmake zlib1g-dev libssh-dev python-pip libxml2-utils + sudo apt-get install libssh-dev python-pip libxml2-utils if [ -n "$WITH_VALGRIND" ]; then sudo apt-get install valgrind fi @@ -34,14 +34,8 @@ pip install conan==1.9.0 pip install codecov conan --version conan config set storage.path=~/conanData -conan remote add conan-bincrafters https://api.bintray.com/conan/bincrafters/public-conan - -mkdir -p ~/.conan/profiles +conan profile new default --detect if [[ "$(uname -s)" == 'Linux' ]]; then - CC_VER=$(${CC} --version | head -1 | awk '{print $3}'| awk -F'.' '{ print $1"."$2 }') - printf "[settings]\nos=Linux\narch=x86_64\ncompiler=$CC\ncompiler.version=$CC_VER\ncompiler.libcxx=libstdc++\nbuild_type=Release\n" > ~/.conan/profiles/release -else - printf "[settings]\nos=Macos\narch=x86_64\ncompiler=apple-clang\ncompiler.version=9.0\ncompiler.libcxx=libc++\nbuild_type=Release\n" > ~/.conan/profiles/release + conan profile update settings.compiler.libcxx=libstdc++11 default fi - diff --git a/ci/run.sh b/ci/run.sh index e7cb3b361e..552fef5a29 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -3,19 +3,25 @@ set -e set -x +export CMAKE_OPTIONS="$COMMON_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=$BUILD_TYPE" + +if [ -n "$WITH_COVERAGE" ]; then + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DBUILD_WITH_COVERAGE=ON" +fi + +if [ -n "$WITH_SANITIZERS" ]; then + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" +fi + +if [ -n "$WITH_VALGRIND" ]; then + export EXIV2_VALGRIND="valgrind --quiet" +fi + + if [[ "$(uname -s)" == 'Linux' ]]; then source conan/bin/activate - - if [ "$CC" == "clang" ]; then - # clang + Ubuntu don't like to run with UBSAN, but ASAN works - export CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_CXX_FLAGS=\"-fsanitize=address\" -DCMAKE_C_FLAGS=\"-fsanitize=address\" -DCMAKE_EXE_LINKER_FLAGS=\"-fsanitize=address\" -DCMAKE_MODULE_LINKER_FLAGS=\"-fsanitize=address\"" - elif [ -n "$WITH_VALGRIND" ]; then - export EXIV2_VALGRIND="valgrind --quiet" - else - export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" - fi else - export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" + export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_ENABLE_NLS=OFF" export PYENV_VERSION=$PYTHON export PATH="/Users/travis/.pyenv/shims:${PATH}" eval "$(pyenv init -)" @@ -25,9 +31,9 @@ fi mkdir build && cd build -conan install .. --build missing --profile release +conan install .. --build missing -cmake ${CMAKE_OPTIONS} -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install .. +cmake ${CMAKE_OPTIONS} .. make -j2 make tests @@ -46,7 +52,7 @@ cd bin $EXIV2_VALGRIND ./unit_tests popd -if [ -n "$COVERAGE" ]; then +if [ -n "$WITH_COVERAGE" ]; then bash <(curl -s https://codecov.io/bash) fi From 928bd26da1cd140198794f1a5f2959bf4a5e4453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 10 Dec 2018 23:39:34 +0100 Subject: [PATCH 14/31] conan: update to gtest 1.8.1 --- conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index d811961c20..9afc65aabd 100644 --- a/conanfile.py +++ b/conanfile.py @@ -18,7 +18,7 @@ class Exiv2Conan(ConanFile): def configure(self): self.options['libcurl'].shared = False self.options['libcurl'].with_openssl = True - self.options['gtest'].shared = True + self.options['gtest'].shared = False def requirements(self): self.requires('zlib/1.2.11@conan/stable') @@ -27,7 +27,7 @@ def requirements(self): self.requires('libiconv/1.15@bincrafters/stable') if self.options.unitTests: - self.requires('gtest/1.8.0@bincrafters/stable') + self.requires('gtest/1.8.1@bincrafters/stable') if self.options.webready: self.requires('libcurl/7.60.0@bincrafters/stable') From cd8dad0f8ef7724098079223296b829f8a4c10ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 17 Dec 2018 10:50:00 +0100 Subject: [PATCH 15/31] GTest: Simplify CMake code after updating minimum cmake version --- CMakeLists.txt | 2 +- unitTests/CMakeLists.txt | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 612f42eb36..8dfd9d971b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.3.2 ) +cmake_minimum_required( VERSION 3.5.0 ) project(exiv2 VERSION 0.27.0.3 diff --git a/unitTests/CMakeLists.txt b/unitTests/CMakeLists.txt index 6dbee1609a..e9aeb05339 100644 --- a/unitTests/CMakeLists.txt +++ b/unitTests/CMakeLists.txt @@ -21,7 +21,8 @@ add_executable(unit_tests mainTestRunner.cpp target_link_libraries(unit_tests PRIVATE exiv2lib - ${GTEST_BOTH_LIBRARIES} + GTest::GTest + GTest::Main ) # ZLIB is used in exiv2lib_int. @@ -31,15 +32,9 @@ endif() target_include_directories(unit_tests PRIVATE - ${GTEST_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src ) -target_compile_definitions(unit_tests - PRIVATE - GTEST_LINKED_AS_SHARED_LIBRARY=1 -) - set_target_properties(unit_tests PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS} ) @@ -50,4 +45,4 @@ endif() if (MSVC) set_target_properties(unit_tests PROPERTIES LINK_FLAGS "/ignore:4099") -endif() \ No newline at end of file +endif() From d1c609b320eadbe7089b0482353ffef576813ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 08:05:16 +0100 Subject: [PATCH 16/31] cmake: man pages only installed with the exiv2 app --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfd9d971b..e98cfac136 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,3 @@ configure_file(cmake/exiv2.pc.in exiv2.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) include(cmake/printSummary.cmake) - -# That's all Folks! -## diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca24006eae..0d09392400 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -273,11 +273,6 @@ if(EXIV2_BUILD_EXIV2_COMMAND) endif() install(TARGETS exiv2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) endif() -# ****************************************************************************** -# Man page -install( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) - -# That's all Folks! -## From f733c64ac12c4b7fef8ad945a50156c6388629e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 08:07:41 +0100 Subject: [PATCH 17/31] appveyor: comment SHARED configuration --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d25905f94f..285d29d15d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,9 +11,9 @@ platform: environment: VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - matrix: - - SHARED=ON - - SHARED=OFF +# matrix: +# - SHARED=ON +# - SHARED=OFF shallow_clone: true From 6229544efdc030ba8917c859f80b48a895f415f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 08:12:48 +0100 Subject: [PATCH 18/31] Cmake: use fake version number in master --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e98cfac136..183cdd2e80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.5.0 ) project(exiv2 - VERSION 0.27.0.3 + VERSION 0.27.99.0 # Fake version number to indicate that the next version will be 28.0 LANGUAGES CXX C ) From f1e46d4a30b3c679bc5964274d8fa3b4074ba3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 08:59:49 +0100 Subject: [PATCH 19/31] appveyor: set compiler.runtime depending on CONFIGURATION --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 285d29d15d..3944d483ad 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,9 +40,11 @@ before_build: - cmd: conan profile new --detect default - cmd: conan profile update settings.compiler.version=15 default - cmd: if "%platform%"=="x64" (set ARCHITECTURE=x86_64) else (set ARCHITECTURE=x86) + - cmd: if "%CONFIGURATION%"=="Debug" (set RUNTIME=MDd) else (set RUNTIME=MD) - cmd: conan profile update settings.arch=%ARCHITECTURE% default - cmd: conan profile update settings.arch_build=%ARCHITECTURE% default - cmd: conan profile update settings.build_type=%CONFIGURATION% default + - cmd: conan profile update settings.compiler.runtime=%RUNTIME% default - cmd: cat c:\Users\appveyor\.conan\conan.conf build_script: From a3bf12016d0f7c0879074f4344666e67d47e6a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:08:11 +0100 Subject: [PATCH 20/31] appveyor: BUILD_SHARED_LIBS=ON and print profile --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3944d483ad..1169cc3885 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,6 +46,7 @@ before_build: - cmd: conan profile update settings.build_type=%CONFIGURATION% default - cmd: conan profile update settings.compiler.runtime=%RUNTIME% default - cmd: cat c:\Users\appveyor\.conan\conan.conf + - cmd: cat c:\Users\appveyor\.conan\profiles\default build_script: - cmd: md build @@ -53,7 +54,7 @@ build_script: - cmd: if "%platform%"=="x64" (set VC_ARCH=x86_amd64) else (set VC_ARCH=x86) - cmd: call "%VCVARS%" %VC_ARCH% - cmd: conan install .. --build missing - - cmd: cmake -GNinja -DBUILD_SHARED_LIBS=%SHARED% -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -GNinja -DBUILD_SHARED_LIBS=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - cmd: ninja - cmd: ninja install - cmd: cd bin From 15551f9c60d708a556615a9ad21078ef1f2cfc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:17:58 +0100 Subject: [PATCH 21/31] appveyor: SHARED/STATIC --- appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 1169cc3885..649fb1414e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,9 +11,9 @@ platform: environment: VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat -# matrix: -# - SHARED=ON -# - SHARED=OFF + matrix: + - SHARED: ON + - SHARED: OFF shallow_clone: true @@ -54,7 +54,7 @@ build_script: - cmd: if "%platform%"=="x64" (set VC_ARCH=x86_amd64) else (set VC_ARCH=x86) - cmd: call "%VCVARS%" %VC_ARCH% - cmd: conan install .. --build missing - - cmd: cmake -GNinja -DBUILD_SHARED_LIBS=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -GNinja -DBUILD_SHARED_LIBS=%SHARED% -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_BUILD_UNIT_TESTS=ON -DCMAKE_INSTALL_PREFIX=install .. - cmd: ninja - cmd: ninja install - cmd: cd bin From 1583dc2cc78c806dfec302f0a5000d9f24e5b419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:22:13 +0100 Subject: [PATCH 22/31] Remove unused EXV_HAVE_PROCESS_H --- cmake/config.h.cmake | 3 --- cmake/generateConfigFile.cmake | 1 - src/basicio.cpp | 4 +--- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 10352d059e..277e55090a 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -74,9 +74,6 @@ // Define if you have are using the zlib library. #cmakedefine EXV_HAVE_LIBZ -// Define if you have the header file. -#cmakedefine EXV_HAVE_PROCESS_H - /* Define if you have (Exiv2/xmpsdk) Adobe XMP Toolkit. */ #cmakedefine EXV_HAVE_XMP_TOOLKIT diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index d9dff3187a..a5b07b5c7c 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -30,7 +30,6 @@ check_function_exists( strerror_r EXV_HAVE_STRERROR_R ) check_include_file( "unistd.h" EXV_HAVE_UNISTD_H ) check_include_file( "memory.h" EXV_HAVE_MEMORY_H ) -check_include_file( "process.h" EXV_HAVE_PROCESS_H ) check_include_file( "stdbool.h" EXV_HAVE_STDBOOL_H ) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) diff --git a/src/basicio.cpp b/src/basicio.cpp index b58e7ffd85..7bb38f1c08 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -45,9 +45,7 @@ #ifdef EXV_HAVE_SYS_MMAN_H # include // for mmap and munmap #endif -#ifdef EXV_HAVE_PROCESS_H -# include -#endif + #ifdef EXV_HAVE_UNISTD_H # include // for getpid, stat #endif From 0325f0be08dd2fe9cae3988405e185918927d521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:24:11 +0100 Subject: [PATCH 23/31] Remove unused EXV_HAVE_MEMORY_H --- cmake/config.h.cmake | 3 --- cmake/generateConfigFile.cmake | 1 - src/version.cpp | 6 ------ 3 files changed, 10 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 277e55090a..65363a9d0e 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -41,9 +41,6 @@ // Define if you have the header file. #cmakedefine EXV_HAVE_REGEX_H -// Define if have the header file. -#cmakedefine EXV_HAVE_MEMORY_H - // Define if stdbool.h conforms to C99. #cmakedefine EXV_HAVE_STDBOOL_H diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index a5b07b5c7c..f3a7898e28 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -29,7 +29,6 @@ check_function_exists( munmap EXV_HAVE_MUNMAP ) check_function_exists( strerror_r EXV_HAVE_STRERROR_R ) check_include_file( "unistd.h" EXV_HAVE_UNISTD_H ) -check_include_file( "memory.h" EXV_HAVE_MEMORY_H ) check_include_file( "stdbool.h" EXV_HAVE_STDBOOL_H ) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) diff --git a/src/version.cpp b/src/version.cpp index effddcd774..512e9bd573 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -257,7 +257,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int have_libintl =0; int have_lensdata =0; int have_iconv =0; - int have_memory =0; int have_lstat =0; int have_stdbool =0; int have_stdint =0; @@ -310,10 +309,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_libintl=1; #endif -#ifdef EXV_HAVE_MEMORY_H - have_memory=1; -#endif - #ifdef EXV_HAVE_LSTAT have_lstat=1; #endif @@ -502,7 +497,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_libintl" ,have_libintl ); output(os,keys,"have_lensdata" ,have_lensdata ); output(os,keys,"have_iconv" ,have_iconv ); - output(os,keys,"have_memory" ,have_memory ); output(os,keys,"have_lstat" ,have_lstat ); output(os,keys,"have_stdbool" ,have_stdbool ); output(os,keys,"have_stdint" ,have_stdint ); From 3bed82631d0b66aba1f97ad9721498a7b048fceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:25:41 +0100 Subject: [PATCH 24/31] Remove unused EXV_HAVE_SYS_STAT_H --- cmake/config.h.cmake | 3 --- cmake/generateConfigFile.cmake | 1 - src/version.cpp | 6 ------ 3 files changed, 10 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 65363a9d0e..c881e636d6 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -56,9 +56,6 @@ // Define if you have the munmap function. #cmakedefine EXV_HAVE_MUNMAP -// Define if you have header file. -#cmakedefine EXV_HAVE_SYS_STAT_H - // Define if you have the header file. #cmakedefine EXV_HAVE_SYS_TYPES_H diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index f3a7898e28..a62e87f553 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -33,7 +33,6 @@ check_include_file( "stdbool.h" EXV_HAVE_STDBOOL_H ) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) -check_include_file( "sys/stat.h" EXV_HAVE_SYS_STAT_H ) check_include_file( "sys/types.h" EXV_HAVE_SYS_TYPES_H ) check_include_file( "inttypes.h" EXV_HAVE_INTTYPES_H ) if ( NOT MINGW AND NOT MSYS AND NOT MSVC ) diff --git a/src/version.cpp b/src/version.cpp index 512e9bd573..609b1dd35e 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -266,7 +266,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int have_strings_h =0; int have_mmap =0; int have_munmap =0; - int have_sys_stat =0; int have_unistd_h =0; int have_sys_mman =0; int have_libz =0; @@ -341,10 +340,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_munmap=1; #endif -#ifdef EXV_HAVE_SYS_STAT_H - have_sys_stat=1; -#endif - #ifdef EXV_HAVE_SYS_TYPES_H have_sys_types=1; #endif @@ -506,7 +501,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_strings_h" ,have_strings_h ); output(os,keys,"have_mmap" ,have_mmap ); output(os,keys,"have_munmap" ,have_munmap ); - output(os,keys,"have_sys_stat" ,have_sys_stat ); output(os,keys,"have_unistd_h" ,have_unistd_h ); output(os,keys,"have_sys_mman" ,have_sys_mman ); output(os,keys,"have_libz" ,have_libz ); From fcb741ffef0e77b947d88cd83b59752679278590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:27:18 +0100 Subject: [PATCH 25/31] Remove unused EXV_HAVE_SYS_TYPES_H --- cmake/config.h.cmake | 3 --- cmake/generateConfigFile.cmake | 1 - src/version.cpp | 10 ---------- 3 files changed, 14 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index c881e636d6..62ab09aade 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -56,9 +56,6 @@ // Define if you have the munmap function. #cmakedefine EXV_HAVE_MUNMAP -// Define if you have the header file. -#cmakedefine EXV_HAVE_SYS_TYPES_H - /* Define if you have the header file. */ #cmakedefine EXV_HAVE_UNISTD_H diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index a62e87f553..bd1fa24917 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -33,7 +33,6 @@ check_include_file( "stdbool.h" EXV_HAVE_STDBOOL_H ) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) -check_include_file( "sys/types.h" EXV_HAVE_SYS_TYPES_H ) check_include_file( "inttypes.h" EXV_HAVE_INTTYPES_H ) if ( NOT MINGW AND NOT MSYS AND NOT MSVC ) check_include_file( "regex.h" EXV_HAVE_REGEX_H ) diff --git a/src/version.cpp b/src/version.cpp index 609b1dd35e..e2c90f6902 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -273,7 +273,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int adobe_xmpsdk =0; int have_bool =0; int have_strings =0; - int have_sys_types =0; int have_unistd =0; int have_unicode_path=0; int have_regex =0; @@ -340,10 +339,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_munmap=1; #endif -#ifdef EXV_HAVE_SYS_TYPES_H - have_sys_types=1; -#endif - #ifdef EXV_HAVE_UNISTD_H have_unistd=1; #endif @@ -372,10 +367,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_strings=1; #endif -#ifdef EXV_SYS_TYPES - have_sys_types=1; -#endif - #ifdef EXV_HAVE_UNISTD have_unistd=1; #endif @@ -508,7 +499,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"adobe_xmpsdk" ,adobe_xmpsdk ); output(os,keys,"have_bool" ,have_bool ); output(os,keys,"have_strings" ,have_strings ); - output(os,keys,"have_sys_types" ,have_sys_types ); output(os,keys,"have_unistd" ,have_unistd ); output(os,keys,"have_unicode_path" ,have_unicode_path); output(os,keys,"enable_video" ,enable_video ); From b37217075b5832ededd5304d67db8a8d618d564a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:28:27 +0100 Subject: [PATCH 26/31] Remove unused EXV_HAVE_INTTYPES_H --- cmake/generateConfigFile.cmake | 1 - src/version.cpp | 6 ------ 2 files changed, 7 deletions(-) diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index bd1fa24917..8f653b848e 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -33,7 +33,6 @@ check_include_file( "stdbool.h" EXV_HAVE_STDBOOL_H ) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) -check_include_file( "inttypes.h" EXV_HAVE_INTTYPES_H ) if ( NOT MINGW AND NOT MSYS AND NOT MSVC ) check_include_file( "regex.h" EXV_HAVE_REGEX_H ) endif() diff --git a/src/version.cpp b/src/version.cpp index e2c90f6902..07b0b3c4a3 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -253,7 +253,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) #endif int have_gmtime_r =0; - int have_inttypes =0; int have_libintl =0; int have_lensdata =0; int have_iconv =0; @@ -287,10 +286,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_gmtime_r=1; #endif -#ifdef EXV_HAVE_INTTYPES_H - have_inttypes=1; -#endif - #ifdef EXV_HAVE_LIBINTL_H have_libintl=1; #endif @@ -479,7 +474,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_strerror_r" ,have_strerror_r ); output(os,keys,"have_gmtime_r" ,have_gmtime_r ); - output(os,keys,"have_inttypes" ,have_inttypes ); output(os,keys,"have_libintl" ,have_libintl ); output(os,keys,"have_lensdata" ,have_lensdata ); output(os,keys,"have_iconv" ,have_iconv ); From 77d821621fb2f7f4e29b801855b1c393dd7bb7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:34:32 +0100 Subject: [PATCH 27/31] Remove unused EXV_HAVE_STDINT_H and EXV_HAVE_STDBOOL_H --- cmake/config.h.cmake | 6 ------ cmake/generateConfigFile.cmake | 2 -- include/exiv2/types.hpp | 22 +--------------------- src/version.cpp | 12 ------------ 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 62ab09aade..359808538f 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -41,12 +41,6 @@ // Define if you have the header file. #cmakedefine EXV_HAVE_REGEX_H -// Define if stdbool.h conforms to C99. -#cmakedefine EXV_HAVE_STDBOOL_H - -// Define if you have the header file. -#cmakedefine EXV_HAVE_STDINT_H - // Define if you have the header file. #cmakedefine EXV_HAVE_STRINGS_H diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index 8f653b848e..25adc3e295 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -29,8 +29,6 @@ check_function_exists( munmap EXV_HAVE_MUNMAP ) check_function_exists( strerror_r EXV_HAVE_STRERROR_R ) check_include_file( "unistd.h" EXV_HAVE_UNISTD_H ) -check_include_file( "stdbool.h" EXV_HAVE_STDBOOL_H ) -check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) if ( NOT MINGW AND NOT MSYS AND NOT MSVC ) diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 43d964224f..88888b6abf 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -43,27 +43,7 @@ #include #include #include - -#ifdef _MSC_VER -// Visual Studio 2010 and later has stdint.h -# if _MSC_VER >= _MSC_VER_2010 -# include -# else -// Earlier compilers have MS C99 equivalents such as __int8 - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; -# endif -#else - #ifdef EXV_HAVE_STDINT_H - # include - #endif -#endif +#include /// \todo change to cstdint // MSVC macro to convert a string to a wide string diff --git a/src/version.cpp b/src/version.cpp index 07b0b3c4a3..ef170f256f 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -257,8 +257,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int have_lensdata =0; int have_iconv =0; int have_lstat =0; - int have_stdbool =0; - int have_stdint =0; int have_stdlib =0; int have_strlib =0; int have_strerror_r =0; @@ -306,14 +304,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_lstat=1; #endif -#ifdef EXV_HAVE_STDBOOL_H - have_stdbool=1; -#endif - -#ifdef EXV_HAVE_STDINT_H - have_stdint=1; -#endif - #ifdef EXV_HAVE_STDLIB_H have_stdlib=1; #endif @@ -478,8 +468,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_lensdata" ,have_lensdata ); output(os,keys,"have_iconv" ,have_iconv ); output(os,keys,"have_lstat" ,have_lstat ); - output(os,keys,"have_stdbool" ,have_stdbool ); - output(os,keys,"have_stdint" ,have_stdint ); output(os,keys,"have_stdlib" ,have_stdlib ); output(os,keys,"have_strlib" ,have_strlib ); output(os,keys,"have_strerror_r" ,have_strerror_r ); From 72ebb3eafbf47dd586bf6078ee724f6bac6dfacf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 09:36:57 +0100 Subject: [PATCH 28/31] Remove unused EXV_HAVE_STRINGS_H --- cmake/config.h.cmake | 3 --- cmake/generateConfigFile.cmake | 1 - src/version.cpp | 10 ---------- 3 files changed, 14 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 359808538f..9bd83f3c6b 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -41,9 +41,6 @@ // Define if you have the header file. #cmakedefine EXV_HAVE_REGEX_H -// Define if you have the header file. -#cmakedefine EXV_HAVE_STRINGS_H - // Define if you have the mmap function. #cmakedefine EXV_HAVE_MMAP diff --git a/cmake/generateConfigFile.cmake b/cmake/generateConfigFile.cmake index 25adc3e295..5f7ea50bda 100644 --- a/cmake/generateConfigFile.cmake +++ b/cmake/generateConfigFile.cmake @@ -29,7 +29,6 @@ check_function_exists( munmap EXV_HAVE_MUNMAP ) check_function_exists( strerror_r EXV_HAVE_STRERROR_R ) check_include_file( "unistd.h" EXV_HAVE_UNISTD_H ) -check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) if ( NOT MINGW AND NOT MSYS AND NOT MSVC ) check_include_file( "regex.h" EXV_HAVE_REGEX_H ) diff --git a/src/version.cpp b/src/version.cpp index ef170f256f..e70b8adea4 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -269,7 +269,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int have_xmptoolkit =0; int adobe_xmpsdk =0; int have_bool =0; - int have_strings =0; int have_unistd =0; int have_unicode_path=0; int have_regex =0; @@ -312,10 +311,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_strerror_r=1; #endif -#ifdef EXV_HAVE_STRINGS_H - have_strings=1; -#endif - #ifdef EXV_HAVE_MMAP have_mmap=1; #endif @@ -348,10 +343,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) have_bool=1; #endif -#ifdef EXV_HAVE_STRINGS - have_strings=1; -#endif - #ifdef EXV_HAVE_UNISTD have_unistd=1; #endif @@ -480,7 +471,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_xmptoolkit" ,have_xmptoolkit ); output(os,keys,"adobe_xmpsdk" ,adobe_xmpsdk ); output(os,keys,"have_bool" ,have_bool ); - output(os,keys,"have_strings" ,have_strings ); output(os,keys,"have_unistd" ,have_unistd ); output(os,keys,"have_unicode_path" ,have_unicode_path); output(os,keys,"enable_video" ,enable_video ); From e57f311e629762fbf2b08d9a5b1e0cad1035b42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 10:33:11 +0100 Subject: [PATCH 29/31] cmake: ignore warnings about missing PDB files in 3rd party libs --- samples/CMakeLists.txt | 11 +++++++++++ src/CMakeLists.txt | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index a3e491e033..4e8c14c6d9 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -43,6 +43,9 @@ foreach(entry ${SAMPLES}) add_test( ${target}_test ${target} ) target_include_directories(${target} PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find unused.h install( TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + if (MSVC) + set_target_properties(${target} PROPERTIES LINK_FLAGS "/ignore:4099") + endif() endforeach() ################################### @@ -69,6 +72,11 @@ list(APPEND APPLICATIONS exiv2json) install( TARGETS metacopy pathtest exiv2json RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +if (MSVC) + set_target_properties(exiv2json PROPERTIES LINK_FLAGS "/ignore:4099") + set_target_properties(metacopy PROPERTIES LINK_FLAGS "/ignore:4099") +endif() + if( EXPAT_FOUND ) add_executable( geotag geotag.cpp) list(APPEND APPLICATIONS geotag) @@ -103,6 +111,9 @@ foreach(application ${APPLICATIONS}) if( EXIV2_ENABLE_PNG ) target_link_libraries( ${application} PRIVATE ${ZLIB_LIBRARIES} ) endif() + if (MSVC) + set_target_properties(${application} PROPERTIES LINK_FLAGS "/ignore:4099") + endif() endforeach() # ****************************************************************************** diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d09392400..adb285b1a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -274,5 +274,9 @@ if(EXIV2_BUILD_EXIV2_COMMAND) install(TARGETS exiv2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) + + if (MSVC) + set_target_properties(exiv2 PROPERTIES LINK_FLAGS "/ignore:4099") + endif() endif() From a74c11edae666e1bcebea88ec3a1b14fe9f54f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 18 Dec 2018 10:33:41 +0100 Subject: [PATCH 30/31] Update doc: mentions to c++11 compilers --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0ba32ebbbf..2fc9c9ed89 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | [![Build Status](https://travis-ci.org/Exiv2/exiv2.svg?branch=master)](https://travis-ci.org/Exiv2/exiv2) | [![Build status](https://ci.appveyor.com/api/projects/status/d6vxf2n0cp3v88al/branch/master?svg=true)](https://ci.appveyor.com/project/piponazo/exiv2-wutfp/branch/master) | [![pipeline status](https://gitlab.com/D4N/exiv2/badges/master/pipeline.svg)](https://gitlab.com/D4N/exiv2/commits/master) | [![codecov](https://codecov.io/gh/Exiv2/exiv2/branch/master/graph/badge.svg)](https://codecov.io/gh/Exiv2/exiv2) | -### T A B L E _ OF _ C O N T E N T S +### TABLE OF CONTENTS 1. [Welcome to Exiv2](#1) 2. [Building, Installing, Using and Uninstalling Exiv2](#2) @@ -56,7 +56,7 @@ The file ReadMe.txt in a Build bundle describes how to install the library on th ## 2 Building, Installing, Using and Uninstalling Exiv2 -You need CMake to build Exiv2: https://cmake.org/download/ +You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and a C++11 compiler. ### 2.1 Build, Install, Use, Uninstall Exiv2 on a UNIX-like system @@ -136,7 +136,7 @@ The following Exiv2 features are enabled by default and require external librari | Native language support | gettext | -DEXIV2\_ENABLE\_NLS=Off | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) | | XMP support | expat | -DEXIV2\_ENABLE\_XMP=Off | [http://expat.sourceforge.net](http://expat.sourceforge.net)/
Use _**Expat 2.2.6**_ and later | -On Linux, you may install the dependencies using the distribution's package management system. Install the development package of a dependency to install the header files and static libraries required to build Exiv2. +On Linux, you may install the dependencies using the distribution's package management system.Install the development package of a dependency to install the header files and static libraries required to build Exiv2. Notes about different platforms are included in this document: [Platform Notes](#5) @@ -144,6 +144,7 @@ You may choose to install dependences with conan. This is supported on all plat See [README-CONAN](README-CONAN.md) for more information. [TOC](#TOC) + ### 2.5 Building and linking your code with Exiv2 @@ -153,7 +154,7 @@ platform: { CYGWIN| Darwin | Linux | MinGW | msvc } In general you need to do the following: -1) Application code should be written in C++ 98 and include exiv2 headers: +1) Application code should be written in C++11 and include exiv2 headers: ```C++ #include @@ -166,7 +167,7 @@ In general you need to do the following: The following is a typical command to build and link with libexiv2: ```bash -$ g++ -std=c++98 myprog.cpp -o myprog -I/usr/local/include -L/usr/local/lib -lexiv2 +$ g++ -std=c++11 myprog.cpp -o myprog -I/usr/local/include -L/usr/local/lib -lexiv2 ``` [TOC](#TOC) @@ -775,7 +776,7 @@ bash.exe -norc ### 5.5 Microsoft Visual C++ -We recommend that you use Conan to build Exiv2 using Microsoft Visual C++. For v0.27, we support Visual Studio 2008, 2010, 2012, 2013, 2015 and 2017. +We recommend that you use Conan to build Exiv2 using Microsoft Visual C++. Since we require a C++11 compiler, we only support the Visual Studio versions 2015 and 2017. As well as Microsoft Visual Studio, you will need to install CMake, Python3, and Conan. @@ -795,4 +796,4 @@ cmd [TOC](#TOC) -Written by Robin Mills
robin@clanmills.com
Updated: 2018-12-01 +Written by Robin Mills
robin@clanmills.com
Updated: 2018-12-18 \ No newline at end of file From 07e8f6ebf94f4ef18f9908f0c0e98932e204b3d5 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Wed, 19 Dec 2018 08:00:07 +0100 Subject: [PATCH 31/31] Doc typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2fc9c9ed89..3b9d99e689 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ The following Exiv2 features are enabled by default and require external librari | Native language support | gettext | -DEXIV2\_ENABLE\_NLS=Off | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) | | XMP support | expat | -DEXIV2\_ENABLE\_XMP=Off | [http://expat.sourceforge.net](http://expat.sourceforge.net)/
Use _**Expat 2.2.6**_ and later | -On Linux, you may install the dependencies using the distribution's package management system.Install the development package of a dependency to install the header files and static libraries required to build Exiv2. +On Linux, you may install the dependencies using the distribution's package management system. Install the development package of a dependency to install the header files and static libraries required to build Exiv2. Notes about different platforms are included in this document: [Platform Notes](#5) @@ -796,4 +796,4 @@ cmd [TOC](#TOC) -Written by Robin Mills
robin@clanmills.com
Updated: 2018-12-18 \ No newline at end of file +Written by Robin Mills
robin@clanmills.com
Updated: 2018-12-18