public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API
@ 2018-05-28  7:30 Liming Gao
  2018-05-28  7:30 ` [Patch 1/3] MdePkg UefiLib: Use comparison logic to check UINTN parameter Liming Gao
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Liming Gao @ 2018-05-28  7:30 UTC (permalink / raw)
  To: edk2-devel

Liming Gao (3):
  MdePkg UefiLib: Use comparison logic to check UINTN parameter
  IntelFrameworkPkg UefiLib: Use comparison logic to check UINTN
    parameter
  MdeModulePkg Variable: Use comparison logic to check UINTN parameter

 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c        | 6 +++---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 8 ++++----
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c       | 8 ++++----
 MdePkg/Library/UefiLib/UefiLib.c                            | 6 +++---
 4 files changed, 14 insertions(+), 14 deletions(-)

-- 
2.8.0.windows.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Patch 1/3] MdePkg UefiLib: Use comparison logic to check UINTN parameter
  2018-05-28  7:30 [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Liming Gao
@ 2018-05-28  7:30 ` Liming Gao
  2018-05-28  7:30 ` [Patch 2/3] IntelFrameworkPkg " Liming Gao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Liming Gao @ 2018-05-28  7:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael Kinney

Commit d2aafe1e410c80d1046f2d1e743055882ead8489 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: Michael Kinney <michael.d.kinney@intel.com>
---
 MdePkg/Library/UefiLib/UefiLib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index 23faa63..888519d 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -1538,7 +1538,7 @@ GetBestLanguage (
     //
     // 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++);
     }
 
@@ -1553,7 +1553,7 @@ GetBestLanguage (
         //
         // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
         //
-        if (!Iso639Language) {
+        if (Iso639Language == 0) {
           //
           // Skip ';' characters in Supported
           //
@@ -1585,7 +1585,7 @@ GetBestLanguage (
         }
       }
 
-      if (Iso639Language) {
+      if (Iso639Language != 0) {
         //
         // If ISO 639 mode, then each language can only be tested once
         //
-- 
2.8.0.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Patch 2/3] IntelFrameworkPkg UefiLib: Use comparison logic to check UINTN parameter
  2018-05-28  7:30 [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Liming Gao
  2018-05-28  7:30 ` [Patch 1/3] MdePkg UefiLib: Use comparison logic to check UINTN parameter Liming Gao
@ 2018-05-28  7:30 ` Liming Gao
  2018-05-28  7:30 ` [Patch 3/3] MdeModulePkg Variable: " Liming Gao
  2018-05-28  7:53 ` [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Zeng, Star
  3 siblings, 0 replies; 7+ messages in thread
From: Liming Gao @ 2018-05-28  7:30 UTC (permalink / raw)
  To: edk2-devel

Commit cb96e7d4f7afdbaef0706f9251ae479639d85a28 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>
---
 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
index 1d71f47..819795b 100644
--- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
+++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
@@ -1510,7 +1510,7 @@ GetBestLanguage (
     //
     // 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++);
     }
 
@@ -1525,7 +1525,7 @@ GetBestLanguage (
         //
         // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
         //
-        if (!Iso639Language) {
+        if (Iso639Language == 0) {
           //
           // Skip ';' characters in Supported
           //
@@ -1557,7 +1557,7 @@ GetBestLanguage (
         }
       }
 
-      if (Iso639Language) {
+      if (Iso639Language != 0) {
         //
         // If ISO 639 mode, then each language can only be tested once
         //
-- 
2.8.0.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Patch 3/3] MdeModulePkg Variable: Use comparison logic to check UINTN parameter
  2018-05-28  7:30 [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Liming Gao
  2018-05-28  7:30 ` [Patch 1/3] MdePkg UefiLib: Use comparison logic to check UINTN parameter Liming Gao
  2018-05-28  7:30 ` [Patch 2/3] IntelFrameworkPkg " Liming Gao
@ 2018-05-28  7:30 ` Liming Gao
  2018-05-28  7:53 ` [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Zeng, Star
  3 siblings, 0 replies; 7+ messages in thread
From: Liming Gao @ 2018-05-28  7:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng

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>
---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 8 ++++----
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c       | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
index 8ad2c71..e37d0cd 100644
--- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
+++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
@@ -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 5eff808..6073315 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -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
         //
-- 
2.8.0.windows.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API
  2018-05-28  7:30 [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Liming Gao
                   ` (2 preceding siblings ...)
  2018-05-28  7:30 ` [Patch 3/3] MdeModulePkg Variable: " Liming Gao
@ 2018-05-28  7:53 ` Zeng, Star
  2018-05-28  8:10   ` Marvin H?user
  3 siblings, 1 reply; 7+ messages in thread
From: Zeng, Star @ 2018-05-28  7:53 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Monday, May 28, 2018 3:31 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API

Liming Gao (3):
  MdePkg UefiLib: Use comparison logic to check UINTN parameter
  IntelFrameworkPkg UefiLib: Use comparison logic to check UINTN
    parameter
  MdeModulePkg Variable: Use comparison logic to check UINTN parameter

 IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c        | 6 +++---
 MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 8 ++++----
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c       | 8 ++++----
 MdePkg/Library/UefiLib/UefiLib.c                            | 6 +++---
 4 files changed, 14 insertions(+), 14 deletions(-)

-- 
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API
  2018-05-28  7:53 ` [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Zeng, Star
@ 2018-05-28  8:10   ` Marvin H?user
  2018-05-29  3:36     ` Gao, Liming
  0 siblings, 1 reply; 7+ messages in thread
From: Marvin H?user @ 2018-05-28  8:10 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zeng, Star, liming.gao@intel.com

Hey Star and Liming,

May I propose re-considering the introduction of a third named parameter to reflect the first Language passed?
This would 1) have the advantage that the BOOLEAN parameter can remain as is, which increases readability and
2) require at least two parameters related to the language list passed. Having to write "NULL, NULL" is way more obvious than just having to write "NULL" when (accidentally?) not passing any language.

And error caused by this change would be calls that do not pass an expected amount of parameters for the call to make sense.

Thanks,
Marvin.

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Zeng,
> Star
> Sent: Monday, May 28, 2018 9:54 AM
> To: Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>
> Subject: Re: [edk2] [Patch 0/3] Use comparison logic to check UINTN
> parameter in GetBestLanguage API
> 
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Liming Gao
> Sent: Monday, May 28, 2018 3:31 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch 0/3] Use comparison logic to check UINTN parameter
> in GetBestLanguage API
> 
> Liming Gao (3):
>   MdePkg UefiLib: Use comparison logic to check UINTN parameter
>   IntelFrameworkPkg UefiLib: Use comparison logic to check UINTN
>     parameter
>   MdeModulePkg Variable: Use comparison logic to check UINTN parameter
> 
>  IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c        | 6 +++---
>  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 8
> ++++----
>  MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c       | 8 ++++----
>  MdePkg/Library/UefiLib/UefiLib.c                            | 6 +++---
>  4 files changed, 14 insertions(+), 14 deletions(-)
> 
> --
> 2.8.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API
  2018-05-28  8:10   ` Marvin H?user
@ 2018-05-29  3:36     ` Gao, Liming
  0 siblings, 0 replies; 7+ messages in thread
From: Gao, Liming @ 2018-05-29  3:36 UTC (permalink / raw)
  To: Marvin H?user, edk2-devel@lists.01.org; +Cc: Zeng, Star

Marvin:
  Current solution is to keep max compatibility. 

Thanks
Liming
>-----Original Message-----
>From: Marvin H?user [mailto:Marvin.Haeuser@outlook.com]
>Sent: Monday, May 28, 2018 4:11 PM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: RE: [edk2] [Patch 0/3] Use comparison logic to check UINTN
>parameter in GetBestLanguage API
>
>Hey Star and Liming,
>
>May I propose re-considering the introduction of a third named parameter to
>reflect the first Language passed?
>This would 1) have the advantage that the BOOLEAN parameter can remain as
>is, which increases readability and
>2) require at least two parameters related to the language list passed. Having
>to write "NULL, NULL" is way more obvious than just having to write "NULL"
>when (accidentally?) not passing any language.
>
>And error caused by this change would be calls that do not pass an expected
>amount of parameters for the call to make sense.
>
>Thanks,
>Marvin.
>
>> -----Original Message-----
>> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Zeng,
>> Star
>> Sent: Monday, May 28, 2018 9:54 AM
>> To: Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
>> Cc: Zeng, Star <star.zeng@intel.com>
>> Subject: Re: [edk2] [Patch 0/3] Use comparison logic to check UINTN
>> parameter in GetBestLanguage API
>>
>> Reviewed-by: Star Zeng <star.zeng@intel.com>
>>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Liming Gao
>> Sent: Monday, May 28, 2018 3:31 PM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] [Patch 0/3] Use comparison logic to check UINTN parameter
>> in GetBestLanguage API
>>
>> Liming Gao (3):
>>   MdePkg UefiLib: Use comparison logic to check UINTN parameter
>>   IntelFrameworkPkg UefiLib: Use comparison logic to check UINTN
>>     parameter
>>   MdeModulePkg Variable: Use comparison logic to check UINTN parameter
>>
>>  IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c        | 6 +++---
>>  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 8
>> ++++----
>>  MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c       | 8 ++++----
>>  MdePkg/Library/UefiLib/UefiLib.c                            | 6 +++---
>>  4 files changed, 14 insertions(+), 14 deletions(-)
>>
>> --
>> 2.8.0.windows.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-29  4:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28  7:30 [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Liming Gao
2018-05-28  7:30 ` [Patch 1/3] MdePkg UefiLib: Use comparison logic to check UINTN parameter Liming Gao
2018-05-28  7:30 ` [Patch 2/3] IntelFrameworkPkg " Liming Gao
2018-05-28  7:30 ` [Patch 3/3] MdeModulePkg Variable: " Liming Gao
2018-05-28  7:53 ` [Patch 0/3] Use comparison logic to check UINTN parameter in GetBestLanguage API Zeng, Star
2018-05-28  8:10   ` Marvin H?user
2018-05-29  3:36     ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox