From: Liming Gao Date: Mon, 28 May 2018 07:30:52 +0000 (+0800) Subject: MdeModulePkg Variable: Use comparison logic to check UINTN parameter X-Git-Tag: edk2-stable201903~1607 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=051bf6e0af59741116a3f68bce7ed6d79fc801ab MdeModulePkg Variable: Use comparison logic to check UINTN parameter Commit 180ac200da84785989443b06bcfa5db343c0bf7e changes the input parameter from BOOLEAN to UINTN. Its comparison logic should be updated. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Star Zeng Reviewed-by: Star Zeng --- diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c index 8ad2c7168d..8202d37daa 100644 --- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c +++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c @@ -3,7 +3,7 @@ Emulation Variable services operate on the runtime volatile memory. The nonvolatile variable space doesn't exist. -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -546,8 +546,8 @@ GetLangFromSupportedLangCodes ( @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that contains a set of language codes in the format specified by Iso639Language. - @param[in] Iso639Language If TRUE, then all language codes are assumed to be - in ISO 639-2 format. If FALSE, then all language + @param[in] Iso639Language If not zero, then all language codes are assumed to be + in ISO 639-2 format. If zero, then all language codes are assumed to be in RFC 4646 language format @param[in] ... A variable argument list that contains pointers to Null-terminated ASCII strings that contain one or more @@ -599,7 +599,7 @@ VariableGetBestLanguage ( // // If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language // - if (!Iso639Language) { + if (Iso639Language == 0) { for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++); } @@ -614,7 +614,7 @@ VariableGetBestLanguage ( // // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages // - if (!Iso639Language) { + if (Iso639Language == 0) { // // Skip ';' characters in Supported // @@ -636,13 +636,13 @@ VariableGetBestLanguage ( if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) { VA_END (Args); - Buffer = Iso639Language ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang; + Buffer = (Iso639Language != 0) ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang; Buffer[CompareLength] = '\0'; return CopyMem (Buffer, Supported, CompareLength); } } - if (Iso639Language) { + if (Iso639Language != 0) { // // If ISO 639 mode, then each language can only be tested once // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 5eff808035..835a66bc3b 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -16,7 +16,7 @@ VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow, integer overflow. It should also check attribute to avoid authentication bypass. -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -1533,8 +1533,8 @@ GetLangFromSupportedLangCodes ( @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that contains a set of language codes in the format specified by Iso639Language. - @param[in] Iso639Language If TRUE, then all language codes are assumed to be - in ISO 639-2 format. If FALSE, then all language + @param[in] Iso639Language If not zero, then all language codes are assumed to be + in ISO 639-2 format. If zero, then all language codes are assumed to be in RFC 4646 language format @param[in] ... A variable argument list that contains pointers to Null-terminated ASCII strings that contain one or more @@ -1588,7 +1588,7 @@ VariableGetBestLanguage ( // // If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language // - if (!Iso639Language) { + if (Iso639Language == 0) { for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++); } @@ -1603,7 +1603,7 @@ VariableGetBestLanguage ( // // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages // - if (!Iso639Language) { + if (Iso639Language == 0) { // // Skip ';' characters in Supported // @@ -1625,13 +1625,13 @@ VariableGetBestLanguage ( if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) { VA_END (Args); - Buffer = Iso639Language ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang; + Buffer = (Iso639Language != 0) ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang; Buffer[CompareLength] = '\0'; return CopyMem (Buffer, Supported, CompareLength); } } - if (Iso639Language) { + if (Iso639Language != 0) { // // If ISO 639 mode, then each language can only be tested once //