From 487f2ae176345e451efa801a70b8c4efbeb26cbf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 19 Jun 2020 23:54:08 -0400 Subject: [PATCH] CSkinLoader: Make use of unsigned stream helpers where applicable Less implicit sign conversions --- src/Core/Resource/Factory/CSkinLoader.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Core/Resource/Factory/CSkinLoader.cpp b/src/Core/Resource/Factory/CSkinLoader.cpp index 2ed3f5de..0219be13 100644 --- a/src/Core/Resource/Factory/CSkinLoader.cpp +++ b/src/Core/Resource/Factory/CSkinLoader.cpp @@ -4,29 +4,31 @@ // ************ STATIC ************ std::unique_ptr CSkinLoader::LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry) { - if (!rCSKR.IsValid()) return nullptr; + if (!rCSKR.IsValid()) + return nullptr; + auto pSkin = std::make_unique(pEntry); // We don't support MP3/DKCR CSKR yet if (rCSKR.PeekLong() == FOURCC('SKIN')) return pSkin; - uint32 NumVertexGroups = rCSKR.ReadLong(); + const uint32 NumVertexGroups = rCSKR.ReadULong(); pSkin->mVertGroups.resize(NumVertexGroups); - for (uint32 iGrp = 0; iGrp < NumVertexGroups; iGrp++) + for (size_t iGrp = 0; iGrp < NumVertexGroups; iGrp++) { CSkin::SVertGroup& rGroup = pSkin->mVertGroups[iGrp]; - uint32 NumWeights = rCSKR.ReadLong(); + const uint32 NumWeights = rCSKR.ReadULong(); ASSERT(NumWeights <= 4); - for (uint32 iWgt = 0; iWgt < NumWeights; iWgt++) + for (size_t iWgt = 0; iWgt < NumWeights; iWgt++) { - rGroup.Weights.Indices[iWgt] = (uint8) rCSKR.ReadLong(); + rGroup.Weights.Indices[iWgt] = static_cast(rCSKR.ReadULong()); rGroup.Weights.Weights[iWgt] = rCSKR.ReadFloat(); } - rGroup.NumVertices = rCSKR.ReadLong(); + rGroup.NumVertices = rCSKR.ReadULong(); } return pSkin;