From 52a9ed30cfe037c7251aa7b868b1b82a47ecc0eb Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 10 Jun 2021 01:38:11 -0700 Subject: [PATCH] clang-tidy: use nullptr Found with modernize-use-nullptr Signed-off-by: Rosen Penev --- include/exiv2/convert.hpp | 4 ++-- include/exiv2/exif.hpp | 6 +++--- include/exiv2/iptc.hpp | 5 ++--- include/exiv2/metadatum.hpp | 7 ++----- include/exiv2/value.hpp | 6 +++--- include/exiv2/xmp_exiv2.hpp | 7 +++---- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/include/exiv2/convert.hpp b/include/exiv2/convert.hpp index 87ea2597..e77aec41 100644 --- a/include/exiv2/convert.hpp +++ b/include/exiv2/convert.hpp @@ -65,9 +65,9 @@ namespace Exiv2 { EXIV2API void syncExifWithXmp(ExifData& exifData, XmpData& xmpData); //! Convert (copy) IPTC datasets to XMP properties. - EXIV2API void copyIptcToXmp(const IptcData& iptcData, XmpData& xmpData, const char *iptcCharset = 0); + EXIV2API void copyIptcToXmp(const IptcData& iptcData, XmpData& xmpData, const char* iptcCharset = nullptr); //! Convert (move) IPTC datasets to XMP properties, remove converted IPTC datasets. - EXIV2API void moveIptcToXmp(IptcData& iptcData, XmpData& xmpData, const char *iptcCharset = 0); + EXIV2API void moveIptcToXmp(IptcData& iptcData, XmpData& xmpData, const char* iptcCharset = nullptr); //! Convert (copy) XMP properties to IPTC datasets. EXIV2API void copyXmpToIptc(const XmpData& xmpData, IptcData& iptcData); diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp index 249a2add..c73c970f 100644 --- a/include/exiv2/exif.hpp +++ b/include/exiv2/exif.hpp @@ -72,7 +72,7 @@ namespace Exiv2 { @param pValue Pointer to an %Exifdatum value. @throw Error if the key cannot be parsed and converted. */ - explicit Exifdatum(const ExifKey& key, const Value* pValue =0); + explicit Exifdatum(const ExifKey& key, const Value* pValue = nullptr); //! Copy constructor Exifdatum(const Exifdatum& rhs); //! Destructor @@ -175,7 +175,7 @@ namespace Exiv2 { @return Number of characters written. */ long copy(byte* buf, ByteOrder byteOrder) const override; - std::ostream& write(std::ostream& os, const ExifData* pMetadata = 0) const override; + std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const override; //! Return the type id of the value TypeId typeId() const override; //! Return the name of the type @@ -617,7 +617,7 @@ namespace Exiv2 { const ExifData& exifData ) { - encode(blob, 0, 0, byteOrder, exifData); + encode(blob, nullptr, 0, byteOrder, exifData); } }; // class ExifParser diff --git a/include/exiv2/iptc.hpp b/include/exiv2/iptc.hpp index e0e4b7a8..2b5aaf29 100644 --- a/include/exiv2/iptc.hpp +++ b/include/exiv2/iptc.hpp @@ -62,8 +62,7 @@ namespace Exiv2 { @throw Error if the key cannot be parsed and converted to a tag number and record id. */ - explicit Iptcdatum(const IptcKey& key, - const Value* pValue =0); + explicit Iptcdatum(const IptcKey& key, const Value* pValue = nullptr); //! Copy constructor Iptcdatum(const Iptcdatum& rhs); //! Destructor @@ -104,7 +103,7 @@ namespace Exiv2 { //! @name Accessors //@{ long copy(byte* buf, ByteOrder byteOrder) const override; - std::ostream& write(std::ostream& os, const ExifData* pMetadata = 0) const override; + std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const override; /*! @brief Return the key of the Iptcdatum. The key is of the form 'Iptc.recordName.datasetName'. Note however that the key diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp index fc97a76b..645a12c7 100644 --- a/include/exiv2/metadatum.hpp +++ b/include/exiv2/metadatum.hpp @@ -147,7 +147,7 @@ namespace Exiv2 { Implemented in terms of write(), see there. */ - std::string print(const ExifData* pMetadata =0) const; + std::string print(const ExifData* pMetadata = nullptr) const; /*! @brief Write value to a data buffer and return the number of bytes written. @@ -181,10 +181,7 @@ namespace Exiv2 { See also print(), which prints the interpreted value to a string. */ - virtual std::ostream& write( - std::ostream& os, - const ExifData* pMetadata =0 - ) const =0; + virtual std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const = 0; /*! @brief Return the key of the metadatum. The key is of the form 'familyName.groupName.tagName'. Note however that the key diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp index 8939daa2..7ed5268d 100644 --- a/include/exiv2/value.hpp +++ b/include/exiv2/value.hpp @@ -589,7 +589,7 @@ namespace Exiv2 { @return A string containing the comment converted to UTF-8. */ - std::string comment(const char* encoding =0) const; + std::string comment(const char* encoding = nullptr) const; /*! @brief Determine the character encoding that was used to encode the UNICODE comment value as an iconv(3) name. @@ -1531,7 +1531,7 @@ namespace Exiv2 { Value::operator=(rhs); value_ = rhs.value_; - byte* tmp = 0; + byte* tmp = nullptr; if (rhs.sizeDataArea_ > 0) { tmp = new byte[rhs.sizeDataArea_]; std::memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_); @@ -1720,7 +1720,7 @@ namespace Exiv2 { template int ValueType::setDataArea(const byte* buf, long len) { - byte* tmp = 0; + byte* tmp = nullptr; if (len > 0) { tmp = new byte[len]; std::memcpy(tmp, buf, len); diff --git a/include/exiv2/xmp_exiv2.hpp b/include/exiv2/xmp_exiv2.hpp index b0a1f6bd..daaa7f40 100644 --- a/include/exiv2/xmp_exiv2.hpp +++ b/include/exiv2/xmp_exiv2.hpp @@ -58,8 +58,7 @@ namespace Exiv2 { @throw Error if the key cannot be parsed and converted to a known schema namespace prefix and property name. */ - explicit Xmpdatum(const XmpKey& key, - const Value* pValue =0); + explicit Xmpdatum(const XmpKey& key, const Value* pValue = nullptr); //! Copy constructor Xmpdatum(const Xmpdatum& rhs); //! Destructor @@ -111,7 +110,7 @@ namespace Exiv2 { //@{ //! Not implemented. Calling this method will raise an exception. long copy(byte* buf, ByteOrder byteOrder) const override; - std::ostream& write(std::ostream& os, const ExifData* pMetadata = 0) const override; + std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const override; /*! @brief Return the key of the Xmpdatum. The key is of the form 'Xmp.prefix.property'. Note however that the @@ -375,7 +374,7 @@ namespace Exiv2 { @return True if the initialization was successful, else false. */ - static bool initialize(XmpParser::XmpLockFct xmpLockFct =0, void* pLockData =0); + static bool initialize(XmpParser::XmpLockFct xmpLockFct = nullptr, void* pLockData = nullptr); /*! @brief Terminate the XMP Toolkit and unregister custom namespaces.