diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-11-15 16:25:22 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-12-22 16:17:22 +0800 |
commit | 413535bb33d60417d681725af0274086630e7987 (patch) | |
tree | fd7276dd72ecb80376a10e38725ad5bb4bb1dde9 /NetworkPkg/UefiPxeBcDxe | |
parent | 81a108434041f6bed629123922772279d98d91a8 (diff) | |
download | edk2-413535bb33d60417d681725af0274086630e7987.tar.gz edk2-413535bb33d60417d681725af0274086630e7987.tar.bz2 edk2-413535bb33d60417d681725af0274086630e7987.zip |
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>
Diffstat (limited to 'NetworkPkg/UefiPxeBcDxe')
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c index 00c652dae5..568360de0f 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c @@ -1383,11 +1383,10 @@ PxeBcUintnToAscDecWithFormat ( {
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);
}
}
|