Skip to content

Commit f818113

Browse files
committed
HPCC-36035 Adjust loops per review recommendation
Use dedicated for loop indices to avoid overflow/underflow or misuse after loop ends. Signed-off-by: Terrence Asselin <terrence.asselin+copilot@lexisnexisrisk.com>
1 parent fd00ea5 commit f818113

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

esp/bindings/SOAP/xpp/fxpp/FragmentedXmlPullParser.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,11 @@ class CFragmentedXmlPullParser : public IFragmentedXmlPullParser
216216
}
217217
else
218218
{
219-
while (true)
219+
for (uint8_t i=0; i<=laIndex; ++i)
220220
{
221-
la = peekDataFrame(laIndex);
221+
la = peekDataFrame(i);
222222
if (la)
223223
la->state = DataFrame::FrameIgnored;
224-
if (laIndex == 0)
225-
break;
226-
--laIndex;
227224
}
228225
pushFragment(injector.m_frame.getLink());
229226
}

esp/services/ws_machine/ws_machineService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ void Cws_machineEx::setProcessRequest(CGetMachineInfoData& machineInfoData, Bool
499499
processTypeStr = processType;
500500
}
501501

502-
for (; numIps > 0; --numIps)
502+
for (unsigned i=0; i<numIps; ++i)
503503
{
504504
unsigned numAddr;
505505
if (ipAddr.getNetAddress(sizeof(numAddr),&numAddr)!=sizeof(numAddr))

0 commit comments

Comments
 (0)