Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64. This function outputs a value of type UINT64 by interpreting the contents of the Unicode string specified by String as a hexadecimal number. The format of the input Unicode string String is: [spaces][zeros][x][hexadecimal digits]. The valid hexadecimal digit character is in the r
| 1005 | |
| 1006 | **/ |
| 1007 | RETURN_STATUS |
| 1008 | EFIAPI |
| 1009 | StrHexToUint64S ( |
| 1010 | IN CONST CHAR16 *String, |
| 1011 | OUT CHAR16 **EndPointer, OPTIONAL |
| 1012 | OUT UINT64 *Data |
| 1013 | ) |
| 1014 | { |
| 1015 | ASSERT (((UINTN) String & BIT0) == 0); |
| 1016 | |
| 1017 | // |
| 1018 | // 1. Neither String nor Data shall be a null pointer. |
| 1019 | // |
| 1020 | SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); |
| 1021 | SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); |
| 1022 | |
| 1023 | // |
| 1024 | // 2. The length of String shall not be greater than RSIZE_MAX. |
| 1025 | // |
| 1026 | // if (RSIZE_MAX != 0) { |
| 1027 | // SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); |
| 1028 | // } |
| 1029 | |
| 1030 | if (EndPointer != NULL) { |
| 1031 | *EndPointer = (CHAR16 *) String; |
| 1032 | } |
| 1033 | |
| 1034 | // |
| 1035 | // Ignore the pad spaces (space or tab) |
| 1036 | // |
| 1037 | while ((*String == L' ') || (*String == L'\t')) { |
| 1038 | String++; |
| 1039 | } |
| 1040 | |
| 1041 | // |
| 1042 | // Ignore leading Zeros after the spaces |
| 1043 | // |
| 1044 | while (*String == L'0') { |
| 1045 | String++; |
| 1046 | } |
| 1047 | |
| 1048 | if (CharToUpper (*String) == L'X') { |
| 1049 | if (*(String - 1) != L'0') { |
| 1050 | *Data = 0; |
| 1051 | return RETURN_SUCCESS; |
| 1052 | } |
| 1053 | // |
| 1054 | // Skip the 'X' |
| 1055 | // |
| 1056 | String++; |
| 1057 | } |
| 1058 | |
| 1059 | *Data = 0; |
| 1060 | |
| 1061 | while (InternalIsHexaDecimalDigitCharacter (*String)) { |
| 1062 | // |
| 1063 | // If the number represented by String overflows according to the range |
| 1064 | // defined by UINT64, then MAX_UINT64 is stored in *Data and |
no test coverage detected