Get index from supported language codes according to language string.\r
\r
This code is used to get corresponding index in supported language codes. It can handle\r
- RFC3066 and ISO639 language tags.\r
+ RFC4646 and ISO639 language tags.\r
In ISO639 language tags, take 3-characters as a delimitation to find matched string and calculate the index.\r
- In RFC3066 language tags, take semicolon as a delimitation to find matched string and calculate the index.\r
+ In RFC4646 language tags, take semicolon as a delimitation to find matched string and calculate the index.\r
\r
For example:\r
SupportedLang = "engfraengfra"\r
\r
@param SupportedLang Platform supported language codes.\r
@param Lang Configured language.\r
- @param Iso639Language A bool value to signify if the handler is operated on ISO639 or RFC3066.\r
+ @param Iso639Language A bool value to signify if the handler is operated on ISO639 or RFC4646.\r
\r
@retval the index of language in the language codes.\r
\r
return 0;\r
} else {\r
//\r
- // Compare RFC3066 language code\r
+ // Compare RFC4646 language code\r
//\r
while (*Supported != '\0') {\r
//\r
Get language string from supported language codes according to index.\r
\r
This code is used to get corresponding language string in supported language codes. It can handle\r
- RFC3066 and ISO639 language tags.\r
+ RFC4646 and ISO639 language tags.\r
In ISO639 language tags, take 3-characters as a delimitation. Find language string according to the index.\r
- In RFC3066 language tags, take semicolon as a delimitation. Find language string according to the index.\r
+ In RFC4646 language tags, take semicolon as a delimitation. Find language string according to the index.\r
\r
For example:\r
SupportedLang = "engfraengfra"\r
\r
@param SupportedLang Platform supported language codes.\r
@param Index the index in supported language codes.\r
- @param Iso639Language A bool value to signify if the handler is operated on ISO639 or RFC3066.\r
+ @param Iso639Language A bool value to signify if the handler is operated on ISO639 or RFC4646.\r
\r
@retval the language string in the language codes.\r
\r
//\r
// When setting PlatformLang, firstly get most matched language string from supported language codes.\r
//\r
- BestPlatformLang = GetBestLanguage(mVariableModuleGlobal->PlatformLangCodes, FALSE, Data);\r
+ BestPlatformLang = GetBestLanguage(mVariableModuleGlobal->PlatformLangCodes, FALSE, Data, NULL);\r
\r
//\r
// Get the corresponding index in language codes.\r
Index = GetIndexFromSupportedLangCodes(mVariableModuleGlobal->PlatformLangCodes, BestPlatformLang, FALSE);\r
\r
//\r
- // Get the corresponding ISO639 language tag according to RFC3066 language tag.\r
+ // Get the corresponding ISO639 language tag according to RFC4646 language tag.\r
//\r
BestLang = GetLangFromSupportedLangCodes(mVariableModuleGlobal->LangCodes, Index, TRUE);\r
\r
//\r
// When setting Lang, firstly get most matched language string from supported language codes.\r
//\r
- BestLang = GetBestLanguage(mVariableModuleGlobal->LangCodes, TRUE, Data);\r
+ BestLang = GetBestLanguage(mVariableModuleGlobal->LangCodes, TRUE, Data, NULL);\r
\r
//\r
// Get the corresponding index in language codes.\r
Index = GetIndexFromSupportedLangCodes(mVariableModuleGlobal->LangCodes, BestLang, TRUE);\r
\r
//\r
- // Get the corresponding RFC3066 language tag according to ISO639 language tag.\r
+ // Get the corresponding RFC4646 language tag according to ISO639 language tag.\r
//\r
BestPlatformLang = GetLangFromSupportedLangCodes(mVariableModuleGlobal->PlatformLangCodes, Index, FALSE);\r
\r
FindVariable(L"PlatformLang", &gEfiGlobalVariableGuid, &Variable, (VARIABLE_GLOBAL *)mVariableModuleGlobal);\r
\r
Status = UpdateVariable(L"PlatformLang", &gEfiGlobalVariableGuid, \r
- BestPlatformLang, AsciiStrLen (BestPlatformLang), Attributes, &Variable);\r
+ BestPlatformLang, AsciiStrSize (BestPlatformLang), Attributes, &Variable);\r
\r
DEBUG((EFI_D_INFO, "Variable Driver Auto Update Lang, Lang:%a, PlatformLang:%a\n", BestLang, BestPlatformLang));\r
ASSERT_EFI_ERROR(Status);\r
VARIABLE_STORE_HEADER *VariableStoreHeader[2];\r
UINTN Index;\r
\r
- //\r
- // We aquire the lock at the entry of FindVariable as GetVariable, GetNextVariableName\r
- // SetVariable all call FindVariable at entry point. Please move "Aquire Lock" to\r
- // the correct places if this assumption does not hold TRUE anymore.\r
- //\r
- AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);\r
-\r
//\r
// 0: Non-Volatile, 1: Volatile\r
//\r
if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
+\r
+ AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);\r
+\r
//\r
// Find existing variable\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);\r
+\r
Status = FindVariable (VariableName, VendorGuid, &Variable, Global);\r
\r
if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {\r
} \r
}\r
\r
+ AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);\r
+\r
//\r
// Check whether the input variable is already existed\r
//\r