Connection: Eliminate variable shadowing

Amends trivial cases of variable shadowing.
This commit is contained in:
Lioncash 2019-08-23 13:51:41 -04:00
parent 11b3bf0889
commit cbcfdcb67a
1 changed files with 20 additions and 24 deletions

View File

@ -1363,14 +1363,13 @@ Actor::Subtype::Subtype(Connection& conn) {
name.assign(bufSz, ' '); name.assign(bufSz, ' ');
conn._readBuf(&name[0], bufSz); conn._readBuf(&name[0], bufSz);
std::string meshPath;
conn._readBuf(&bufSz, 4); conn._readBuf(&bufSz, 4);
if (bufSz) { if (bufSz != 0) {
meshPath.assign(bufSz, ' '); std::string meshPath(bufSz, ' ');
conn._readBuf(&meshPath[0], bufSz); conn._readBuf(meshPath.data(), meshPath.size());
SystemStringConv meshPathAbs(meshPath); const SystemStringConv meshPathAbs(meshPath);
SystemString meshPathRel = const SystemString meshPathRel =
conn.getBlendPath().getProject().getProjectRootPath().getProjectRelativeFromAbsolute(meshPathAbs.sys_str()); conn.getBlendPath().getProject().getProjectRootPath().getProjectRelativeFromAbsolute(meshPathAbs.sys_str());
mesh.assign(conn.getBlendPath().getProject().getProjectWorkingPath(), meshPathRel); mesh.assign(conn.getBlendPath().getProject().getProjectWorkingPath(), meshPathRel);
} }
@ -1386,14 +1385,13 @@ Actor::Subtype::Subtype(Connection& conn) {
overlayName.assign(bufSz, ' '); overlayName.assign(bufSz, ' ');
conn._readBuf(&overlayName[0], bufSz); conn._readBuf(&overlayName[0], bufSz);
std::string meshPath;
conn._readBuf(&bufSz, 4); conn._readBuf(&bufSz, 4);
if (bufSz) { if (bufSz != 0) {
meshPath.assign(bufSz, ' '); std::string meshPath(bufSz, ' ');
conn._readBuf(&meshPath[0], bufSz); conn._readBuf(meshPath.data(), meshPath.size());
SystemStringConv meshPathAbs(meshPath); const SystemStringConv meshPathAbs(meshPath);
SystemString meshPathRel = const SystemString meshPathRel =
conn.getBlendPath().getProject().getProjectRootPath().getProjectRelativeFromAbsolute(meshPathAbs.sys_str()); conn.getBlendPath().getProject().getProjectRootPath().getProjectRelativeFromAbsolute(meshPathAbs.sys_str());
overlayMeshes.emplace_back(std::move(overlayName), overlayMeshes.emplace_back(std::move(overlayName),
ProjectPath(conn.getBlendPath().getProject().getProjectWorkingPath(), meshPathRel)); ProjectPath(conn.getBlendPath().getProject().getProjectWorkingPath(), meshPathRel));
@ -1894,12 +1892,11 @@ std::vector<std::string> DataStream::getSubtypeOverlayNames(std::string_view nam
m_parent->_readBuf(&subCount, 4); m_parent->_readBuf(&subCount, 4);
ret.reserve(subCount); ret.reserve(subCount);
for (uint32_t i = 0; i < subCount; ++i) { for (uint32_t i = 0; i < subCount; ++i) {
ret.emplace_back(); std::string& subtypeName = ret.emplace_back();
std::string& name = ret.back();
uint32_t bufSz; uint32_t bufSz;
m_parent->_readBuf(&bufSz, 4); m_parent->_readBuf(&bufSz, 4);
name.assign(bufSz, ' '); subtypeName.assign(bufSz, ' ');
m_parent->_readBuf(&name[0], bufSz); m_parent->_readBuf(subtypeName.data(), subtypeName.size());
} }
return ret; return ret;
@ -1955,23 +1952,22 @@ std::unordered_map<std::string, Matrix3f> DataStream::getBoneMatrices(std::strin
m_parent->_readBuf(&boneCount, 4); m_parent->_readBuf(&boneCount, 4);
ret.reserve(boneCount); ret.reserve(boneCount);
for (uint32_t i = 0; i < boneCount; ++i) { for (uint32_t i = 0; i < boneCount; ++i) {
std::string name;
uint32_t bufSz; uint32_t bufSz;
m_parent->_readBuf(&bufSz, 4); m_parent->_readBuf(&bufSz, 4);
name.assign(bufSz, ' '); std::string mat_name(bufSz, ' ');
m_parent->_readBuf(&name[0], bufSz); m_parent->_readBuf(mat_name.data(), bufSz);
Matrix3f matOut; Matrix3f matOut;
for (int i = 0; i < 3; ++i) { for (int mat_i = 0; mat_i < 3; ++mat_i) {
for (int j = 0; j < 3; ++j) { for (int mat_j = 0; mat_j < 3; ++mat_j) {
float val; float val;
m_parent->_readBuf(&val, 4); m_parent->_readBuf(&val, 4);
matOut[i].simd[j] = val; matOut[mat_i].simd[mat_j] = val;
} }
reinterpret_cast<atVec4f&>(matOut[i]).simd[3] = 0.f; reinterpret_cast<atVec4f&>(matOut[mat_i]).simd[3] = 0.f;
} }
ret.emplace(std::make_pair(std::move(name), std::move(matOut))); ret.emplace(std::move(mat_name), std::move(matOut));
} }
return ret; return ret;