From 2e8e9ed5ed0a348946c585ceecf611a2cec7f6da Mon Sep 17 00:00:00 2001 From: jcarsey Date: Wed, 25 May 2011 22:29:40 +0000 Subject: Remove ASSERT within Ls for RTC error and associated changes. TimeDate.c: replace magic number with constant. Ls.c: use new warning printout string and remove an ASSERT. also replace magic number with constant. The UNI file: add new warning printout string. Signed-off-by: jcarsey Reviewed-by: geekboy15a Reviewed-by: lgrosenb git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11703 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 8 ++++-- .../Library/UefiShellLevel2CommandsLib/TimeDate.c | 30 ++++++++++----------- .../UefiShellLevel2CommandsLib.uni | Bin 111268 -> 111482 bytes 3 files changed, 21 insertions(+), 17 deletions(-) (limited to 'ShellPkg') diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index 64dfae3291..ac71350ef4 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -538,7 +538,11 @@ ShellCommandRunLs ( StrnCatGrow(&FullPath, NULL, L"*", 0); } Status = gRT->GetTime(&TheTime, NULL); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); + TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE; + } + SfoMode = ShellCommandLineGetFlag(Package, L"-sfo"); if (ShellStatus == SHELL_SUCCESS) { ShellStatus = PrintLsOutput( @@ -548,7 +552,7 @@ ShellCommandRunLs ( FullPath, TRUE, Count, - (INT16)(TheTime.TimeZone==2047?0:TheTime.TimeZone) + (INT16)(TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:TheTime.TimeZone) ); if (ShellStatus == SHELL_NOT_FOUND) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_FILES), gShellLevel2HiiHandle); diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c index abefee3f3a..80ababbb6a 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c @@ -430,7 +430,7 @@ ShellCommandRunTime ( // // ShellPrintEx the current time // - if (TheTime.TimeZone == 2047) { + if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; @@ -445,13 +445,13 @@ ShellCommandRunTime ( TheTime.Hour, TheTime.Minute, TheTime.Second, - TheTime.TimeZone==2047?L" ":(TheTime.TimeZone > 0?L"-":L"+"), - TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60, + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"), + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes ); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle); } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) { - if (TheTime.TimeZone == 2047) { + if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; @@ -466,8 +466,8 @@ ShellCommandRunTime ( TheTime.Hour, TheTime.Minute, TheTime.Second, - TheTime.TimeZone==2047?L" ":(TheTime.TimeZone > 0?L"-":L"+"), - TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60, + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"), + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes ); switch (TheTime.Daylight) { @@ -500,7 +500,7 @@ ShellCommandRunTime ( } else { Tz = (INT16)ShellStrToUintn(TempLocation); } - if (!(Tz >= -1440 && Tz <= 1440) && Tz != 2047) { + if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-tz"); ShellStatus = SHELL_INVALID_PARAMETER; } @@ -776,7 +776,7 @@ ShellCommandRunTimeZone ( Status = gRT->GetTime(&TheTime, NULL); ASSERT_EFI_ERROR(Status); - if (TheTime.TimeZone != 2047) { + if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { Found = FALSE; for ( LoopVar = 0 ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0]) @@ -792,7 +792,7 @@ ShellCommandRunTimeZone ( // // Print basic info only // - if (TheTime.TimeZone == 2047) { + if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; @@ -804,8 +804,8 @@ ShellCommandRunTimeZone ( NULL, STRING_TOKEN(STR_TIMEZONE_SIMPLE), gShellLevel2HiiHandle, - TheTime.TimeZone==2047?0:(TheTime.TimeZone > 0?L"-":L"+"), - TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60, + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"), + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes); } Found = TRUE; @@ -816,7 +816,7 @@ ShellCommandRunTimeZone ( // // Print basic info only // - if (TheTime.TimeZone == 2047) { + if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; @@ -827,8 +827,8 @@ ShellCommandRunTimeZone ( NULL, STRING_TOKEN(STR_TIMEZONE_SIMPLE), gShellLevel2HiiHandle, - TheTime.TimeZone==2047?0:(TheTime.TimeZone > 0?L"-":L"+"), - TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60, + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"), + TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes); if (ShellCommandLineGetFlag(Package, L"-f")) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_NI), gShellLevel2HiiHandle); @@ -836,7 +836,7 @@ ShellCommandRunTimeZone ( } } else { // - // TimeZone was 2047 (unknown) from GetTime() + // TimeZone was EFI_UNSPECIFIED_TIMEZONE (unknown) from GetTime() // } } diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni index eaa7b2ba8f..eaaa05d65c 100644 Binary files a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni and b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni differ -- cgit v1.2.3