diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp index 347747a2..c9c1c774 100644 --- a/include/exiv2/exif.hpp +++ b/include/exiv2/exif.hpp @@ -168,7 +168,7 @@ namespace Exiv2 { //! Return the number of components in the value size_t count() const override; //! Return the size of the value in bytes - long size() const override; + size_t size() const override; //! Return the value as a string. std::string toString() const override; std::string toString(long n) const override; diff --git a/include/exiv2/iptc.hpp b/include/exiv2/iptc.hpp index a806e951..c5a1d920 100644 --- a/include/exiv2/iptc.hpp +++ b/include/exiv2/iptc.hpp @@ -120,7 +120,7 @@ namespace Exiv2 { const char* typeName() const override; long typeSize() const override; size_t count() const override; - long size() const override; + size_t size() const override; std::string toString() const override; std::string toString(long n) const override; int64_t toInt64(long n = 0) const override; @@ -236,19 +236,17 @@ namespace Exiv2 { uint16_t record = IptcDataSets::application2) const; //! Return true if there is no IPTC metadata bool empty() const { return count() == 0; } + //! Get the number of metadata entries - long count() const { return static_cast(iptcMetadata_.size()); } - /*! - @brief Return the exact size of all contained IPTC metadata - */ - long size() const; - /*! - @brief Return the metadata charset name or 0 - */ + size_t count() const { return iptcMetadata_.size(); } + + //! @brief Return the exact size of all contained IPTC metadata + size_t size() const; + + //! @brief Return the metadata charset name or 0 const char *detectCharset() const; - /*! - @brief dump iptc formatted binary data (used by printStructure kpsRecursive) - */ + + //! @brief dump iptc formatted binary data (used by printStructure kpsRecursive) static void printStructure(std::ostream& out, const Slice& bytes,uint32_t depth); //@} diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp index bdf03b74..aad5110d 100644 --- a/include/exiv2/metadatum.hpp +++ b/include/exiv2/metadatum.hpp @@ -191,7 +191,7 @@ namespace Exiv2 { //! Return the number of components in the value virtual size_t count() const =0; //! Return the size of the value in bytes - virtual long size() const =0; + virtual size_t size() const =0; //! Return the value as a string. virtual std::string toString() const =0; /*! diff --git a/include/exiv2/xmp_exiv2.hpp b/include/exiv2/xmp_exiv2.hpp index 15f32108..c2ee9941 100644 --- a/include/exiv2/xmp_exiv2.hpp +++ b/include/exiv2/xmp_exiv2.hpp @@ -115,7 +115,7 @@ namespace Exiv2 { //! The Exif typeSize doesn't make sense here. Return 0. long typeSize() const override; size_t count() const override; - long size() const override; + size_t size() const override; std::string toString() const override; std::string toString(long n) const override; int64_t toInt64(long n = 0) const override; diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index e9b90c40..ea965c01 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -1019,12 +1019,14 @@ namespace Exiv2::Internal { const auto ed2 = image.exifData().findKey(k2); const auto edEnd = image.exifData().end(); - long size = 0; - if (ed1 != edEnd) size += ed1->size(); - if (ed2 != edEnd) size += ed2->size(); + size_t size{0}; + if (ed1 != edEnd) + size += ed1->size(); + if (ed2 != edEnd) + size += ed2->size(); if (size != 0) { DataBuf buf(size); - long pos = 0; + size_t pos{0}; if (ed1 != edEnd) { ed1->copy(buf.data(), pHead->byteOrder()); pos += ed1->size(); @@ -1039,7 +1041,7 @@ namespace Exiv2::Internal { else { pHead->remove(pCrwMapping->crwTagId_, pCrwMapping->crwDir_); } - } // CrwMap::encode0x080a + } void CrwMap::encodeArray(const Image& image, const CrwMapping* pCrwMapping, diff --git a/src/exif.cpp b/src/exif.cpp index b24cd308..412ccb20 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -318,7 +318,7 @@ namespace Exiv2 { size_t Exifdatum::count() const { return value_ ? value_->count() : 0; } - long Exifdatum::size() const { return value_ ? static_cast(value_->size()) : 0; } + size_t Exifdatum::size() const { return value_ ? value_->size() : 0; } std::string Exifdatum::toString() const { return value_ ? value_->toString() : ""; } diff --git a/src/iptc.cpp b/src/iptc.cpp index ea87d97e..34a2d91d 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -114,7 +114,7 @@ namespace Exiv2 { size_t Iptcdatum::count() const { return value_ ? value_->count() : 0; } - long Iptcdatum::size() const { return value_ ? static_cast(value_->size()) : 0; } + size_t Iptcdatum::size() const { return value_ ? value_->size() : 0; } std::string Iptcdatum::toString() const { return value_ ? value_->toString() : ""; } @@ -197,13 +197,13 @@ namespace Exiv2 { return *pos; } - long IptcData::size() const + size_t IptcData::size() const { - long newSize = 0; + size_t newSize = 0; for (auto&& iptc : iptcMetadata_) { // marker, record Id, dataset num, first 2 bytes of size newSize += 5; - long dataSize = iptc.size(); + size_t dataSize = iptc.size(); newSize += dataSize; if (dataSize > 32767) { // extended dataset (we always use 4 bytes) @@ -211,7 +211,7 @@ namespace Exiv2 { } } return newSize; - } // IptcData::size + } int IptcData::add(const IptcKey& key, Value* value) { @@ -450,13 +450,13 @@ namespace Exiv2 { *pWrite++ = static_cast(iter.tag()); // extended or standard dataset? - long dataSize = iter.size(); + size_t dataSize = iter.size(); if (dataSize > 32767) { // always use 4 bytes for extended length uint16_t sizeOfSize = 4 | 0x8000; us2Data(pWrite, sizeOfSize, bigEndian); pWrite += 2; - ul2Data(pWrite, dataSize, bigEndian); + ul2Data(pWrite, static_cast(dataSize), bigEndian); pWrite += 4; } else { diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index c3bd125b..c15e57c1 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -1031,7 +1031,7 @@ namespace Exiv2::Internal { #ifdef EXIV2_DEBUG_MESSAGES bool tooLarge = false; #endif - uint32_t newSize = datum->size(); + size_t newSize = datum->size(); if (newSize > object->size_) { // value doesn't fit, encode for intrusive writing setDirty(); #ifdef EXIV2_DEBUG_MESSAGES @@ -1046,14 +1046,14 @@ namespace Exiv2::Internal { std::cerr << "\t\t\t ALLOCATED " << std::dec << object->size_ << " BYTES"; } #endif - } // TiffEncoder::encodeTiffEntryBase + } void TiffEncoder::encodeOffsetEntry(TiffEntryBase* object, const Exifdatum* datum) { assert(object); assert(datum); - uint32_t newSize = datum->size(); + size_t newSize = datum->size(); if (newSize > object->size_) { // value doesn't fit, encode for intrusive writing setDirty(); object->updateValue(datum->getValue(), byteOrder()); // clones the value @@ -1071,8 +1071,7 @@ namespace Exiv2::Internal { std::cerr << "\t\t\t PRESERVE VALUE DATA"; #endif } - - } // TiffEncoder::encodeOffsetEntry + } void TiffEncoder::add( TiffComponent* pRootDir, diff --git a/src/xmp.cpp b/src/xmp.cpp index ff7aadb2..f96b157e 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -352,7 +352,7 @@ namespace Exiv2 { size_t Xmpdatum::count() const { return p_->value_ ? p_->value_->count() : 0; } - long Xmpdatum::size() const { return p_->value_ ? static_cast(p_->value_->size()) : 0; } + size_t Xmpdatum::size() const { return p_->value_ ? p_->value_->size() : 0; } std::string Xmpdatum::toString() const { return p_->value_ ? p_->value_->toString() : ""; }