This function looks up a Unicode string in UnicodeStringTable. If Language is a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable that matches the language code specified by Language, then it is returned in UnicodeString. @param Language A pointer to an ASCII string containing the ISO 639-2 or the RFC 4646
| 797 | |
| 798 | **/ |
| 799 | EFI_STATUS |
| 800 | EFIAPI |
| 801 | LookupUnicodeString2 ( |
| 802 | IN CONST CHAR8 *Language, |
| 803 | IN CONST CHAR8 *SupportedLanguages, |
| 804 | IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, |
| 805 | OUT CHAR16 **UnicodeString, |
| 806 | IN BOOLEAN Iso639Language |
| 807 | ) |
| 808 | { |
| 809 | BOOLEAN Found; |
| 810 | UINTN Index; |
| 811 | CHAR8 *LanguageString; |
| 812 | |
| 813 | // |
| 814 | // Make sure the parameters are valid |
| 815 | // |
| 816 | if (Language == NULL || UnicodeString == NULL) { |
| 817 | return EFI_INVALID_PARAMETER; |
| 818 | } |
| 819 | |
| 820 | // |
| 821 | // If there are no supported languages, or the Unicode String Table is empty, then the |
| 822 | // Unicode String specified by Language is not supported by this Unicode String Table |
| 823 | // |
| 824 | if (SupportedLanguages == NULL || UnicodeStringTable == NULL) { |
| 825 | return EFI_UNSUPPORTED; |
| 826 | } |
| 827 | |
| 828 | // |
| 829 | // Make sure Language is in the set of Supported Languages |
| 830 | // |
| 831 | Found = FALSE; |
| 832 | while (*SupportedLanguages != 0) { |
| 833 | if (Iso639Language) { |
| 834 | if (CompareIso639LanguageCode (Language, SupportedLanguages)) { |
| 835 | Found = TRUE; |
| 836 | break; |
| 837 | } |
| 838 | SupportedLanguages += 3; |
| 839 | } else { |
| 840 | for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++); |
| 841 | if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) { |
| 842 | Found = TRUE; |
| 843 | break; |
| 844 | } |
| 845 | SupportedLanguages += Index; |
| 846 | for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++); |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | // |
| 851 | // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED |
| 852 | // |
| 853 | if (!Found) { |
| 854 | return EFI_UNSUPPORTED; |
| 855 | } |
| 856 |
no test coverage detected