public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [BugFix] ShellPkg: UefiShellLevel1CommandLib: Fix a logic issue about "if /i"
@ 2018-03-08  8:07 Zane Zhange
  0 siblings, 0 replies; only message in thread
From: Zane Zhange @ 2018-03-08  8:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jaben Carsey, Ruiyu Ni

From: zane66 <zheng.zhang1@hp.com>

Hello All,


It is my first time to commit my change on github, there might be some errors in this email. But my change actually fixed the issue about "if /i" in Uefi Shell. Thanks.

Github Reference URL : https://github.com/zane66/edk2/tree/zane66/master

Use this shell script to duplicate this issue:
if /i /s "ax" ne "aX" then
  echo "Not Equal"
fi
The origin code will echo "Not Equal". This change can fix this issue.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zane Zhang <zheng.zhang1@hp.com>
---
 ShellPkg/Library/UefiShellLevel1CommandsLib/If.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
index 35c5ca6835..94162b2dae 100644
--- a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
+++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
@@ -141,7 +141,7 @@ TestOperation (
       //
       // string compare
       //
-      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) > 0) || (StringCompare(&Compare1, &Compare2) > 0)) {
+      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) > 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) > 0)) {
         return (TRUE);
       }
     } else {
@@ -175,7 +175,7 @@ TestOperation (
       //
       // string compare
       //
-      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) < 0) || (StringCompare(&Compare1, &Compare2) < 0)) {
+      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) < 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) < 0)) {
         return (TRUE);
       }
     } else {
@@ -209,7 +209,7 @@ TestOperation (
       //
       // string compare
       //
-      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) == 0) || (StringCompare(&Compare1, &Compare2) == 0)) {
+      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) == 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) == 0)) {
         return (TRUE);
       }
     } else {
@@ -236,7 +236,7 @@ TestOperation (
       //
       // string compare
       //
-      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) != 0) || (StringCompare(&Compare1, &Compare2) != 0)) {
+      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) != 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) != 0)) {
         return (TRUE);
       }
     } else {
@@ -264,7 +264,7 @@ TestOperation (
       //
       // string compare
       //
-      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) >= 0) || (StringCompare(&Compare1, &Compare2) >= 0)) {
+      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) >= 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) >= 0)) {
         return (TRUE);
       }
     } else {
@@ -298,7 +298,7 @@ TestOperation (
       //
       // string compare
       //
-      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) <= 0) || (StringCompare(&Compare1, &Compare2) <= 0)) {
+      if ((CaseInsensitive && StringNoCaseCompare(&Compare1, &Compare2) <= 0) || (!CaseInsensitive && StringCompare(&Compare1, &Compare2) <= 0)) {
         return (TRUE);
       }
     } else {
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-08  8:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08  8:07 [BugFix] ShellPkg: UefiShellLevel1CommandLib: Fix a logic issue about "if /i" Zane Zhange

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