NetworkPkg: Refine UintnToAscDecWithFormat functions logic
This commit refines the logic for HttpBootUintnToAscDecWithFormat and PxeBcUintnToAscDecWithFormat. It avoids using the decrement operator '--' for array index to prevent possible mis-reports by static code checkers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
@ -86,11 +86,10 @@ HttpBootUintnToAscDecWithFormat (
|
|||||||
{
|
{
|
||||||
UINTN Remainder;
|
UINTN Remainder;
|
||||||
|
|
||||||
while (Length > 0) {
|
for (; Length > 0; Length--) {
|
||||||
Length--;
|
|
||||||
Remainder = Number % 10;
|
Remainder = Number % 10;
|
||||||
Number /= 10;
|
Number /= 10;
|
||||||
Buffer[Length] = (UINT8) ('0' + Remainder);
|
Buffer[Length - 1] = (UINT8) ('0' + Remainder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,11 +1383,10 @@ PxeBcUintnToAscDecWithFormat (
|
|||||||
{
|
{
|
||||||
UINTN Remainder;
|
UINTN Remainder;
|
||||||
|
|
||||||
while (Length > 0) {
|
for (; Length > 0; Length--) {
|
||||||
Length--;
|
|
||||||
Remainder = Number % 10;
|
Remainder = Number % 10;
|
||||||
Number /= 10;
|
Number /= 10;
|
||||||
Buffer[Length] = (UINT8) ('0' + Remainder);
|
Buffer[Length - 1] = (UINT8) ('0' + Remainder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user