From 256365830a5ce7a917d48acca8ba0b58569f4510 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Fri, 18 Feb 2022 12:30:33 +0000 Subject: [PATCH] Replace Metadatum::toLong() with Metadatum::toInt64(). --- include/exiv2/exif.hpp | 2 +- include/exiv2/iptc.hpp | 2 +- include/exiv2/metadatum.hpp | 2 +- include/exiv2/tiffimage.hpp | 4 ++-- include/exiv2/xmp_exiv2.hpp | 2 +- samples/xmpsample.cpp | 2 +- src/bmffimage.cpp | 4 ++-- src/convert.cpp | 16 ++++++++-------- src/cr2image.cpp | 4 ++-- src/crwimage.cpp | 4 ++-- src/crwimage_int.cpp | 2 +- src/exif.cpp | 14 +++++++------- src/iptc.cpp | 4 ++-- src/mrwimage.cpp | 4 ++-- src/nikonmn_int.cpp | 10 +++++----- src/orfimage.cpp | 4 ++-- src/pentaxmn_int.cpp | 30 +++++++++++++++--------------- src/preview.cpp | 16 ++++++++-------- src/rafimage.cpp | 4 ++-- src/rw2image.cpp | 4 ++-- src/sonymn_int.cpp | 4 ++-- src/tiffimage.cpp | 8 ++++---- src/tiffvisitor_int.cpp | 2 +- src/xmp.cpp | 4 ++-- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/include/exiv2/exif.hpp b/include/exiv2/exif.hpp index b3f9bd16f4..6feb92d42d 100644 --- a/include/exiv2/exif.hpp +++ b/include/exiv2/exif.hpp @@ -189,7 +189,7 @@ namespace Exiv2 { //! Return the value as a string. std::string toString() const override; std::string toString(long n) const override; - long toLong(long n = 0) const override; + int64_t toInt64(long n = 0) const override; float toFloat(long n = 0) const override; Rational toRational(long n = 0) const override; Value::UniquePtr getValue() const override; diff --git a/include/exiv2/iptc.hpp b/include/exiv2/iptc.hpp index 23f8a66f5d..4ea0d03de0 100644 --- a/include/exiv2/iptc.hpp +++ b/include/exiv2/iptc.hpp @@ -140,7 +140,7 @@ namespace Exiv2 { long size() const override; std::string toString() const override; std::string toString(long n) const override; - long toLong(long n = 0) const override; + int64_t toInt64(long n = 0) const override; float toFloat(long n = 0) const override; Rational toRational(long n = 0) const override; Value::UniquePtr getValue() const override; diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp index 645a12c7c1..925e39c58a 100644 --- a/include/exiv2/metadatum.hpp +++ b/include/exiv2/metadatum.hpp @@ -222,7 +222,7 @@ namespace Exiv2 { The return value is -1 if the value is not set and the behaviour of the method is undefined if there is no n-th component. */ - virtual long toLong(long n =0) const =0; + virtual int64_t toInt64(long n =0) const =0; /*! @brief Return the n-th component of the value converted to float. The return value is -1 if the value is not set and the behaviour diff --git a/include/exiv2/tiffimage.hpp b/include/exiv2/tiffimage.hpp index 11201b7346..75e41a9475 100644 --- a/include/exiv2/tiffimage.hpp +++ b/include/exiv2/tiffimage.hpp @@ -105,8 +105,8 @@ namespace Exiv2 { // DATA mutable std::string primaryGroup_; //!< The primary group mutable std::string mimeType_; //!< The MIME type - mutable int pixelWidthPrimary_; //!< Width of the primary image in pixels - mutable int pixelHeightPrimary_; //!< Height of the primary image in pixels + mutable int64_t pixelWidthPrimary_; //!< Width of the primary image in pixels + mutable int64_t pixelHeightPrimary_; //!< Height of the primary image in pixels }; // class TiffImage diff --git a/include/exiv2/xmp_exiv2.hpp b/include/exiv2/xmp_exiv2.hpp index daaa7f40bf..85250a1419 100644 --- a/include/exiv2/xmp_exiv2.hpp +++ b/include/exiv2/xmp_exiv2.hpp @@ -135,7 +135,7 @@ namespace Exiv2 { long size() const override; std::string toString() const override; std::string toString(long n) const override; - long toLong(long n = 0) const override; + int64_t toInt64(long n = 0) const override; float toFloat(long n = 0) const override; Rational toRational(long n = 0) const override; Value::UniquePtr getValue() const override; diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index c465f0cb9c..2b57ca0113 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -74,7 +74,7 @@ try { xmpData["Xmp.dc.eight"] = true; // Extracting values - assert(xmpData["Xmp.dc.one"].toLong() == -1); + assert(xmpData["Xmp.dc.one"].toInt64() == -1); assert(xmpData["Xmp.dc.one"].value().ok()); const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value(); diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index ddce22a077..82066ebcd5 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -161,7 +161,7 @@ namespace Exiv2 { auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension")); if (imageWidth != exifData_.end() && imageWidth->count() > 0) { - return imageWidth->toLong(); + return imageWidth->toInt64(); } return pixelWidth_; } @@ -170,7 +170,7 @@ namespace Exiv2 { auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension")); if (imageHeight != exifData_.end() && imageHeight->count() > 0) { - return imageHeight->toLong(); + return imageHeight->toInt64(); } return pixelHeight_; } diff --git a/src/convert.cpp b/src/convert.cpp index 9197e2cf93..2d1ce167c7 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -698,7 +698,7 @@ namespace Exiv2 { if (!prepareXmpTarget(to)) return; std::ostringstream value; for (long i = 0; i < pos->count(); ++i) { - value << static_cast(pos->toLong(i)); + value << static_cast(pos->toInt64(i)); } (*xmpData_)[to] = value.str(); if (erase_) exifData_->erase(pos); @@ -712,7 +712,7 @@ namespace Exiv2 { std::ostringstream value; for (long i = 0; i < pos->count(); ++i) { if (i > 0) value << '.'; - value << pos->toLong(i); + value << pos->toInt64(i); } (*xmpData_)[to] = value.str(); if (erase_) exifData_->erase(pos); @@ -723,7 +723,7 @@ namespace Exiv2 { auto pos = exifData_->findKey(ExifKey(from)); if (pos == exifData_->end() || pos->count() == 0) return; if (!prepareXmpTarget(to)) return; - int value = pos->toLong(); + auto value = pos->toInt64(); if (!pos->value().ok()) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to convert " << from << " to " << to << "\n"; @@ -991,7 +991,7 @@ namespace Exiv2 { unsigned short value = 0; if (pos != xmpData_->end() && pos->count() > 0) { - int fired = pos->toLong(); + auto fired = pos->toInt64(); if (pos->value().ok()) value |= fired & 1; #ifndef SUPPRESS_WARNINGS @@ -1001,7 +1001,7 @@ namespace Exiv2 { } pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Return")); if (pos != xmpData_->end() && pos->count() > 0) { - int ret = pos->toLong(); + auto ret = pos->toInt64(); if (pos->value().ok()) value |= (ret & 3) << 1; #ifndef SUPPRESS_WARNINGS @@ -1011,7 +1011,7 @@ namespace Exiv2 { } pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Mode")); if (pos != xmpData_->end() && pos->count() > 0) { - int mode = pos->toLong(); + auto mode = pos->toInt64(); if (pos->value().ok()) value |= (mode & 3) << 3; #ifndef SUPPRESS_WARNINGS @@ -1021,7 +1021,7 @@ namespace Exiv2 { } pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Function")); if (pos != xmpData_->end() && pos->count() > 0) { - int function = pos->toLong(); + auto function = pos->toInt64(); if (pos->value().ok()) value |= (function & 1) << 5; #ifndef SUPPRESS_WARNINGS @@ -1032,7 +1032,7 @@ namespace Exiv2 { pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:RedEyeMode")); if (pos != xmpData_->end()) { if (pos->count() > 0) { - int red = pos->toLong(); + auto red = pos->toInt64(); if (pos->value().ok()) value |= (red & 1) << 6; #ifndef SUPPRESS_WARNINGS diff --git a/src/cr2image.cpp b/src/cr2image.cpp index 4bd9a0b908..cc5a3fac0b 100644 --- a/src/cr2image.cpp +++ b/src/cr2image.cpp @@ -60,7 +60,7 @@ namespace Exiv2 { { auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension")); if (imageWidth != exifData_.end() && imageWidth->count() > 0) { - return imageWidth->toLong(); + return imageWidth->toInt64(); } return 0; } @@ -69,7 +69,7 @@ namespace Exiv2 { { auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension")); if (imageHeight != exifData_.end() && imageHeight->count() > 0) { - return imageHeight->toLong(); + return imageHeight->toInt64(); } return 0; } diff --git a/src/crwimage.cpp b/src/crwimage.cpp index 165f096bc4..fde95cad97 100644 --- a/src/crwimage.cpp +++ b/src/crwimage.cpp @@ -66,7 +66,7 @@ namespace Exiv2 { { auto widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension")); if (widthIter != exifData_.end() && widthIter->count() > 0) { - return widthIter->toLong(); + return widthIter->toInt64(); } return 0; } @@ -75,7 +75,7 @@ namespace Exiv2 { { auto heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension")); if (heightIter != exifData_.end() && heightIter->count() > 0) { - return heightIter->toLong(); + return heightIter->toInt64(); } return 0; } diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 34227ca61c..e32f056b3e 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -1175,7 +1175,7 @@ namespace Exiv2 { } int32_t d = 0; if (edO != edEnd && edO->count() > 0 && edO->typeId() == unsignedShort) { - d = RotationMap::degrees(static_cast(edO->toLong())); + d = RotationMap::degrees(static_cast(edO->toInt64())); } buf.write_uint32(12, d, pHead->byteOrder()); pHead->add(pCrwMapping->crwTagId_, pCrwMapping->crwDir_, std::move(buf)); diff --git a/src/exif.cpp b/src/exif.cpp index 348da6e975..a8054000ec 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -157,7 +157,7 @@ namespace { }; // class JpegThumbnail //! Helper function to sum all components of the value of a metadatum - long sumToLong(const Exiv2::Exifdatum& md); + int64_t sumToLong(const Exiv2::Exifdatum& md); //! Helper function to delete all tags of a specific IFD from the metadata. void eraseIfd(Exiv2::ExifData& ed, Exiv2::Internal::IfdId ifdId); @@ -405,9 +405,9 @@ namespace Exiv2 { return value_.get() == nullptr ? "" : value_->toString(n); } - long Exifdatum::toLong(long n) const + int64_t Exifdatum::toInt64(long n) const { - return value_.get() == nullptr ? -1 : static_cast(value_->toInt64(n)); + return value_.get() == nullptr ? -1 : value_->toInt64(n); } float Exifdatum::toFloat(long n) const @@ -825,7 +825,7 @@ namespace { if (pos != exifData.end()) { if (pos->count() == 0) return thumbnail; - long compression = pos->toLong(); + auto compression = pos->toInt64(); if (compression == 6) { thumbnail = std::make_unique(); } @@ -889,11 +889,11 @@ namespace { return format->dataArea(); } - long sumToLong(const Exiv2::Exifdatum& md) + int64_t sumToLong(const Exiv2::Exifdatum& md) { - long sum = 0; + int64_t sum = 0; for (long i = 0; i < md.count(); ++i) { - sum += md.toLong(i); + sum += md.toInt64(i); } return sum; } diff --git a/src/iptc.cpp b/src/iptc.cpp index c30b7e78c1..d0c63408d9 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -181,9 +181,9 @@ namespace Exiv2 { return value_.get() == nullptr ? "" : value_->toString(n); } - long Iptcdatum::toLong(long n) const + int64_t Iptcdatum::toInt64(long n) const { - return value_.get() == nullptr ? -1 : static_cast(value_->toInt64(n)); + return value_.get() == nullptr ? -1 : value_->toInt64(n); } float Iptcdatum::toFloat(long n) const diff --git a/src/mrwimage.cpp b/src/mrwimage.cpp index 129d676958..63aa414bee 100644 --- a/src/mrwimage.cpp +++ b/src/mrwimage.cpp @@ -53,7 +53,7 @@ namespace Exiv2 { { auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageWidth")); if (imageWidth != exifData_.end() && imageWidth->count() > 0) { - return imageWidth->toLong(); + return imageWidth->toInt64(); } return 0; } @@ -62,7 +62,7 @@ namespace Exiv2 { { auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageLength")); if (imageHeight != exifData_.end() && imageHeight->count() > 0) { - return imageHeight->toLong(); + return imageHeight->toInt64(); } return 0; } diff --git a/src/nikonmn_int.cpp b/src/nikonmn_int.cpp index b5da7e8b09..1f9020e791 100644 --- a/src/nikonmn_int.cpp +++ b/src/nikonmn_int.cpp @@ -2665,14 +2665,14 @@ fmountlens[] = { if (md == metadata->end() || md->typeId() != unsignedByte || md->count() == 0) { return os << value; } - raw[i] = static_cast(md->toLong()); + raw[i] = static_cast(md->toInt64()); } auto md = metadata->findKey(ExifKey("Exif.Nikon3.LensType")); if (md == metadata->end() || md->typeId() != unsignedByte || md->count() == 0) { return os << value; } - raw[7] = static_cast(md->toLong()); + raw[7] = static_cast(md->toInt64()); for (int i = 0; fmountlens[i].lensname != nullptr; ++i) { if ( raw[0] == fmountlens[i].lid ) { @@ -2990,7 +2990,7 @@ fmountlens[] = { os << "(" << value << ")"; } else { - if (pos->toLong() < 0x06) { + if (pos->toInt64() < 0x06) { // FlashGroupACompensation value if (temp == 0) os << 0; @@ -3031,7 +3031,7 @@ fmountlens[] = { os << "(" << value << ")"; } else { - if (pos->toLong() < 0x06) { + if (pos->toInt64() < 0x06) { // FlashGroupBCompensation value if (temp == 0) os << 0; @@ -3072,7 +3072,7 @@ fmountlens[] = { os << "(" << value << ")"; } else { - if (pos->toLong() < 0x06) { + if (pos->toInt64() < 0x06) { // FlashGroupCCompensation value if (temp == 0) os << 0; diff --git a/src/orfimage.cpp b/src/orfimage.cpp index a6836ab6e5..d6ae7a306d 100644 --- a/src/orfimage.cpp +++ b/src/orfimage.cpp @@ -58,7 +58,7 @@ namespace Exiv2 { { auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageWidth")); if (imageWidth != exifData_.end() && imageWidth->count() > 0) { - return imageWidth->toLong(); + return imageWidth->toInt64(); } return 0; } @@ -67,7 +67,7 @@ namespace Exiv2 { { auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageLength")); if (imageHeight != exifData_.end() && imageHeight->count() > 0) { - return imageHeight->toLong(); + return imageHeight->toInt64(); } return 0; } diff --git a/src/pentaxmn_int.cpp b/src/pentaxmn_int.cpp index f4f758ed64..a2ddd05470 100644 --- a/src/pentaxmn_int.cpp +++ b/src/pentaxmn_int.cpp @@ -1175,11 +1175,11 @@ namespace Exiv2 { return os; } const uint32_t date = - (dateIt->toLong(0) << 24) + (dateIt->toLong(1) << 16) + - (dateIt->toLong(2) << 8) + (dateIt->toLong(3) << 0); + (dateIt->toInt64(0) << 24) + (dateIt->toInt64(1) << 16) + + (dateIt->toInt64(2) << 8) + (dateIt->toInt64(3) << 0); const uint32_t time = - (timeIt->toLong(0) << 24) + (timeIt->toLong(1) << 16) + - (timeIt->toLong(2) << 8); + (timeIt->toInt64(0) << 24) + (timeIt->toInt64(1) << 16) + + (timeIt->toInt64(2) << 8); const uint32_t countEnc = (value.toUint32(0) << 24) + (value.toUint32(1) << 16) + (value.toUint32(2) << 8) + (value.toUint32(3) << 0); @@ -1276,13 +1276,13 @@ namespace Exiv2 { // 0x0207 Pentax LensInfo Undefined 36 3 255 0 0 40 148 71 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0 unsigned long base = 1; - unsigned int autoAperture = lensInfo->toLong(base+1) & 0x01 ; - unsigned int minAperture = lensInfo->toLong(base+2) & 0x06 ; - unsigned int minFocusDistance = lensInfo->toLong(base+3) & 0xf8 ; + unsigned int autoAperture = lensInfo->toInt64(base+1) & 0x01 ; + unsigned int minAperture = lensInfo->toInt64(base+2) & 0x06 ; + unsigned int minFocusDistance = lensInfo->toInt64(base+3) & 0xf8 ; - if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toLong(base+4) == 148) index = 8; - if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toLong(base+5) == 110) index = 7; - if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toLong(base+4) == 110) index = 7; + if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toInt64(base+4) == 148) index = 8; + if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toInt64(base+5) == 110) index = 7; + if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toInt64(base+4) == 110) index = 7; } else if ( value.count() == 3 ) { // http://dev.exiv2.org/attachments/download/858/_IGP9032.DNG @@ -1290,15 +1290,15 @@ namespace Exiv2 { // 0x003f PentaxDng LensType Byte 3 3 255 0 // 0x0207 PentaxDng LensInfo Undefined 69 131 0 0 255 0 40 148 68 244 ... // 0 1 2 3 4 5 6 - if ( lensInfo->toLong(4) == 0 && lensInfo->toLong(5) == 40 && lensInfo->toLong(6) == 148 ) index = 8; + if ( lensInfo->toInt64(4) == 0 && lensInfo->toInt64(5) == 40 && lensInfo->toInt64(6) == 148 ) index = 8; } else if ( value.count() == 4 ) { // http://dev.exiv2.org/attachments/download/868/IMGP2221.JPG // 0x0207 PentaxDng LensInfo Undefined 128 0 131 128 0 0 255 1 184 0 0 0 0 0 // 0 1 2 3 4 5 6 - if ( lensInfo->count() == 128 && lensInfo->toLong(1) == 131 && lensInfo->toLong(2) == 128 ) index = 8; + if ( lensInfo->count() == 128 && lensInfo->toInt64(1) == 131 && lensInfo->toInt64(2) == 128 ) index = 8; // #1155 - if ( lensInfo->toLong(6) == 5 ) index = 7; + if ( lensInfo->toInt64(6) == 5 ) index = 7; } if ( index > 0 ) { @@ -1323,7 +1323,7 @@ namespace Exiv2 { const auto lensInfo = findLensInfo(metadata); if ( value.count() == 4 ) { std::string model = getKeyString("Exif.Image.Model" ,metadata); - if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toLong(1) == 168 && lensInfo->toLong(2) == 144 ) index = 7; + if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toInt64(1) == 168 && lensInfo->toInt64(2) == 144 ) index = 7; } if ( index > 0 ) { @@ -1348,7 +1348,7 @@ namespace Exiv2 { const auto lensInfo = findLensInfo(metadata); if ( value.count() == 4 ) { std::string model = getKeyString("Exif.Image.Model" ,metadata); - if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toLong(1) == 131 && lensInfo->toLong(2) == 128 ) + if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toInt64(1) == 131 && lensInfo->toInt64(2) == 128 ) index = 6; } if ( value.count() == 2 ) { diff --git a/src/preview.cpp b/src/preview.cpp index 4721ebd1d9..3f2e79c009 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -522,13 +522,13 @@ namespace { const ExifData &exifData = image_.exifData(); auto pos = exifData.findKey(ExifKey(param_[parIdx].offsetKey_)); if (pos != exifData.end() && pos->count() > 0) { - offset_ = pos->toLong(); + offset_ = pos->toInt64(); } size_ = 0; pos = exifData.findKey(ExifKey(param_[parIdx].sizeKey_)); if (pos != exifData.end() && pos->count() > 0) { - size_ = pos->toLong(); + size_ = pos->toInt64(); } if (offset_ == 0 || size_ == 0) return; @@ -536,7 +536,7 @@ namespace { if (param_[parIdx].baseOffsetKey_) { pos = exifData.findKey(ExifKey(param_[parIdx].baseOffsetKey_)); if (pos != exifData.end() && pos->count() > 0) { - offset_ += pos->toLong(); + offset_ += pos->toInt64(); } } @@ -712,19 +712,19 @@ namespace { if (pos == exifData.end()) return; if (offsetCount != pos->value().count()) return; for (int i = 0; i < offsetCount; i++) { - size_ += pos->toLong(i); + size_ += pos->toInt64(i); } if (size_ == 0) return; pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".ImageWidth")); if (pos != exifData.end() && pos->count() > 0) { - width_ = pos->toLong(); + width_ = pos->toInt64(); } pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".ImageLength")); if (pos != exifData.end() && pos->count() > 0) { - height_ = pos->toLong(); + height_ = pos->toInt64(); } if (width_ == 0 || height_ == 0) return; @@ -852,8 +852,8 @@ namespace { if (formatDatum->toString() != "JPEG") return; - width_ = widthDatum->toLong(); - height_ = heightDatum->toLong(); + width_ = widthDatum->toInt64(); + height_ = heightDatum->toInt64(); preview_ = decodeBase64(imageDatum->toString()); size_ = static_cast(preview_.size()); valid_ = true; diff --git a/src/rafimage.cpp b/src/rafimage.cpp index 23bb0109e9..79678ad998 100644 --- a/src/rafimage.cpp +++ b/src/rafimage.cpp @@ -55,7 +55,7 @@ namespace Exiv2 { { auto widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension")); if (widthIter != exifData_.end() && widthIter->count() > 0) { - return widthIter->toLong(); + return widthIter->toInt64(); } return 0; } @@ -64,7 +64,7 @@ namespace Exiv2 { { auto heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension")); if (heightIter != exifData_.end() && heightIter->count() > 0) { - return heightIter->toLong(); + return heightIter->toInt64(); } return 0; } diff --git a/src/rw2image.cpp b/src/rw2image.cpp index 4d856326a3..c1ce456f55 100644 --- a/src/rw2image.cpp +++ b/src/rw2image.cpp @@ -56,7 +56,7 @@ namespace Exiv2 { auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.PanasonicRaw.SensorWidth")); if (imageWidth != exifData_.end() && imageWidth->count() > 0) { - return imageWidth->toLong(); + return imageWidth->toInt64(); } return 0; } @@ -66,7 +66,7 @@ namespace Exiv2 { auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.PanasonicRaw.SensorHeight")); if (imageHeight != exifData_.end() && imageHeight->count() > 0) { - return imageHeight->toLong(); + return imageHeight->toInt64(); } return 0; } diff --git a/src/sonymn_int.cpp b/src/sonymn_int.cpp index 0cc2f0bc6d..c9baf549b0 100644 --- a/src/sonymn_int.cpp +++ b/src/sonymn_int.cpp @@ -857,7 +857,7 @@ namespace Exiv2 { return os << "(" << value << ")"; auto pos = metadata->findKey(ExifKey("Exif.Sony2Fp.0x0002")); - if (pos != metadata->end() && pos-> count() == 1 && pos->toLong() == 255) + if (pos != metadata->end() && pos-> count() == 1 && pos->toInt64() == 255) return os << value << " °C"; return os << N_("n/a"); @@ -944,7 +944,7 @@ namespace Exiv2 { return os << "(" << value << ")"; auto pos = metadata->findKey(ExifKey("Exif.SonyMisc1.0x0004")); - if (pos != metadata->end() && pos->count() == 1 && pos->toLong() != 0 && pos->toLong() < 100) + if (pos != metadata->end() && pos->count() == 1 && pos->toInt64() != 0 && pos->toInt64() < 100) return os << value << " °C"; return os << N_("n/a"); diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index 4a405b0345..84a6ef6944 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -97,7 +97,7 @@ namespace Exiv2 { std::string key = "Exif." + primaryGroup() + ".Compression"; auto md = exifData_.findKey(ExifKey(key)); if (md != exifData_.end() && md->count() > 0) { - const MimeTypeList* i = find(mimeTypeList, static_cast(md->toLong())); + const MimeTypeList* i = find(mimeTypeList, static_cast(md->toInt64())); if (i) mimeType_ = std::string(i->mimeType_); } return mimeType_; @@ -124,7 +124,7 @@ namespace Exiv2 { for (auto&& i : keys) { auto md = exifData_.findKey(ExifKey(i)); // Is it the primary image? - if (md != exifData_.end() && md->count() > 0 && md->toLong() == 0) { + if (md != exifData_.end() && md->count() > 0 && md->toInt64() == 0) { // Sometimes there is a JPEG primary image; that's not our first choice primaryGroup_ = md->groupName(); std::string key = "Exif." + primaryGroup_ + ".JPEGInterchangeFormat"; @@ -143,7 +143,7 @@ namespace Exiv2 { ExifKey key(std::string("Exif.") + primaryGroup() + std::string(".ImageWidth")); auto imageWidth = exifData_.findKey(key); if (imageWidth != exifData_.end() && imageWidth->count() > 0) { - pixelWidthPrimary_ = static_cast(imageWidth->toLong()); + pixelWidthPrimary_ = imageWidth->toInt64(); } return pixelWidthPrimary_; } @@ -157,7 +157,7 @@ namespace Exiv2 { ExifKey key(std::string("Exif.") + primaryGroup() + std::string(".ImageLength")); auto imageHeight = exifData_.findKey(key); if (imageHeight != exifData_.end() && imageHeight->count() > 0) { - pixelHeightPrimary_ = imageHeight->toLong(); + pixelHeightPrimary_ = imageHeight->toInt64(); } return pixelHeightPrimary_; } diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index e9faf6fc65..229d691091 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -997,7 +997,7 @@ namespace Exiv2 { uint32_t sizeTotal = 0; object->strips_.clear(); for (long i = 0; i < pos->count(); ++i) { - uint32_t len = pos->toLong(i); + uint32_t len = pos->toInt64(i); object->strips_.emplace_back(zero, len); sizeTotal += len; } diff --git a/src/xmp.cpp b/src/xmp.cpp index 2fe61d7a8d..c3baa081f5 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -403,9 +403,9 @@ namespace Exiv2 { return p_->value_.get() == nullptr ? "" : p_->value_->toString(n); } - long Xmpdatum::toLong(long n) const + int64_t Xmpdatum::toInt64(long n) const { - return p_->value_.get() == nullptr ? -1 : static_cast(p_->value_->toInt64(n)); + return p_->value_.get() == nullptr ? -1 : p_->value_->toInt64(n); } float Xmpdatum::toFloat(long n) const