From 5508e6f46679e67e7e96104822efb1d8a41634cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Mon, 7 Mar 2022 17:46:12 +0100 Subject: [PATCH] hexdump to size_t --- app/actions.cpp | 2 +- include/exiv2/types.hpp | 2 +- src/tiffcomposite_int.cpp | 5 ++--- src/types.cpp | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index d33205e2..75e2383b 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -571,7 +571,7 @@ namespace Action { std::cout << std::endl; Exiv2::DataBuf buf(md.size()); md.copy(buf.data(), pImage->byteOrder()); - Exiv2::hexdump(std::cout, buf.c_data(), static_cast(buf.size())); + Exiv2::hexdump(std::cout, buf.c_data(), buf.size()); } std::cout << std::endl; return true; diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 82ea5dfc..acb74c95 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -320,7 +320,7 @@ namespace Exiv2 { stream, prefixed with the position in the buffer adjusted by offset. */ - EXIV2API void hexdump(std::ostream& os, const byte* buf, long len, long offset = 0); + EXIV2API void hexdump(std::ostream& os, const byte* buf, size_t len, size_t offset = 0); /*! @brief Return true if str is a hex number starting with prefix followed diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index e192da1a..27b8f068 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -282,9 +282,8 @@ namespace Exiv2::Internal { memset(pData_, 0x0, size_); } size_ = value->copy(pData_, byteOrder); - assert(size_ == newSize); setValue(std::move(value)); - } // TiffEntryBase::updateValue + } void TiffEntryBase::setValue(Value::UniquePtr value) { @@ -294,7 +293,7 @@ namespace Exiv2::Internal { count_ = value->count(); delete pValue_; pValue_ = value.release(); - } // TiffEntryBase::setValue + } void TiffDataEntry::setStrips(const Value* pSize, const byte* pData, diff --git a/src/types.cpp b/src/types.cpp index 8f6ba372..97e65b37 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -540,13 +540,13 @@ namespace Exiv2 { return 8; } - void hexdump(std::ostream& os, const byte* buf, long len, long offset) + void hexdump(std::ostream& os, const byte* buf, size_t len, size_t offset) { const std::string::size_type pos = 8 + 16 * 3 + 2; const std::string align(pos, ' '); std::ios::fmtflags f( os.flags() ); - long i = 0; + size_t i = 0; while (i < len) { os << " " << std::setw(4) << std::setfill('0') << std::hex @@ -562,7 +562,7 @@ namespace Exiv2 { } os << std::dec << std::setfill(' '); os.flags(f); - } // hexdump + } bool isHex(const std::string& str, size_t size, const std::string& prefix) {