refactor: fix remaining x64 compilation issues

This commit is contained in:
Jan 2025-04-26 12:38:43 +01:00 committed by Jan Laupetin
parent a6107e24a2
commit 365b627523
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
20 changed files with 128 additions and 123 deletions

View File

@ -56,8 +56,8 @@ namespace
void CreateFromString(const std::string& templateString) void CreateFromString(const std::string& templateString)
{ {
const auto templateStringLength = templateString.size(); const auto templateStringLength = templateString.size();
auto partStart = 0u; auto partStart = 0uz;
for (auto i = 0u; i < templateStringLength; i++) for (auto i = 0uz; i < templateStringLength; i++)
{ {
if (templateString[i] != '?') if (templateString[i] != '?')
continue; continue;

View File

@ -126,10 +126,10 @@ namespace
bone.globalOffset[1] = model->baseMat[boneNum].trans[1]; bone.globalOffset[1] = model->baseMat[boneNum].trans[1];
bone.globalOffset[2] = model->baseMat[boneNum].trans[2]; bone.globalOffset[2] = model->baseMat[boneNum].trans[2];
bone.globalRotation = { bone.globalRotation = {
model->baseMat[boneNum].quat[0], .x = model->baseMat[boneNum].quat[0],
model->baseMat[boneNum].quat[1], .y = model->baseMat[boneNum].quat[1],
model->baseMat[boneNum].quat[2], .z = model->baseMat[boneNum].quat[2],
model->baseMat[boneNum].quat[3], .w = model->baseMat[boneNum].quat[3],
}; };
if (boneNum < model->numRootBones) if (boneNum < model->numRootBones)
@ -137,7 +137,7 @@ namespace
bone.localOffset[0] = 0; bone.localOffset[0] = 0;
bone.localOffset[1] = 0; bone.localOffset[1] = 0;
bone.localOffset[2] = 0; bone.localOffset[2] = 0;
bone.localRotation = {0, 0, 0, 1}; bone.localRotation = {.x = 0, .y = 0, .z = 0, .w = 1};
} }
else else
{ {
@ -145,10 +145,10 @@ namespace
bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1];
bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2];
bone.localRotation = { bone.localRotation = {
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), .x = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), .y = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), .z = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]), .w = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]),
}; };
} }
@ -166,7 +166,7 @@ namespace
void AddXModelMaterials(XModelCommon& out, DistinctMapper<Material*>& materialMapper, const XModel* model) void AddXModelMaterials(XModelCommon& out, DistinctMapper<Material*>& materialMapper, const XModel* model)
{ {
for (auto surfaceMaterialNum = 0; surfaceMaterialNum < model->numsurfs; surfaceMaterialNum++) for (auto surfaceMaterialNum = 0u; surfaceMaterialNum < model->numsurfs; surfaceMaterialNum++)
{ {
Material* material = model->materialHandles[surfaceMaterialNum]; Material* material = model->materialHandles[surfaceMaterialNum];
if (materialMapper.Add(material)) if (materialMapper.Add(material))
@ -271,7 +271,7 @@ namespace
const auto surfCount = model->lodInfo[lod].numsurfs; const auto surfCount = model->lodInfo[lod].numsurfs;
auto& weightCollection = out.m_bone_weight_data; auto& weightCollection = out.m_bone_weight_data;
size_t weightOffset = 0u; auto weightOffset = 0u;
for (auto surfIndex = 0u; surfIndex < surfCount; surfIndex++) for (auto surfIndex = 0u; surfIndex < surfCount; surfIndex++)
{ {
@ -285,7 +285,8 @@ namespace
const auto& vertList = surface.vertList[vertListIndex]; const auto& vertList = surface.vertList[vertListIndex];
const auto boneWeightOffset = weightOffset; const auto boneWeightOffset = weightOffset;
weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; weightCollection.weights[weightOffset++] =
XModelBoneWeight{.boneIndex = static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), .weight = 1.0f};
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
{ {
@ -303,7 +304,7 @@ namespace
{ {
const auto boneWeightOffset = weightOffset; const auto boneWeightOffset = weightOffset;
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat); const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = 1.0f};
vertsBlendOffset += 1; vertsBlendOffset += 1;
@ -319,8 +320,8 @@ namespace
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
const auto boneWeight0 = 1.0f - boneWeight1; const auto boneWeight0 = 1.0f - boneWeight1;
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex1, .weight = boneWeight1};
vertsBlendOffset += 3; vertsBlendOffset += 3;
@ -338,9 +339,9 @@ namespace
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex1, .weight = boneWeight1};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex2, .weight = boneWeight2};
vertsBlendOffset += 5; vertsBlendOffset += 5;
@ -360,10 +361,10 @@ namespace
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex1, .weight = boneWeight1};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex2, .weight = boneWeight2};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex3, .weight = boneWeight3};
vertsBlendOffset += 7; vertsBlendOffset += 7;

View File

@ -121,10 +121,10 @@ namespace
bone.globalOffset[1] = model->baseMat[boneNum].trans[1]; bone.globalOffset[1] = model->baseMat[boneNum].trans[1];
bone.globalOffset[2] = model->baseMat[boneNum].trans[2]; bone.globalOffset[2] = model->baseMat[boneNum].trans[2];
bone.globalRotation = { bone.globalRotation = {
model->baseMat[boneNum].quat[0], .x = model->baseMat[boneNum].quat[0],
model->baseMat[boneNum].quat[1], .y = model->baseMat[boneNum].quat[1],
model->baseMat[boneNum].quat[2], .z = model->baseMat[boneNum].quat[2],
model->baseMat[boneNum].quat[3], .w = model->baseMat[boneNum].quat[3],
}; };
if (boneNum < model->numRootBones) if (boneNum < model->numRootBones)
@ -132,7 +132,7 @@ namespace
bone.localOffset[0] = 0; bone.localOffset[0] = 0;
bone.localOffset[1] = 0; bone.localOffset[1] = 0;
bone.localOffset[2] = 0; bone.localOffset[2] = 0;
bone.localRotation = {0, 0, 0, 1}; bone.localRotation = {.x = 0, .y = 0, .z = 0, .w = 1};
} }
else else
{ {
@ -140,10 +140,10 @@ namespace
bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1]; bone.localOffset[1] = model->trans[boneNum - model->numRootBones][1];
bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2]; bone.localOffset[2] = model->trans[boneNum - model->numRootBones][2];
bone.localRotation = { bone.localRotation = {
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]), .x = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][0]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]), .y = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][1]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]), .z = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][2]),
QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]), .w = QuatInt16::ToFloat(model->quats[boneNum - model->numRootBones][3]),
}; };
} }
@ -161,7 +161,7 @@ namespace
void AddXModelMaterials(XModelCommon& out, DistinctMapper<Material*>& materialMapper, const XModel* model) void AddXModelMaterials(XModelCommon& out, DistinctMapper<Material*>& materialMapper, const XModel* model)
{ {
for (auto surfaceMaterialNum = 0; surfaceMaterialNum < model->numsurfs; surfaceMaterialNum++) for (auto surfaceMaterialNum = 0u; surfaceMaterialNum < model->numsurfs; surfaceMaterialNum++)
{ {
Material* material = model->materialHandles[surfaceMaterialNum]; Material* material = model->materialHandles[surfaceMaterialNum];
if (materialMapper.Add(material)) if (materialMapper.Add(material))
@ -254,7 +254,7 @@ namespace
void AddXModelVertexBoneWeights(XModelCommon& out, const XModelSurfs* modelSurfs) void AddXModelVertexBoneWeights(XModelCommon& out, const XModelSurfs* modelSurfs)
{ {
auto& weightCollection = out.m_bone_weight_data; auto& weightCollection = out.m_bone_weight_data;
size_t weightOffset = 0u; auto weightOffset = 0u;
for (auto surfIndex = 0u; surfIndex < modelSurfs->numsurfs; surfIndex++) for (auto surfIndex = 0u; surfIndex < modelSurfs->numsurfs; surfIndex++)
{ {
@ -268,11 +268,12 @@ namespace
const auto& vertList = surface.vertList[vertListIndex]; const auto& vertList = surface.vertList[vertListIndex];
const auto boneWeightOffset = weightOffset; const auto boneWeightOffset = weightOffset;
weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f}; weightCollection.weights[weightOffset++] =
XModelBoneWeight{.boneIndex = static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), .weight = 1.0f};
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++) for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
{ {
out.m_vertex_bone_weights.emplace_back(boneWeightOffset, 1); out.m_vertex_bone_weights.emplace_back(boneWeightOffset, 1u);
} }
handledVertices += vertList.vertCount; handledVertices += vertList.vertCount;
} }
@ -286,7 +287,7 @@ namespace
{ {
const auto boneWeightOffset = weightOffset; const auto boneWeightOffset = weightOffset;
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat); const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = 1.0f};
vertsBlendOffset += 1; vertsBlendOffset += 1;
@ -302,8 +303,8 @@ namespace
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]); const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
const auto boneWeight0 = 1.0f - boneWeight1; const auto boneWeight0 = 1.0f - boneWeight1;
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex1, .weight = boneWeight1};
vertsBlendOffset += 3; vertsBlendOffset += 3;
@ -321,9 +322,9 @@ namespace
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]); const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2; const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex1, .weight = boneWeight1};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex2, .weight = boneWeight2};
vertsBlendOffset += 5; vertsBlendOffset += 5;
@ -343,10 +344,10 @@ namespace
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]); const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3; const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, boneWeight0}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = boneWeight0};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex1, boneWeight1}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex1, .weight = boneWeight1};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex2, boneWeight2}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex2, .weight = boneWeight2};
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex3, boneWeight3}; weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex3, .weight = boneWeight3};
vertsBlendOffset += 7; vertsBlendOffset += 7;

View File

@ -271,13 +271,13 @@ void MenuDumper::WriteStatementSkipInitialUnnecessaryParenthesis(const Statement
void MenuDumper::WriteStatementNaive(const Statement_s* statement) const void MenuDumper::WriteStatementNaive(const Statement_s* statement) const
{ {
const auto entryCount = static_cast<unsigned>(statement->numEntries); const auto entryCount = static_cast<size_t>(statement->numEntries);
const auto missingClosingParenthesis = statement->numEntries > 0 && statement->entries[0].type == EET_OPERATOR const auto missingClosingParenthesis = statement->numEntries > 0 && statement->entries[0].type == EET_OPERATOR
&& statement->entries[0].data.op == OP_LEFTPAREN && statement->entries[0].data.op == OP_LEFTPAREN
&& FindStatementClosingParenthesis(statement, 0) >= static_cast<size_t>(statement->numEntries); && FindStatementClosingParenthesis(statement, 0) >= static_cast<size_t>(statement->numEntries);
for (auto i = 0u; i < entryCount; i++) for (auto i = 0uz; i < entryCount; i++)
{ {
const auto& entry = statement->entries[i]; const auto& entry = statement->entries[i];
if (entry.type == EET_OPERAND) if (entry.type == EET_OPERAND)
@ -314,7 +314,7 @@ void MenuDumper::WriteStatementNaive(const Statement_s* statement) const
const auto closingParenPos = FindStatementClosingParenthesis(statement, i); const auto closingParenPos = FindStatementClosingParenthesis(statement, i);
m_stream << "("; m_stream << "(";
if (closingParenPos - i + 1 >= 1) if (closingParenPos - i + 1u >= 1u)
{ {
const auto& staticDvarEntry = statement->entries[i + 1]; const auto& staticDvarEntry = statement->entries[i + 1];
if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT) if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT)

View File

@ -240,7 +240,7 @@ void MenuDumper::WriteStatementEntryRange(const Statement_s* statement, size_t s
void MenuDumper::WriteStatementNaive(const Statement_s* statement) const void MenuDumper::WriteStatementNaive(const Statement_s* statement) const
{ {
const auto entryCount = static_cast<unsigned>(statement->numEntries); const auto entryCount = static_cast<unsigned>(statement->numEntries);
for (auto i = 0u; i < entryCount; i++) for (auto i = 0uz; i < entryCount; i++)
{ {
const auto& entry = statement->entries[i]; const auto& entry = statement->entries[i];
if (entry.type == EET_OPERAND) if (entry.type == EET_OPERAND)
@ -277,9 +277,9 @@ void MenuDumper::WriteStatementNaive(const Statement_s* statement) const
const auto closingParenPos = FindStatementClosingParenthesis(statement, i); const auto closingParenPos = FindStatementClosingParenthesis(statement, i);
m_stream << "("; m_stream << "(";
if (closingParenPos - i + 1 >= 1) if (closingParenPos - i + 1u >= 1u)
{ {
const auto& staticDvarEntry = statement->entries[i + 1]; const auto& staticDvarEntry = statement->entries[i + 1u];
if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT) if (staticDvarEntry.type == EET_OPERAND && staticDvarEntry.data.operand.dataType == VAL_INT)
{ {
if (statement->supportingData && statement->supportingData->staticDvarList.staticDvars && staticDvarEntry.data.operand.internals.intVal >= 0 if (statement->supportingData && statement->supportingData->staticDvarList.staticDvars && staticDvarEntry.data.operand.internals.intVal >= 0

View File

@ -297,12 +297,12 @@ class XModelBinWriter7 final : public XModelBinWriterBase
void WriteFaces(const XModelCommon& xmodel) void WriteFaces(const XModelCommon& xmodel)
{ {
auto totalFaceCount = 0u; auto totalFaceCount = 0uz;
for (const auto& object : xmodel.m_objects) for (const auto& object : xmodel.m_objects)
totalFaceCount += object.m_faces.size(); totalFaceCount += object.m_faces.size();
XModelBinWriterBase::Write(static_cast<uint32_t>(XModelBinHash::FACE_COUNT)); XModelBinWriterBase::Write(static_cast<uint32_t>(XModelBinHash::FACE_COUNT));
XModelBinWriterBase::Write(totalFaceCount); XModelBinWriterBase::Write(static_cast<uint32_t>(totalFaceCount));
auto objectIndex = 0u; auto objectIndex = 0u;
for (const auto& object : xmodel.m_objects) for (const auto& object : xmodel.m_objects)

View File

@ -122,11 +122,11 @@ class XModelExportWriter6 final : public XModelExportWriterBase
void WriteFaces(const XModelCommon& xmodel) const void WriteFaces(const XModelCommon& xmodel) const
{ {
auto totalFaceCount = 0u; auto totalFaceCount = 0uz;
for (const auto& object : xmodel.m_objects) for (const auto& object : xmodel.m_objects)
totalFaceCount += object.m_faces.size(); totalFaceCount += object.m_faces.size();
m_stream << "NUMFACES " << totalFaceCount << "\n"; m_stream << std::format("NUMFACES {}\n", totalFaceCount);
auto objectIndex = 0u; auto objectIndex = 0u;
for (const auto& object : xmodel.m_objects) for (const auto& object : xmodel.m_objects)

View File

@ -343,7 +343,7 @@ namespace GAME_NAMESPACE
if (!surfs) if (!surfs)
return; return;
size_t weightOffset = 0u; auto weightOffset = 0u;
for (auto surfIndex = 0u; surfIndex < surfCount; surfIndex++) for (auto surfIndex = 0u; surfIndex < surfCount; surfIndex++)
{ {

View File

@ -64,7 +64,7 @@ void BinOutput::EmitJson(const nlohmann::json& json) const
void BinOutput::EmitBuffer(const void* buffer, const size_t bufferSize) const void BinOutput::EmitBuffer(const void* buffer, const size_t bufferSize) const
{ {
const auto chunkLength = utils::Align<uint32_t>(bufferSize, 4u); const auto chunkLength = utils::Align<uint32_t>(static_cast<uint32_t>(bufferSize), 4u);
Write(&chunkLength, sizeof(chunkLength)); Write(&chunkLength, sizeof(chunkLength));
Write(&CHUNK_MAGIC_BIN, sizeof(CHUNK_MAGIC_BIN)); Write(&CHUNK_MAGIC_BIN, sizeof(CHUNK_MAGIC_BIN));

View File

@ -74,7 +74,7 @@ namespace
if (!gltf.nodes.has_value()) if (!gltf.nodes.has_value())
gltf.nodes.emplace(); gltf.nodes.emplace();
m_first_mesh_node = gltf.nodes->size(); m_first_mesh_node = static_cast<unsigned>(gltf.nodes->size());
auto meshIndex = 0u; auto meshIndex = 0u;
for (const auto& object : xmodel.m_objects) for (const auto& object : xmodel.m_objects)
@ -123,7 +123,7 @@ namespace
rootNode.children->push_back(m_first_bone_node); rootNode.children->push_back(m_first_bone_node);
m_root_node = gltf.nodes->size(); m_root_node = static_cast<unsigned>(gltf.nodes->size());
gltf.nodes->emplace_back(std::move(rootNode)); gltf.nodes->emplace_back(std::move(rootNode));
} }
@ -211,12 +211,12 @@ namespace
JsonImage image; JsonImage image;
image.uri = std::move(uri); image.uri = std::move(uri);
const auto imageIndex = gltf.images->size(); const auto imageIndex = static_cast<unsigned>(gltf.images->size());
gltf.images->emplace_back(std::move(image)); gltf.images->emplace_back(std::move(image));
JsonTexture texture; JsonTexture texture;
texture.source = imageIndex; texture.source = imageIndex;
const auto textureIndex = gltf.textures->size(); const auto textureIndex = static_cast<unsigned>(gltf.textures->size());
gltf.textures->emplace_back(texture); gltf.textures->emplace_back(texture);
return textureIndex; return textureIndex;
@ -231,7 +231,7 @@ namespace
gltf.nodes.emplace(); gltf.nodes.emplace();
const auto boneCount = common.m_bones.size(); const auto boneCount = common.m_bones.size();
m_first_bone_node = gltf.nodes->size(); m_first_bone_node = static_cast<unsigned>(gltf.nodes->size());
for (auto boneIndex = 0u; boneIndex < boneCount; boneIndex++) for (auto boneIndex = 0u; boneIndex < boneCount; boneIndex++)
{ {
JsonNode boneNode; JsonNode boneNode;
@ -319,12 +319,12 @@ namespace
JsonBufferView vertexBufferView; JsonBufferView vertexBufferView;
vertexBufferView.buffer = 0u; vertexBufferView.buffer = 0u;
vertexBufferView.byteOffset = bufferOffset; vertexBufferView.byteOffset = bufferOffset;
vertexBufferView.byteStride = sizeof(GltfVertex); vertexBufferView.byteStride = static_cast<unsigned>(sizeof(GltfVertex));
vertexBufferView.byteLength = sizeof(GltfVertex) * xmodel.m_vertices.size(); vertexBufferView.byteLength = static_cast<unsigned>(sizeof(GltfVertex) * xmodel.m_vertices.size());
vertexBufferView.target = JsonBufferViewTarget::ARRAY_BUFFER; vertexBufferView.target = JsonBufferViewTarget::ARRAY_BUFFER;
bufferOffset += vertexBufferView.byteLength; bufferOffset += vertexBufferView.byteLength;
m_vertex_buffer_view = gltf.bufferViews->size(); m_vertex_buffer_view = static_cast<unsigned>(gltf.bufferViews->size());
gltf.bufferViews->emplace_back(vertexBufferView); gltf.bufferViews->emplace_back(vertexBufferView);
if (!xmodel.m_bone_weight_data.weights.empty()) if (!xmodel.m_bone_weight_data.weights.empty())
@ -332,40 +332,40 @@ namespace
JsonBufferView jointsBufferView; JsonBufferView jointsBufferView;
jointsBufferView.buffer = 0u; jointsBufferView.buffer = 0u;
jointsBufferView.byteOffset = bufferOffset; jointsBufferView.byteOffset = bufferOffset;
jointsBufferView.byteLength = sizeof(uint8_t) * xmodel.m_vertices.size() * 4u; jointsBufferView.byteLength = static_cast<unsigned>(sizeof(uint8_t) * xmodel.m_vertices.size() * 4u);
jointsBufferView.target = JsonBufferViewTarget::ARRAY_BUFFER; jointsBufferView.target = JsonBufferViewTarget::ARRAY_BUFFER;
bufferOffset += jointsBufferView.byteLength; bufferOffset += jointsBufferView.byteLength;
m_joints_buffer_view = gltf.bufferViews->size(); m_joints_buffer_view = static_cast<unsigned>(gltf.bufferViews->size());
gltf.bufferViews->emplace_back(jointsBufferView); gltf.bufferViews->emplace_back(jointsBufferView);
JsonBufferView weightsBufferView; JsonBufferView weightsBufferView;
weightsBufferView.buffer = 0u; weightsBufferView.buffer = 0u;
weightsBufferView.byteOffset = bufferOffset; weightsBufferView.byteOffset = bufferOffset;
weightsBufferView.byteLength = sizeof(float) * xmodel.m_vertices.size() * 4u; weightsBufferView.byteLength = static_cast<unsigned>(sizeof(float) * xmodel.m_vertices.size() * 4u);
weightsBufferView.target = JsonBufferViewTarget::ARRAY_BUFFER; weightsBufferView.target = JsonBufferViewTarget::ARRAY_BUFFER;
bufferOffset += weightsBufferView.byteLength; bufferOffset += weightsBufferView.byteLength;
m_weights_buffer_view = gltf.bufferViews->size(); m_weights_buffer_view = static_cast<unsigned>(gltf.bufferViews->size());
gltf.bufferViews->emplace_back(weightsBufferView); gltf.bufferViews->emplace_back(weightsBufferView);
JsonBufferView inverseBindMatricesBufferView; JsonBufferView inverseBindMatricesBufferView;
inverseBindMatricesBufferView.buffer = 0u; inverseBindMatricesBufferView.buffer = 0u;
inverseBindMatricesBufferView.byteOffset = bufferOffset; inverseBindMatricesBufferView.byteOffset = bufferOffset;
inverseBindMatricesBufferView.byteLength = sizeof(float) * xmodel.m_bones.size() * 16u; inverseBindMatricesBufferView.byteLength = static_cast<unsigned>(sizeof(float) * xmodel.m_bones.size() * 16u);
bufferOffset += inverseBindMatricesBufferView.byteLength; bufferOffset += inverseBindMatricesBufferView.byteLength;
m_inverse_bind_matrices_buffer_view = gltf.bufferViews->size(); m_inverse_bind_matrices_buffer_view = static_cast<unsigned>(gltf.bufferViews->size());
gltf.bufferViews->emplace_back(inverseBindMatricesBufferView); gltf.bufferViews->emplace_back(inverseBindMatricesBufferView);
} }
m_first_index_buffer_view = gltf.bufferViews->size(); m_first_index_buffer_view = static_cast<unsigned>(gltf.bufferViews->size());
for (const auto& object : xmodel.m_objects) for (const auto& object : xmodel.m_objects)
{ {
JsonBufferView indicesBufferView; JsonBufferView indicesBufferView;
indicesBufferView.buffer = 0u; indicesBufferView.buffer = 0u;
indicesBufferView.byteOffset = bufferOffset; indicesBufferView.byteOffset = bufferOffset;
indicesBufferView.byteLength = sizeof(unsigned short) * object.m_faces.size() * 3u; indicesBufferView.byteLength = static_cast<unsigned>(sizeof(unsigned short) * object.m_faces.size() * 3u);
indicesBufferView.target = JsonBufferViewTarget::ELEMENT_ARRAY_BUFFER; indicesBufferView.target = JsonBufferViewTarget::ELEMENT_ARRAY_BUFFER;
bufferOffset += indicesBufferView.byteLength; bufferOffset += indicesBufferView.byteLength;
@ -380,29 +380,29 @@ namespace
JsonAccessor positionAccessor; JsonAccessor positionAccessor;
positionAccessor.bufferView = m_vertex_buffer_view; positionAccessor.bufferView = m_vertex_buffer_view;
positionAccessor.byteOffset = offsetof(GltfVertex, coordinates); positionAccessor.byteOffset = static_cast<unsigned>(offsetof(GltfVertex, coordinates));
positionAccessor.componentType = JsonAccessorComponentType::FLOAT; positionAccessor.componentType = JsonAccessorComponentType::FLOAT;
positionAccessor.count = xmodel.m_vertices.size(); positionAccessor.count = static_cast<unsigned>(xmodel.m_vertices.size());
positionAccessor.type = JsonAccessorType::VEC3; positionAccessor.type = JsonAccessorType::VEC3;
m_position_accessor = gltf.accessors->size(); m_position_accessor = static_cast<unsigned>(gltf.accessors->size());
gltf.accessors->emplace_back(positionAccessor); gltf.accessors->emplace_back(positionAccessor);
JsonAccessor normalAccessor; JsonAccessor normalAccessor;
normalAccessor.bufferView = m_vertex_buffer_view; normalAccessor.bufferView = m_vertex_buffer_view;
normalAccessor.byteOffset = offsetof(GltfVertex, normal); normalAccessor.byteOffset = static_cast<unsigned>(offsetof(GltfVertex, normal));
normalAccessor.componentType = JsonAccessorComponentType::FLOAT; normalAccessor.componentType = JsonAccessorComponentType::FLOAT;
normalAccessor.count = xmodel.m_vertices.size(); normalAccessor.count = static_cast<unsigned>(xmodel.m_vertices.size());
normalAccessor.type = JsonAccessorType::VEC3; normalAccessor.type = JsonAccessorType::VEC3;
m_normal_accessor = gltf.accessors->size(); m_normal_accessor = static_cast<unsigned>(gltf.accessors->size());
gltf.accessors->emplace_back(normalAccessor); gltf.accessors->emplace_back(normalAccessor);
JsonAccessor uvAccessor; JsonAccessor uvAccessor;
uvAccessor.bufferView = m_vertex_buffer_view; uvAccessor.bufferView = m_vertex_buffer_view;
uvAccessor.byteOffset = offsetof(GltfVertex, uv); uvAccessor.byteOffset = static_cast<unsigned>(offsetof(GltfVertex, uv));
uvAccessor.componentType = JsonAccessorComponentType::FLOAT; uvAccessor.componentType = JsonAccessorComponentType::FLOAT;
uvAccessor.count = xmodel.m_vertices.size(); uvAccessor.count = static_cast<unsigned>(xmodel.m_vertices.size());
uvAccessor.type = JsonAccessorType::VEC2; uvAccessor.type = JsonAccessorType::VEC2;
m_uv_accessor = gltf.accessors->size(); m_uv_accessor = static_cast<unsigned>(gltf.accessors->size());
gltf.accessors->emplace_back(uvAccessor); gltf.accessors->emplace_back(uvAccessor);
if (!xmodel.m_bone_weight_data.weights.empty()) if (!xmodel.m_bone_weight_data.weights.empty())
@ -410,29 +410,29 @@ namespace
JsonAccessor jointsAccessor; JsonAccessor jointsAccessor;
jointsAccessor.bufferView = m_joints_buffer_view; jointsAccessor.bufferView = m_joints_buffer_view;
jointsAccessor.componentType = JsonAccessorComponentType::UNSIGNED_BYTE; jointsAccessor.componentType = JsonAccessorComponentType::UNSIGNED_BYTE;
jointsAccessor.count = xmodel.m_vertices.size(); jointsAccessor.count = static_cast<unsigned>(xmodel.m_vertices.size());
jointsAccessor.type = JsonAccessorType::VEC4; jointsAccessor.type = JsonAccessorType::VEC4;
m_joints_accessor = gltf.accessors->size(); m_joints_accessor = static_cast<unsigned>(gltf.accessors->size());
gltf.accessors->emplace_back(jointsAccessor); gltf.accessors->emplace_back(jointsAccessor);
JsonAccessor weightsAccessor; JsonAccessor weightsAccessor;
weightsAccessor.bufferView = m_weights_buffer_view; weightsAccessor.bufferView = m_weights_buffer_view;
weightsAccessor.componentType = JsonAccessorComponentType::FLOAT; weightsAccessor.componentType = JsonAccessorComponentType::FLOAT;
weightsAccessor.count = xmodel.m_vertices.size(); weightsAccessor.count = static_cast<unsigned>(xmodel.m_vertices.size());
weightsAccessor.type = JsonAccessorType::VEC4; weightsAccessor.type = JsonAccessorType::VEC4;
m_weights_accessor = gltf.accessors->size(); m_weights_accessor = static_cast<unsigned>(gltf.accessors->size());
gltf.accessors->emplace_back(weightsAccessor); gltf.accessors->emplace_back(weightsAccessor);
JsonAccessor inverseBindMatricesAccessor; JsonAccessor inverseBindMatricesAccessor;
inverseBindMatricesAccessor.bufferView = m_inverse_bind_matrices_buffer_view; inverseBindMatricesAccessor.bufferView = m_inverse_bind_matrices_buffer_view;
inverseBindMatricesAccessor.componentType = JsonAccessorComponentType::FLOAT; inverseBindMatricesAccessor.componentType = JsonAccessorComponentType::FLOAT;
inverseBindMatricesAccessor.count = xmodel.m_bones.size(); inverseBindMatricesAccessor.count = static_cast<unsigned>(xmodel.m_bones.size());
inverseBindMatricesAccessor.type = JsonAccessorType::MAT4; inverseBindMatricesAccessor.type = JsonAccessorType::MAT4;
m_inverse_bind_matrices_accessor = gltf.accessors->size(); m_inverse_bind_matrices_accessor = static_cast<unsigned>(gltf.accessors->size());
gltf.accessors->emplace_back(inverseBindMatricesAccessor); gltf.accessors->emplace_back(inverseBindMatricesAccessor);
} }
m_first_index_accessor = gltf.accessors->size(); m_first_index_accessor = static_cast<unsigned>(gltf.accessors->size());
for (auto i = 0u; i < xmodel.m_objects.size(); i++) for (auto i = 0u; i < xmodel.m_objects.size(); i++)
{ {
const auto& object = xmodel.m_objects[i]; const auto& object = xmodel.m_objects[i];
@ -440,7 +440,7 @@ namespace
JsonAccessor indicesAccessor; JsonAccessor indicesAccessor;
indicesAccessor.bufferView = m_first_index_buffer_view + i; indicesAccessor.bufferView = m_first_index_buffer_view + i;
indicesAccessor.componentType = JsonAccessorComponentType::UNSIGNED_SHORT; indicesAccessor.componentType = JsonAccessorComponentType::UNSIGNED_SHORT;
indicesAccessor.count = object.m_faces.size() * 3u; indicesAccessor.count = static_cast<unsigned>(object.m_faces.size() * 3u);
indicesAccessor.type = JsonAccessorType::SCALAR; indicesAccessor.type = JsonAccessorType::SCALAR;
gltf.accessors->emplace_back(indicesAccessor); gltf.accessors->emplace_back(indicesAccessor);
@ -452,7 +452,7 @@ namespace
const auto expectedBufferSize = GetExpectedBufferSize(xmodel); const auto expectedBufferSize = GetExpectedBufferSize(xmodel);
bufferData.resize(expectedBufferSize); bufferData.resize(expectedBufferSize);
auto currentBufferOffset = 0u; auto currentBufferOffset = 0uz;
float minPosition[3]{ float minPosition[3]{
std::numeric_limits<float>::max(), std::numeric_limits<float>::max(),
@ -576,7 +576,7 @@ namespace
static size_t GetExpectedBufferSize(const XModelCommon& xmodel) static size_t GetExpectedBufferSize(const XModelCommon& xmodel)
{ {
auto result = 0u; auto result = 0uz;
result += xmodel.m_vertices.size() * sizeof(GltfVertex); result += xmodel.m_vertices.size() * sizeof(GltfVertex);
@ -603,7 +603,7 @@ namespace
gltf.buffers.emplace(); gltf.buffers.emplace();
JsonBuffer jsonBuffer; JsonBuffer jsonBuffer;
jsonBuffer.byteLength = bufferData.size(); jsonBuffer.byteLength = static_cast<unsigned>(bufferData.size());
if (!bufferData.empty()) if (!bufferData.empty())
jsonBuffer.uri = m_output->CreateBufferUri(bufferData.data(), bufferData.size()); jsonBuffer.uri = m_output->CreateBufferUri(bufferData.data(), bufferData.size());

View File

@ -380,7 +380,7 @@ namespace
return; return;
auto& weightCollection = out.m_bone_weight_data; auto& weightCollection = out.m_bone_weight_data;
size_t weightOffset = 0u; auto weightOffset = 0u;
for (auto surfIndex = 0u; surfIndex < surfCount; surfIndex++) for (auto surfIndex = 0u; surfIndex < surfCount; surfIndex++)
{ {

View File

@ -106,7 +106,7 @@ private:
ObjWriting::Configuration.AssetTypesToHandleBitfield = std::vector<bool>(assetTypeCount); ObjWriting::Configuration.AssetTypesToHandleBitfield = std::vector<bool>(assetTypeCount);
std::vector<bool> handledSpecifiedAssets(m_args.m_specified_asset_types.size()); std::vector<bool> handledSpecifiedAssets(m_args.m_specified_asset_types.size());
for (auto i = 0; i < assetTypeCount; i++) for (auto i = 0u; i < assetTypeCount; i++)
{ {
const auto assetTypeName = std::string(*context.m_zone.m_pools->GetAssetTypeName(i)); const auto assetTypeName = std::string(*context.m_zone.m_pools->GetAssetTypeName(i));
@ -136,7 +136,7 @@ private:
std::cerr << "Valid asset types are:\n"; std::cerr << "Valid asset types are:\n";
auto first = true; auto first = true;
for (auto i = 0; i < assetTypeCount; i++) for (auto i = 0u; i < assetTypeCount; i++)
{ {
const auto assetTypeName = std::string(*context.m_zone.m_pools->GetAssetTypeName(i)); const auto assetTypeName = std::string(*context.m_zone.m_pools->GetAssetTypeName(i));

View File

@ -251,7 +251,7 @@ void UnlinkerArgs::AddSpecifiedAssetType(std::string value)
void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input) void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input)
{ {
auto currentPos = 0u; auto currentPos = 0uz;
size_t endPos; size_t endPos;
std::string lowerInput(input); std::string lowerInput(input);

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "Game/IW4/IW4.h" #include "Game/IW4/IW4.h"
#include "Loading/ContentLoaderBase.h" #include "Loading/ContentLoaderBase.h"
#include "Loading/IContentLoadingEntryPoint.h" #include "Loading/IContentLoadingEntryPoint.h"
@ -7,17 +8,18 @@ namespace IW4
{ {
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
{ {
XAsset* varXAsset; public:
ScriptStringList* varScriptStringList; ContentLoader();
void Load(Zone* zone, IZoneInputStream* stream) override;
private:
void LoadScriptStringList(bool atStreamStart); void LoadScriptStringList(bool atStreamStart);
void LoadXAsset(bool atStreamStart) const; void LoadXAsset(bool atStreamStart) const;
void LoadXAssetArray(bool atStreamStart, size_t count); void LoadXAssetArray(bool atStreamStart, size_t count);
public: XAsset* varXAsset;
ContentLoader(); ScriptStringList* varScriptStringList;
void Load(Zone* zone, IZoneInputStream* stream) override;
}; };
} // namespace IW4 } // namespace IW4

View File

@ -25,7 +25,7 @@ public:
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), sizeof(T)); LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), sizeof(T));
} }
template<typename T> void Load(T* dst, const uint32_t count) template<typename T> void Load(T* dst, const size_t count)
{ {
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), count * sizeof(T)); LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), count * sizeof(T));
} }

View File

@ -10,12 +10,6 @@
class OutputProcessorDeflate::Impl class OutputProcessorDeflate::Impl
{ {
z_stream m_stream{};
OutputProcessorDeflate* m_base;
std::unique_ptr<uint8_t[]> m_buffer;
size_t m_buffer_size;
public: public:
Impl(OutputProcessorDeflate* baseClass, const size_t bufferSize) Impl(OutputProcessorDeflate* baseClass, const size_t bufferSize)
: m_buffer(std::make_unique<uint8_t[]>(bufferSize)), : m_buffer(std::make_unique<uint8_t[]>(bufferSize)),
@ -29,7 +23,7 @@ public:
m_stream.avail_in = 0; m_stream.avail_in = 0;
m_stream.next_in = Z_NULL; m_stream.next_in = Z_NULL;
m_stream.next_out = m_buffer.get(); m_stream.next_out = m_buffer.get();
m_stream.avail_out = m_buffer_size; m_stream.avail_out = static_cast<unsigned>(m_buffer_size);
const int ret = deflateInit(&m_stream, Z_DEFAULT_COMPRESSION); const int ret = deflateInit(&m_stream, Z_DEFAULT_COMPRESSION);
@ -52,7 +46,7 @@ public:
void Write(const void* buffer, const size_t length) void Write(const void* buffer, const size_t length)
{ {
m_stream.next_in = static_cast<const Bytef*>(buffer); m_stream.next_in = static_cast<const Bytef*>(buffer);
m_stream.avail_in = length; m_stream.avail_in = static_cast<unsigned>(length);
while (m_stream.avail_in > 0) while (m_stream.avail_in > 0)
{ {
@ -60,7 +54,7 @@ public:
{ {
m_base->m_base_stream->Write(m_buffer.get(), m_buffer_size); m_base->m_base_stream->Write(m_buffer.get(), m_buffer_size);
m_stream.next_out = m_buffer.get(); m_stream.next_out = m_buffer.get();
m_stream.avail_out = m_buffer_size; m_stream.avail_out = static_cast<unsigned>(m_buffer_size);
} }
const auto ret = deflate(&m_stream, Z_NO_FLUSH); const auto ret = deflate(&m_stream, Z_NO_FLUSH);
@ -79,7 +73,7 @@ public:
{ {
m_base->m_base_stream->Write(m_buffer.get(), m_buffer_size - m_stream.avail_out); m_base->m_base_stream->Write(m_buffer.get(), m_buffer_size - m_stream.avail_out);
m_stream.next_out = m_buffer.get(); m_stream.next_out = m_buffer.get();
m_stream.avail_out = m_buffer_size; m_stream.avail_out = static_cast<unsigned>(m_buffer_size);
} }
const auto ret = deflate(&m_stream, Z_FINISH); const auto ret = deflate(&m_stream, Z_FINISH);
@ -96,14 +90,21 @@ public:
{ {
m_base->m_base_stream->Write(m_buffer.get(), m_buffer_size - m_stream.avail_out); m_base->m_base_stream->Write(m_buffer.get(), m_buffer_size - m_stream.avail_out);
m_stream.next_out = m_buffer.get(); m_stream.next_out = m_buffer.get();
m_stream.avail_out = m_buffer_size; m_stream.avail_out = static_cast<unsigned>(m_buffer_size);
} }
} }
_NODISCARD int64_t Pos() const [[nodiscard]] int64_t Pos() const
{ {
return m_base->m_base_stream->Pos(); return m_base->m_base_stream->Pos();
} }
private:
z_stream m_stream{};
OutputProcessorDeflate* m_base;
std::unique_ptr<uint8_t[]> m_buffer;
size_t m_buffer_size;
}; };
OutputProcessorDeflate::OutputProcessorDeflate() OutputProcessorDeflate::OutputProcessorDeflate()

View File

@ -13,7 +13,7 @@ class OutputProcessorDeflate final : public OutputStreamProcessor
public: public:
OutputProcessorDeflate(); OutputProcessorDeflate();
OutputProcessorDeflate(size_t bufferSize); explicit OutputProcessorDeflate(size_t bufferSize);
~OutputProcessorDeflate() override; ~OutputProcessorDeflate() override;
OutputProcessorDeflate(const OutputProcessorDeflate& other) = delete; OutputProcessorDeflate(const OutputProcessorDeflate& other) = delete;
OutputProcessorDeflate(OutputProcessorDeflate&& other) noexcept = default; OutputProcessorDeflate(OutputProcessorDeflate&& other) noexcept = default;

View File

@ -9,10 +9,10 @@ StepWriteZero::StepWriteZero(const size_t count)
void StepWriteZero::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream) void StepWriteZero::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
{ {
const uint64_t num = 0; constexpr uint64_t num = 0;
size_t toWrite; size_t toWrite;
for (auto i = 0u; i < m_count; i += toWrite) for (auto i = 0uz; i < m_count; i += toWrite)
{ {
toWrite = std::min(sizeof(uint64_t), m_count - i); toWrite = std::min(sizeof(uint64_t), m_count - i);
stream->Write(&num, toWrite); stream->Write(&num, toWrite);

View File

@ -43,7 +43,7 @@ public:
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), sizeof(T))); return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), sizeof(T)));
} }
template<typename T> T* Write(T* dst, const uint32_t count) template<typename T> T* Write(T* dst, const size_t count)
{ {
return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), count * sizeof(T))); return static_cast<T*>(WriteDataInBlock(reinterpret_cast<const void*>(dst), count * sizeof(T)));
} }

View File

@ -66,7 +66,7 @@ namespace
pos_type seekpos(const pos_type pos, std::ios_base::openmode) override pos_type seekpos(const pos_type pos, std::ios_base::openmode) override
{ {
if (pos > m_data.size()) if (pos > static_cast<pos_type>(m_data.size()))
m_data.resize(static_cast<decltype(m_data)::size_type>(pos)); m_data.resize(static_cast<decltype(m_data)::size_type>(pos));
m_pos = static_cast<size_t>(pos); m_pos = static_cast<size_t>(pos);