From 31b018a663be0fb23f3a4f612aaedf86a8bd10fc Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Thu, 16 Jan 2014 16:52:39 +0000 Subject: [PATCH] ShellPkg: Remove ASSERT 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 Reviewed-by: Ruiyu Ni git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15133 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 9b58786756..10c6b592fd 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -3280,7 +3280,9 @@ ShellPromptForResponse ( // gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + break; + } ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); if (Key.UnicodeChar == L'Q' || Key.UnicodeChar ==L'q') { *Resp = ShellPromptResponseQuit; @@ -3303,7 +3305,9 @@ ShellPromptForResponse ( } gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + break; + } ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); switch (Key.UnicodeChar) { case L'Y': @@ -3335,7 +3339,9 @@ ShellPromptForResponse ( } gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + break; + } ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); switch (Key.UnicodeChar) { case L'Y': @@ -3374,7 +3380,9 @@ ShellPromptForResponse ( gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); if (Type == ShellPromptResponseTypeEnterContinue) { Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + break; + } ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { *Resp = ShellPromptResponseContinue; @@ -3404,7 +3412,9 @@ ShellPromptForResponse ( } gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + break; + } ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); switch (Key.UnicodeChar) { case L'Y': @@ -3429,7 +3439,9 @@ ShellPromptForResponse ( } gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + break; + } ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { break; -- 2.39.2