This commit refines the logic for the CvtNum function. 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>
{\r
UINTN Remainder;\r
\r
- while (Length > 0) {\r
+ for (; Length > 0; Length--) {\r
Remainder = Number % 10;\r
Number /= 10;\r
- Length--;\r
- Buffer[Length] = (UINT8) ('0' + Remainder);\r
+ Buffer[Length - 1] = (UINT8) ('0' + Remainder);\r
}\r
}\r
\r