Change Metadatum::size() return value from long to size_t

main
Luis Diaz 3 years ago committed by Luis Díaz Más
parent 62aad98d0b
commit 137ea080b5

@ -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;

@ -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<long>(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<byte*>& bytes,uint32_t depth);
//@}

@ -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;
/*!

@ -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;

@ -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,

@ -318,7 +318,7 @@ namespace Exiv2 {
size_t Exifdatum::count() const { return value_ ? value_->count() : 0; }
long Exifdatum::size() const { return value_ ? static_cast<long>(value_->size()) : 0; }
size_t Exifdatum::size() const { return value_ ? value_->size() : 0; }
std::string Exifdatum::toString() const { return value_ ? value_->toString() : ""; }

@ -114,7 +114,7 @@ namespace Exiv2 {
size_t Iptcdatum::count() const { return value_ ? value_->count() : 0; }
long Iptcdatum::size() const { return value_ ? static_cast<long>(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<byte>(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<uint32_t>(dataSize), bigEndian);
pWrite += 4;
}
else {

@ -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,

@ -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<long>(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() : ""; }

Loading…
Cancel
Save