also fixes a few out of date comments.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17816
6f19259b-4bc3-4df7-8a09-
765794883524
/**\r
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.\r
\r
/**\r
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.\r
\r
- This function returns a value of type UINTN by interpreting the contents\r
+ This function returns a value of type UINT64 by interpreting the contents\r
of the Unicode string specified by String as a hexadecimal number.\r
The format of the input Unicode string String is:\r
\r
of the Unicode string specified by String as a hexadecimal number.\r
The format of the input Unicode string String is:\r
\r
- // Skip spaces if requested\r
+ // there is a space where there should't be\r
- while (StopAtSpace && *String == L' ') {\r
- String++;\r
+ if (*String == L' ') {\r
+ return (EFI_INVALID_PARAMETER);\r
}\r
\r
while (ShellIsHexaDecimalDigitCharacter (*String)) {\r
//\r
// If the Hex Number represented by String overflows according\r
}\r
\r
while (ShellIsHexaDecimalDigitCharacter (*String)) {\r
//\r
// If the Hex Number represented by String overflows according\r
- // to the range defined by UINTN, then ASSERT().\r
+ // to the range defined by UINT64, then return EFI_DEVICE_ERROR.\r
//\r
if (!(Result <= (RShiftU64((((UINT64) ~0) - InternalShellHexCharToUintn (*String)), 4)))) {\r
// if (!(Result <= ((((UINT64) ~0) - InternalShellHexCharToUintn (*String)) >> 4))) {\r
//\r
if (!(Result <= (RShiftU64((((UINT64) ~0) - InternalShellHexCharToUintn (*String)), 4)))) {\r
// if (!(Result <= ((((UINT64) ~0) - InternalShellHexCharToUintn (*String)) >> 4))) {\r
- // Skip spaces if requested\r
+ // Stop upon space if requested \r
+ // (if the whole value was 0)\r
- while (StopAtSpace && *String == L' ') {\r
- String++;\r
+ if (StopAtSpace && *String == L' ') {\r
+ *Value = Result;\r
+ return (EFI_SUCCESS);\r
while (ShellIsDecimalDigitCharacter (*String)) {\r
//\r
// If the number represented by String overflows according\r
while (ShellIsDecimalDigitCharacter (*String)) {\r
//\r
// If the number represented by String overflows according\r
- // to the range defined by UINT64, then ASSERT().\r
+ // to the range defined by UINT64, then return EFI_DEVICE_ERROR.\r
//\r
\r
if (!(Result <= (DivU64x32((((UINT64) ~0) - (*String - L'0')),10)))) {\r
//\r
\r
if (!(Result <= (DivU64x32((((UINT64) ~0) - (*String - L'0')),10)))) {\r