MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / AddUnicodeString2

Function AddUnicodeString2

MdePkg/Library/UefiLib/UefiLib.c:1088–1244  ·  view source on GitHub ↗

This function adds the Null-terminated Unicode string specified by UnicodeString to UnicodeStringTable. If Language is a member of SupportedLanguages then UnicodeString is added to UnicodeStringTable. New buffers are allocated for both Language and UnicodeString. The contents of Language and UnicodeString are copied into these new buffers. These buffers are automatically freed wh

Source from the content-addressed store, hash-verified

1086
1087**/
1088EFI_STATUS
1089EFIAPI
1090AddUnicodeString2 (
1091 IN CONST CHAR8 *Language,
1092 IN CONST CHAR8 *SupportedLanguages,
1093 IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
1094 IN CONST CHAR16 *UnicodeString,
1095 IN BOOLEAN Iso639Language
1096 )
1097{
1098 UINTN NumberOfEntries;
1099 EFI_UNICODE_STRING_TABLE *OldUnicodeStringTable;
1100 EFI_UNICODE_STRING_TABLE *NewUnicodeStringTable;
1101 UINTN UnicodeStringLength;
1102 BOOLEAN Found;
1103 UINTN Index;
1104 CHAR8 *LanguageString;
1105
1106 //
1107 // Make sure the parameter are valid
1108 //
1109 if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
1110 return EFI_INVALID_PARAMETER;
1111 }
1112
1113 //
1114 // If there are no supported languages, then a Unicode String can not be added
1115 //
1116 if (SupportedLanguages == NULL) {
1117 return EFI_UNSUPPORTED;
1118 }
1119
1120 //
1121 // If the Unicode String is empty, then a Unicode String can not be added
1122 //
1123 if (UnicodeString[0] == 0) {
1124 return EFI_INVALID_PARAMETER;
1125 }
1126
1127 //
1128 // Make sure Language is a member of SupportedLanguages
1129 //
1130 Found = FALSE;
1131 while (*SupportedLanguages != 0) {
1132 if (Iso639Language) {
1133 if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
1134 Found = TRUE;
1135 break;
1136 }
1137 SupportedLanguages += 3;
1138 } else {
1139 for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
1140 if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
1141 Found = TRUE;
1142 break;
1143 }
1144 SupportedLanguages += Index;
1145 for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);

Callers 15

RegisterAtaDeviceFunction · 0.85
UhciDriverBindingStartFunction · 0.85
EhcDriverBindingStartFunction · 0.85
XhcDriverBindingStartFunction · 0.85
AddNameFunction · 0.85
DiscoverEmmcDeviceFunction · 0.85
DiscoverSdDeviceFunction · 0.85

Calls 8

AsciiStrnCmpFunction · 0.85
AllocateCopyPoolFunction · 0.85
AsciiStrSizeFunction · 0.85
AllocatePoolFunction · 0.50
CopyMemFunction · 0.50
FreePoolFunction · 0.50
StrSizeFunction · 0.50

Tested by

no test coverage detected