]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Remove ASSERT
authorJaben Carsey <jaben.carsey@intel.com>
Thu, 16 Jan 2014 16:52:39 +0000 (16:52 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 16 Jan 2014 16:52:39 +0000 (16:52 +0000)
This change removes ASSERT statements and replaces them with logic to break out of the loop.  This both prevents spinning forever and prevents processing the returned data from the function that failed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15133 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellLib/UefiShellLib.c

index 9b58786756bfb0ab63a45baaa1ca630d9eab8a55..10c6b592fdf10e872898d254d05c3df0a04a907e 100644 (file)
@@ -3280,7 +3280,9 @@ ShellPromptForResponse (
       //\r
       gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
       Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-      ASSERT_EFI_ERROR(Status);\r
+      if (EFI_ERROR(Status)) {\r
+        break;\r
+      }\r
       ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);\r
       if (Key.UnicodeChar == L'Q' || Key.UnicodeChar ==L'q') {\r
         *Resp = ShellPromptResponseQuit;\r
@@ -3303,7 +3305,9 @@ ShellPromptForResponse (
         }\r
         gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
         Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-        ASSERT_EFI_ERROR(Status);\r
+        if (EFI_ERROR(Status)) {\r
+          break;\r
+        }\r
         ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);\r
         switch (Key.UnicodeChar) {\r
           case L'Y':\r
@@ -3335,7 +3339,9 @@ ShellPromptForResponse (
         }\r
         gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
         Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-        ASSERT_EFI_ERROR(Status);\r
+        if (EFI_ERROR(Status)) {\r
+          break;\r
+        }\r
         ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);\r
         switch (Key.UnicodeChar) {\r
           case L'Y':\r
@@ -3374,7 +3380,9 @@ ShellPromptForResponse (
         gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
         if (Type == ShellPromptResponseTypeEnterContinue) {\r
           Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-          ASSERT_EFI_ERROR(Status);\r
+          if (EFI_ERROR(Status)) {\r
+            break;\r
+          }\r
           ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);\r
           if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {\r
             *Resp = ShellPromptResponseContinue;\r
@@ -3404,7 +3412,9 @@ ShellPromptForResponse (
         }\r
         gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
         Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-        ASSERT_EFI_ERROR(Status);\r
+        if (EFI_ERROR(Status)) {\r
+          break;\r
+        }\r
         ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);\r
         switch (Key.UnicodeChar) {\r
           case L'Y':\r
@@ -3429,7 +3439,9 @@ ShellPromptForResponse (
         }\r
         gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
         Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-        ASSERT_EFI_ERROR(Status);\r
+        if (EFI_ERROR(Status)) {\r
+          break;\r
+        }\r
         ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);\r
         if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {\r
           break;\r