/**\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
Result = 0;\r
\r
//\r
- // Skip spaces if requested\r
+ // there is a space where there should't be\r
//\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
- // 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
Result = 0;\r
\r
//\r
- // Skip spaces if requested\r
+ // Stop upon space if requested \r
+ // (if the whole value was 0)\r
//\r
- while (StopAtSpace && *String == L' ') {\r
- String++;\r
+ if (StopAtSpace && *String == L' ') {\r
+ *Value = Result;\r
+ return (EFI_SUCCESS);\r
}\r
+\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