-
Notifications
You must be signed in to change notification settings - Fork 52
Avoid recursion #696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Avoid recursion #696
Conversation
metadata.push_back({uri, string(ref["MimeType"]), std::move(tst)}); | ||
}; | ||
add("META-INF/ASiCArchiveManifest.xml", "text/xml"); | ||
for(auto ref = doc/"DataObjectReference"; ref; ref++) |
Check notice
Code scanning / CodeQL
Declaration hides variable Note
line 80
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
To fix this problem, the name of the variable declared in the inner for-loop on line 87 should be changed so that it does not shadow the outer variable from line 80. The best approach is to rename the inner loop variable to something more descriptive, such as dataRef
. This change only requires updating the loop variable to dataRef
and updating all uses within the loop, which are currently ref
. Since this for-loop is small, only a handful of places require the change:
- Line 87:
for(auto ref = ...; ref; ref++)
→for(auto dataRef = ...; dataRef; dataRef++)
- Lines 89, 91, 92: All instances of
ref["Rootfile"]
,ref["URI"]
,ref["MimeType"]
should be replaced withdataRef[... ]
No imports or other method/variable definitions are needed: only the use of the loop variable. All changes are to src/SignatureTST.cpp in the region of lines 87–94.
-
Copy modified line R87 -
Copy modified line R89 -
Copy modified lines R91-R92
@@ -84,12 +84,12 @@ | ||
metadata.emplace_back(std::move(uri), string(ref["MimeType"]), std::move(tst)); | ||
file.clear(); | ||
|
||
for(auto ref = doc/"DataObjectReference"; ref; ref++) | ||
for(auto dataRef = doc/"DataObjectReference"; dataRef; dataRef++) | ||
{ | ||
if(ref["Rootfile"] == "true") | ||
if(dataRef["Rootfile"] == "true") | ||
{ | ||
file = util::File::fromUriPath(ref["URI"]); | ||
mime = ref["MimeType"]; | ||
file = util::File::fromUriPath(dataRef["URI"]); | ||
mime = dataRef["MimeType"]; | ||
} | ||
} | ||
} |
IB-8611 Signed-off-by: Raul Metsma <raul@metsma.ee>
IB-8611
Signed-off-by: Raul Metsma raul@metsma.ee