From 413535bb33d60417d681725af0274086630e7987 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 15 Nov 2016 16:25:22 +0800 Subject: 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 Reviewed-by: Fu Siyuan Reviewed-by: Ye Ting Reviewed-by: Wu Jiaxin --- NetworkPkg/HttpBootDxe/HttpBootSupport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'NetworkPkg/HttpBootDxe') diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/HttpBootSupport.c index 9410bf9e15..bdb29ae9a0 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -86,11 +86,10 @@ HttpBootUintnToAscDecWithFormat ( { UINTN Remainder; - while (Length > 0) { - Length--; + for (; Length > 0; Length--) { Remainder = Number % 10; Number /= 10; - Buffer[Length] = (UINT8) ('0' + Remainder); + Buffer[Length - 1] = (UINT8) ('0' + Remainder); } } -- cgit v1.2.3