]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg Variable: Use comparison logic to check UINTN parameter
authorLiming Gao <liming.gao@intel.com>
Mon, 28 May 2018 07:30:52 +0000 (15:30 +0800)
committerLiming Gao <liming.gao@intel.com>
Tue, 12 Jun 2018 01:23:14 +0000 (09:23 +0800)
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 <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index 8ad2c7168d19dc8180b1698b79873b5ff548af30..8202d37daad041830126fed42fdb2ebd23dbc49e 100644 (file)
@@ -3,7 +3,7 @@
   Emulation Variable services operate on the runtime volatile memory.\r
   The nonvolatile variable space doesn't exist.\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -546,8 +546,8 @@ GetLangFromSupportedLangCodes (
   @param[in]  SupportedLanguages  A pointer to a Null-terminated ASCII string that\r
                                   contains a set of language codes in the format \r
                                   specified by Iso639Language.\r
-  @param[in]  Iso639Language      If TRUE, then all language codes are assumed to be\r
-                                  in ISO 639-2 format.  If FALSE, then all language\r
+  @param[in]  Iso639Language      If not zero, then all language codes are assumed to be\r
+                                  in ISO 639-2 format.  If zero, then all language\r
                                   codes are assumed to be in RFC 4646 language format\r
   @param[in]  ...                 A variable argument list that contains pointers to \r
                                   Null-terminated ASCII strings that contain one or more\r
@@ -599,7 +599,7 @@ VariableGetBestLanguage (
     //\r
     // If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language\r
     //\r
-    if (!Iso639Language) {\r
+    if (Iso639Language == 0) {\r
       for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);\r
     }\r
 \r
@@ -614,7 +614,7 @@ VariableGetBestLanguage (
         //\r
         // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages\r
         //\r
-        if (!Iso639Language) {\r
+        if (Iso639Language == 0) {\r
           //\r
           // Skip ';' characters in Supported\r
           //\r
@@ -636,13 +636,13 @@ VariableGetBestLanguage (
         if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {\r
           VA_END (Args);\r
 \r
-          Buffer = Iso639Language ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;\r
+          Buffer = (Iso639Language != 0) ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;\r
           Buffer[CompareLength] = '\0';\r
           return CopyMem (Buffer, Supported, CompareLength);\r
         }\r
       }\r
 \r
-      if (Iso639Language) {\r
+      if (Iso639Language != 0) {\r
         //\r
         // If ISO 639 mode, then each language can only be tested once\r
         //\r
index 5eff808035290a7da3be60a5db92d21ea06b5dd8..835a66bc3bc8f8f4a2dfa6ad75ffdebed96cd6bf 100644 (file)
@@ -16,7 +16,7 @@
   VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow,\r
   integer overflow. It should also check attribute to avoid authentication bypass.\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -1533,8 +1533,8 @@ GetLangFromSupportedLangCodes (
   @param[in]  SupportedLanguages  A pointer to a Null-terminated ASCII string that\r
                                   contains a set of language codes in the format\r
                                   specified by Iso639Language.\r
-  @param[in]  Iso639Language      If TRUE, then all language codes are assumed to be\r
-                                  in ISO 639-2 format.  If FALSE, then all language\r
+  @param[in]  Iso639Language      If not zero, then all language codes are assumed to be\r
+                                  in ISO 639-2 format.  If zero, then all language\r
                                   codes are assumed to be in RFC 4646 language format\r
   @param[in]  ...                 A variable argument list that contains pointers to\r
                                   Null-terminated ASCII strings that contain one or more\r
@@ -1588,7 +1588,7 @@ VariableGetBestLanguage (
     //\r
     // If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language\r
     //\r
-    if (!Iso639Language) {\r
+    if (Iso639Language == 0) {\r
       for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);\r
     }\r
 \r
@@ -1603,7 +1603,7 @@ VariableGetBestLanguage (
         //\r
         // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages\r
         //\r
-        if (!Iso639Language) {\r
+        if (Iso639Language == 0) {\r
           //\r
           // Skip ';' characters in Supported\r
           //\r
@@ -1625,13 +1625,13 @@ VariableGetBestLanguage (
         if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {\r
           VA_END (Args);\r
 \r
-          Buffer = Iso639Language ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;\r
+          Buffer = (Iso639Language != 0) ? mVariableModuleGlobal->Lang : mVariableModuleGlobal->PlatformLang;\r
           Buffer[CompareLength] = '\0';\r
           return CopyMem (Buffer, Supported, CompareLength);\r
         }\r
       }\r
 \r
-      if (Iso639Language) {\r
+      if (Iso639Language != 0) {\r
         //\r
         // If ISO 639 mode, then each language can only be tested once\r
         //\r