From ecff1a7a2b1733b0e1651d53bd45e50c3950e40d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 28 Jun 2020 01:04:20 -0400 Subject: [PATCH] CSectionMgrIn: Make use of size_t where applicable --- src/Core/Resource/Factory/CAreaLoader.cpp | 2 +- src/Core/Resource/Factory/CSectionMgrIn.h | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Core/Resource/Factory/CAreaLoader.cpp b/src/Core/Resource/Factory/CAreaLoader.cpp index 0c493b68..ba9711b2 100644 --- a/src/Core/Resource/Factory/CAreaLoader.cpp +++ b/src/Core/Resource/Factory/CAreaLoader.cpp @@ -580,7 +580,7 @@ void CAreaLoader::LoadSectionDataBuffers() mpArea->mSectionDataBuffers.resize(mpSectionMgr->NumSections()); mpSectionMgr->ToSection(0); - for (uint32 iSec = 0; iSec < mpSectionMgr->NumSections(); iSec++) + for (size_t iSec = 0; iSec < mpSectionMgr->NumSections(); iSec++) { const uint32 Size = mpSectionMgr->CurrentSectionSize(); mpArea->mSectionDataBuffers[iSec].resize(Size); diff --git a/src/Core/Resource/Factory/CSectionMgrIn.h b/src/Core/Resource/Factory/CSectionMgrIn.h index 27556e9a..81470cac 100644 --- a/src/Core/Resource/Factory/CSectionMgrIn.h +++ b/src/Core/Resource/Factory/CSectionMgrIn.h @@ -15,13 +15,11 @@ class CSectionMgrIn uint32 mSecsStart = 0; public: - CSectionMgrIn(uint32 Count, IInputStream* pSrc) - : mpInputStream(pSrc) + CSectionMgrIn(size_t Count, IInputStream* pSrc) + : mpInputStream(pSrc), mSectionSizes(Count) { - mSectionSizes.resize(Count); - - for (uint32 iSec = 0; iSec < Count; iSec++) - mSectionSizes[iSec] = pSrc->ReadLong(); + for (auto& size : mSectionSizes) + size = pSrc->ReadULong(); } void Init() @@ -53,7 +51,7 @@ public: uint32 NextOffset() const { return mCurSecStart + mSectionSizes[mCurSec]; } uint32 CurrentSection() const { return mCurSec; } uint32 CurrentSectionSize() const { return mSectionSizes[mCurSec]; } - uint32 NumSections() const { return mSectionSizes.size(); } + size_t NumSections() const { return mSectionSizes.size(); } void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; } };