diff options
| author | Léo Lam <leo@leolam.fr> | 2021-01-05 22:28:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-05 16:28:50 -0500 |
| commit | 978dcbcb5a9cb68d558de132c0661f6141887e5d (patch) | |
| tree | a5979f922825b85864e08cef6c79f742c1b4cd91 /ZAPD/ZSkeleton.cpp | |
| parent | 4ea37af45af670e65547a35c49a2288ef2a63245 (diff) | |
Avoid unnecessary copies (#46)
Pass some parameters by reference to avoid unnecessary copies.
When the parameter is intended to be copied into a member variable,
pass it by value and move it into the member instead.
This doesn't fix every occurrence of the issue but this diff is already
getting big so let's stop here for the moment.
Diffstat (limited to 'ZAPD/ZSkeleton.cpp')
| -rw-r--r-- | ZAPD/ZSkeleton.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ZAPD/ZSkeleton.cpp b/ZAPD/ZSkeleton.cpp index 7e524ba..3666b73 100644 --- a/ZAPD/ZSkeleton.cpp +++ b/ZAPD/ZSkeleton.cpp @@ -50,16 +50,16 @@ ZLimbStandard* ZLimbStandard::FromRawData(std::vector<uint8_t> nRawData, int raw limb->transX = BitConverter::ToInt16BE(nRawData, rawDataIndex + 0); limb->transY = BitConverter::ToInt16BE(nRawData, rawDataIndex + 2); limb->transZ = BitConverter::ToInt16BE(nRawData, rawDataIndex + 4); - + limb->childIndex = nRawData[rawDataIndex + 6]; limb->siblingIndex = nRawData[rawDataIndex + 7]; - + limb->dListPtr = BitConverter::ToInt32BE(nRawData, rawDataIndex + 8) & 0x00FFFFFF; return limb; } -string ZLimbStandard::GetSourceOutputCode(string prefix) +string ZLimbStandard::GetSourceOutputCode(const std::string& prefix) { string dListStr = dListPtr == 0 ? "NULL" : StringHelper::Sprintf("%s", parent->GetVarName(dListPtr).c_str()); @@ -154,7 +154,7 @@ ZSkeleton* ZSkeleton::FromXML(XMLElement* reader, vector<uint8_t> nRawData, int return skeleton; } -std::string ZSkeleton::GetSourceOutputCode(std::string prefix) +std::string ZSkeleton::GetSourceOutputCode(const std::string& prefix) { if (parent != nullptr) { @@ -164,7 +164,7 @@ std::string ZSkeleton::GetSourceOutputCode(std::string prefix) for (int i = 0; i < limbs.size(); i++) { ZLimbStandard* limb = limbs[i]; - + string defaultDLName = StringHelper::Sprintf("%sLimbDL_%06X", defaultPrefix.c_str(), limb->dListPtr); string dListStr = limb->dListPtr == 0 ? "NULL" : StringHelper::Sprintf("%s", parent->GetDeclarationName(limb->dListPtr, defaultDLName).c_str()); @@ -257,7 +257,7 @@ std::string ZSkeleton::GetSourceOutputCode(std::string prefix) return ""; } -void ZSkeleton::Save(string outFolder) +void ZSkeleton::Save(const std::string& outFolder) { } @@ -286,7 +286,7 @@ ZLimbLOD* ZLimbLOD::FromRawData(vector<uint8_t> nRawData, int rawDataIndex) return limb; } -string ZLimbLOD::GetSourceOutputCode(string prefix) +string ZLimbLOD::GetSourceOutputCode(const std::string& prefix) { return std::string(); } |
