From 7b9ba51c4ee98fae2c10acb3d1cdffcaebc9791b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 3 Aug 2022 16:13:24 -0700 Subject: [PATCH] enum class conversion Signed-off-by: Rosen Penev --- src/crwimage_int.cpp | 16 ++++++++-------- src/crwimage_int.hpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index e58d66c1..b1c9ac28 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -185,7 +185,7 @@ void CiffComponent::doRead(const byte* pData, size_t size, uint32_t start, ByteO DataLocId dl = dataLocation(); - if (dl == valueData) { + if (dl == DataLocId::valueData) { size_ = getULong(pData + start + 2, byteOrder); offset_ = getULong(pData + start + 6, byteOrder); @@ -204,7 +204,7 @@ void CiffComponent::doRead(const byte* pData, size_t size, uint32_t start, ByteO enforce(size_ <= size - offset_, ErrorCode::kerOffsetOutOfRange); } } - if (dl == directoryData) { + if (dl == DataLocId::directoryData) { size_ = 8; offset_ = start + 2; } @@ -316,7 +316,7 @@ size_t CiffEntry::doWrite(Blob& blob, ByteOrder /*byteOrder*/, size_t offset) { } size_t CiffComponent::writeValueData(Blob& blob, size_t offset) { - if (dataLocation() == valueData) { + if (dataLocation() == DataLocId::valueData) { #ifdef EXIV2_DEBUG_MESSAGES std::cout << " Data for tag 0x" << std::hex << tagId() << ", " << std::dec << size_ << " Bytes\n"; #endif @@ -382,7 +382,7 @@ void CiffComponent::writeDirEntry(Blob& blob, ByteOrder byteOrder) const { DataLocId dl = dataLocation(); - if (dl == valueData) { + if (dl == DataLocId::valueData) { us2Data(buf, tag_, byteOrder); append(blob, buf, 2); @@ -393,7 +393,7 @@ void CiffComponent::writeDirEntry(Blob& blob, ByteOrder byteOrder) const { append(blob, buf, 4); } - if (dl == directoryData) { + if (dl == DataLocId::directoryData) { // Only 8 bytes fit in the directory entry us2Data(buf, tag_, byteOrder); @@ -437,7 +437,7 @@ void CiffComponent::setValue(DataBuf&& buf) { storage_ = std::move(buf); pData_ = storage_.c_data(); size_ = storage_.size(); - if (size_ > 8 && dataLocation() == directoryData) { + if (size_ > 8 && dataLocation() == DataLocId::directoryData) { tag_ &= 0x3fff; } } @@ -464,9 +464,9 @@ TypeId CiffComponent::typeId(uint16_t tag) { DataLocId CiffComponent::dataLocation(uint16_t tag) { switch (tag & 0xc000) { case 0x0000: - return valueData; + return DataLocId::valueData; case 0x4000: - return directoryData; + return DataLocId::directoryData; default: throw Error(ErrorCode::kerCorruptedMetadata); } diff --git a/src/crwimage_int.hpp b/src/crwimage_int.hpp index 635a2f54..15917e34 100644 --- a/src/crwimage_int.hpp +++ b/src/crwimage_int.hpp @@ -35,7 +35,7 @@ using CrwEncodeFct = std::function; //! Type to identify where the data is stored in a directory -enum DataLocId { valueData, directoryData, lastDataLocId }; +enum class DataLocId { valueData, directoryData, lastDataLocId }; // ***************************************************************************** // class definitions