IProperty: Make use of size_t where applicable

This commit is contained in:
Lioncash
2020-06-21 19:25:51 -04:00
parent 48d0ae5e10
commit ebd1468bbf
8 changed files with 39 additions and 33 deletions

View File

@@ -180,7 +180,7 @@ void CScriptCooker::WriteProperty(IOutputStream& rOut, IProperty* pProperty, voi
auto* pStruct = TPropCast<CStructProperty>(pProperty);
std::vector<IProperty*> PropertiesToWrite;
for (uint32 ChildIdx = 0; ChildIdx < pStruct->NumChildren(); ChildIdx++)
for (size_t ChildIdx = 0; ChildIdx < pStruct->NumChildren(); ChildIdx++)
{
IProperty *pChild = pStruct->ChildByIndex(ChildIdx);

View File

@@ -268,7 +268,7 @@ void CScriptLoader::LoadStructMP1(IInputStream& rSCLY, CStructProperty* pStruct)
[[maybe_unused]] const uint32 StructStart = rSCLY.Tell();
// Verify property count
const uint32 PropertyCount = pStruct->NumChildren();
const size_t PropertyCount = pStruct->NumChildren();
[[maybe_unused]] uint32 Version = 0;
if (!pStruct->IsAtomic())
@@ -278,7 +278,7 @@ void CScriptLoader::LoadStructMP1(IInputStream& rSCLY, CStructProperty* pStruct)
}
// Parse properties
for (uint32 ChildIndex = 0; ChildIndex < PropertyCount; ChildIndex++)
for (size_t ChildIndex = 0; ChildIndex < PropertyCount; ChildIndex++)
{
IProperty *pProperty = pStruct->ChildByIndex(ChildIndex);
@@ -363,13 +363,13 @@ std::unique_ptr<CScriptLayer> CScriptLoader::LoadLayerMP1(IInputStream& rSCLY)
void CScriptLoader::LoadStructMP2(IInputStream& rSCLY, CStructProperty* pStruct)
{
// Verify property count
uint32 ChildCount = pStruct->NumChildren();
size_t ChildCount = pStruct->NumChildren();
if (!pStruct->IsAtomic())
ChildCount = rSCLY.ReadUShort();
// Parse properties
for (uint32 ChildIdx = 0; ChildIdx < ChildCount; ChildIdx++)
for (size_t ChildIdx = 0; ChildIdx < ChildCount; ChildIdx++)
{
IProperty* pProperty = nullptr;
const uint32 PropertyStart = rSCLY.Tell();

View File

@@ -177,11 +177,11 @@ void CStructProperty::InitFromArchetype(IProperty* pOther)
// Copy children
_ClearChildren();
mChildren.reserve( pOther->NumChildren() );
mChildren.reserve(pOther->NumChildren());
for (uint32 ChildIdx = 0; ChildIdx < pOther->NumChildren(); ChildIdx++)
for (size_t ChildIdx = 0; ChildIdx < pOther->NumChildren(); ChildIdx++)
{
IProperty* pChild = CreateCopy( pOther->ChildByIndex(ChildIdx) );
IProperty* pChild = CreateCopy(pOther->ChildByIndex(ChildIdx));
mChildren.push_back(pChild);
}
}

View File

@@ -208,11 +208,11 @@ public:
/** Accessors */
EGame Game() const;
ECookPreference CookPreference() const { return mCookPreference; }
uint32 NumChildren() const { return mChildren.size(); }
size_t NumChildren() const { return mChildren.size(); }
IProperty* ChildByIndex(uint32 ChildIndex) const
IProperty* ChildByIndex(size_t ChildIndex) const
{
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
ASSERT(ChildIndex < mChildren.size());
return mChildren[ChildIndex];
}
@@ -278,17 +278,17 @@ public:
static IProperty* CreateCopy(IProperty* pArchetype);
static IProperty* CreateIntrinsic(EPropertyType Type,
EGame Game,
uint32 Offset,
const TString& rkName);
EGame Game,
uint32 Offset,
const TString& rkName);
static IProperty* CreateIntrinsic(EPropertyType Type,
IProperty* pParent,
uint32 Offset,
const TString& rkName);
IProperty* pParent,
uint32 Offset,
const TString& rkName);
static IProperty* ArchiveConstructor(EPropertyType Type,
const IArchive& Arc);
const IArchive& Arc);
};
template<typename PropType, EPropertyType PropEnum>