Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN. This function outputs a value of type UINTN 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 ran
| 873 | |
| 874 | **/ |
| 875 | RETURN_STATUS |
| 876 | EFIAPI |
| 877 | StrHexToUintnS ( |
| 878 | IN CONST CHAR16 *String, |
| 879 | OUT CHAR16 **EndPointer, OPTIONAL |
| 880 | OUT UINTN *Data |
| 881 | ) |
| 882 | { |
| 883 | ASSERT (((UINTN) String & BIT0) == 0); |
| 884 | |
| 885 | // |
| 886 | // 1. Neither String nor Data shall be a null pointer. |
| 887 | // |
| 888 | SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); |
| 889 | SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); |
| 890 | |
| 891 | // |
| 892 | // 2. The length of String shall not be greater than RSIZE_MAX. |
| 893 | // |
| 894 | // if (RSIZE_MAX != 0) { |
| 895 | // SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); |
| 896 | // } |
| 897 | |
| 898 | if (EndPointer != NULL) { |
| 899 | *EndPointer = (CHAR16 *) String; |
| 900 | } |
| 901 | |
| 902 | // |
| 903 | // Ignore the pad spaces (space or tab) |
| 904 | // |
| 905 | while ((*String == L' ') || (*String == L'\t')) { |
| 906 | String++; |
| 907 | } |
| 908 | |
| 909 | // |
| 910 | // Ignore leading Zeros after the spaces |
| 911 | // |
| 912 | while (*String == L'0') { |
| 913 | String++; |
| 914 | } |
| 915 | |
| 916 | if (CharToUpper (*String) == L'X') { |
| 917 | if (*(String - 1) != L'0') { |
| 918 | *Data = 0; |
| 919 | return RETURN_SUCCESS; |
| 920 | } |
| 921 | // |
| 922 | // Skip the 'X' |
| 923 | // |
| 924 | String++; |
| 925 | } |
| 926 | |
| 927 | *Data = 0; |
| 928 | |
| 929 | while (InternalIsHexaDecimalDigitCharacter (*String)) { |
| 930 | // |
| 931 | // If the number represented by String overflows according to the range |
| 932 | // defined by UINTN, then MAX_UINTN is stored in *Data and |
no test coverage detected