From 818a99a8707fc9b69530fc4809d654f5edce6b2e Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 21 Mar 2024 16:18:18 +0000 Subject: [PATCH] Review --- components/esm3/esmreader.cpp | 10 +++++----- components/esm3/esmreader.hpp | 6 +++--- components/esm3/loadland.cpp | 4 ++-- components/esm3/loadlevlist.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/esm3/esmreader.cpp b/components/esm3/esmreader.cpp index 92a04fb487..c52e739f5f 100644 --- a/components/esm3/esmreader.cpp +++ b/components/esm3/esmreader.cpp @@ -244,16 +244,16 @@ namespace ESM skipHString(); } - void ESMReader::getHExact(void* p, int size) + void ESMReader::getHExact(void* p, std::size_t size) { getSubHeader(); - if (size != static_cast(mCtx.leftSub)) + if (size != mCtx.leftSub) reportSubSizeMismatch(size, mCtx.leftSub); getExact(p, size); } // Read the given number of bytes from a named subrecord - void ESMReader::getHNExact(void* p, int size, NAME name) + void ESMReader::getHNExact(void* p, std::size_t size, NAME name) { getSubNameIs(name); getHExact(p, size); @@ -326,10 +326,10 @@ namespace ESM skip(mCtx.leftSub); } - void ESMReader::skipHSubSize(int size) + void ESMReader::skipHSubSize(std::size_t size) { skipHSub(); - if (static_cast(mCtx.leftSub) != size) + if (mCtx.leftSub != size) reportSubSizeMismatch(mCtx.leftSub, size); } diff --git a/components/esm3/esmreader.hpp b/components/esm3/esmreader.hpp index 7d0b9b980c..b67cc0f8bb 100644 --- a/components/esm3/esmreader.hpp +++ b/components/esm3/esmreader.hpp @@ -238,10 +238,10 @@ namespace ESM void skipHRefId(); // Read the given number of bytes from a subrecord - void getHExact(void* p, int size); + void getHExact(void* p, std::size_t size); // Read the given number of bytes from a named subrecord - void getHNExact(void* p, int size, NAME name); + void getHNExact(void* p, std::size_t size, NAME name); ESM::FormId getFormId(bool wide = false, NAME tag = "FRMR"); @@ -275,7 +275,7 @@ namespace ESM void skipHSub(); // Skip sub record and check its size - void skipHSubSize(int size); + void skipHSubSize(std::size_t size); // Skip all subrecords until the given subrecord or no more subrecords remaining void skipHSubUntil(NAME name); diff --git a/components/esm3/loadland.cpp b/components/esm3/loadland.cpp index 006510f21b..8b8a8f90fa 100644 --- a/components/esm3/loadland.cpp +++ b/components/esm3/loadland.cpp @@ -25,7 +25,7 @@ namespace ESM // Loads data and marks it as loaded. Return true if data is actually loaded from reader, false otherwise // including the case when data is already loaded. - bool condLoad(ESMReader& reader, int flags, int& targetFlags, int dataFlag, void* ptr, unsigned int size) + bool condLoad(ESMReader& reader, int flags, int& targetFlags, int dataFlag, void* ptr, std::size_t size) { if ((targetFlags & dataFlag) == 0 && (flags & dataFlag) != 0) { @@ -94,7 +94,7 @@ namespace ESM mDataTypes |= DATA_VHGT; break; case fourCC("WNAM"): - esm.getHExact(mWnam.data(), static_cast(mWnam.size())); + esm.getHExact(mWnam.data(), mWnam.size()); mDataTypes |= DATA_WNAM; break; case fourCC("VCLR"): diff --git a/components/esm3/loadlevlist.cpp b/components/esm3/loadlevlist.cpp index 766fd42054..f37009d6f9 100644 --- a/components/esm3/loadlevlist.cpp +++ b/components/esm3/loadlevlist.cpp @@ -87,7 +87,7 @@ namespace ESM esm.writeHNT("DATA", mFlags); esm.writeHNT("NNAM", mChanceNone); - esm.writeHNT("INDX", static_cast(mList.size())); + esm.writeHNT("INDX", static_cast(mList.size())); for (const auto& item : mList) {