]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove ASSERT within Ls for RTC error and associated changes.
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 25 May 2011 22:29:40 +0000 (22:29 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 25 May 2011 22:29:40 +0000 (22:29 +0000)
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
ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni

index 64dfae32913dad630903e9f633fe24f308f54647..ac71350ef460e37014df07ecbad623f7b38f7532 100644 (file)
@@ -538,7 +538,11 @@ ShellCommandRunLs (
           StrnCatGrow(&FullPath, NULL, L"*", 0);\r
         }\r
         Status = gRT->GetTime(&TheTime, NULL);\r
-        ASSERT_EFI_ERROR(Status);\r
+        if (EFI_ERROR(Status)) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status);\r
+          TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
+        }\r
+\r
         SfoMode = ShellCommandLineGetFlag(Package, L"-sfo");\r
         if (ShellStatus == SHELL_SUCCESS) {\r
           ShellStatus = PrintLsOutput(\r
@@ -548,7 +552,7 @@ ShellCommandRunLs (
             FullPath,\r
             TRUE,\r
             Count,\r
-            (INT16)(TheTime.TimeZone==2047?0:TheTime.TimeZone)\r
+            (INT16)(TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:TheTime.TimeZone)\r
            );\r
           if (ShellStatus == SHELL_NOT_FOUND) {\r
             ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_FILES), gShellLevel2HiiHandle);\r
index abefee3f3a4bf9c397a493a7a85b40008eb98e39..80ababbb6a8488dada513a645a4a1e19004cd7f2 100644 (file)
@@ -430,7 +430,7 @@ ShellCommandRunTime (
         //\r
         // ShellPrintEx the current time\r
         //\r
-        if (TheTime.TimeZone == 2047) {\r
+        if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {\r
           TzMinutes = 0;\r
         } else {\r
           TzMinutes = (ABS(TheTime.TimeZone)) % 60;\r
@@ -445,13 +445,13 @@ ShellCommandRunTime (
           TheTime.Hour,\r
           TheTime.Minute,\r
           TheTime.Second,\r
-          TheTime.TimeZone==2047?L" ":(TheTime.TimeZone > 0?L"-":L"+"),\r
-          TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60,\r
+          TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"),\r
+          TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60,\r
           TzMinutes\r
          );\r
          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle);\r
       } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) {\r
-        if (TheTime.TimeZone == 2047) {\r
+        if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {\r
           TzMinutes = 0;\r
         } else {\r
           TzMinutes = (ABS(TheTime.TimeZone)) % 60;\r
@@ -466,8 +466,8 @@ ShellCommandRunTime (
           TheTime.Hour,\r
           TheTime.Minute,\r
           TheTime.Second,\r
-          TheTime.TimeZone==2047?L" ":(TheTime.TimeZone > 0?L"-":L"+"),\r
-          TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60,\r
+          TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"),\r
+          TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60,\r
           TzMinutes\r
          );\r
           switch (TheTime.Daylight) {\r
@@ -500,7 +500,7 @@ ShellCommandRunTime (
             } else {\r
               Tz = (INT16)ShellStrToUintn(TempLocation);\r
             }\r
-            if (!(Tz >= -1440 && Tz <= 1440) && Tz != 2047) {\r
+            if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) {\r
               ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-tz");\r
               ShellStatus = SHELL_INVALID_PARAMETER;\r
             }\r
@@ -776,7 +776,7 @@ ShellCommandRunTimeZone (
       Status = gRT->GetTime(&TheTime, NULL);\r
       ASSERT_EFI_ERROR(Status);\r
 \r
-      if (TheTime.TimeZone != 2047) {\r
+      if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) {\r
         Found = FALSE;\r
         for ( LoopVar = 0\r
             ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0])\r
@@ -792,7 +792,7 @@ ShellCommandRunTimeZone (
               //\r
               // Print basic info only\r
               //\r
-              if (TheTime.TimeZone == 2047) {\r
+              if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {\r
                 TzMinutes = 0;\r
               } else {\r
                 TzMinutes = (ABS(TheTime.TimeZone)) % 60;\r
@@ -804,8 +804,8 @@ ShellCommandRunTimeZone (
                 NULL,\r
                 STRING_TOKEN(STR_TIMEZONE_SIMPLE),\r
                 gShellLevel2HiiHandle,\r
-                TheTime.TimeZone==2047?0:(TheTime.TimeZone > 0?L"-":L"+"),\r
-                TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60,\r
+                TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"),\r
+                TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60,\r
                 TzMinutes);\r
             }\r
             Found = TRUE;\r
@@ -816,7 +816,7 @@ ShellCommandRunTimeZone (
           //\r
           // Print basic info only\r
           //\r
-          if (TheTime.TimeZone == 2047) {\r
+          if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) {\r
             TzMinutes = 0;\r
           } else {\r
             TzMinutes = (ABS(TheTime.TimeZone)) % 60;\r
@@ -827,8 +827,8 @@ ShellCommandRunTimeZone (
             NULL,\r
             STRING_TOKEN(STR_TIMEZONE_SIMPLE),\r
             gShellLevel2HiiHandle,\r
-            TheTime.TimeZone==2047?0:(TheTime.TimeZone > 0?L"-":L"+"),\r
-            TheTime.TimeZone==2047?0:(ABS(TheTime.TimeZone)) / 60,\r
+            TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"),\r
+            TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60,\r
             TzMinutes);\r
           if (ShellCommandLineGetFlag(Package, L"-f")) {\r
             ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_NI), gShellLevel2HiiHandle);\r
@@ -836,7 +836,7 @@ ShellCommandRunTimeZone (
         }\r
       } else {\r
         //\r
-        // TimeZone was 2047 (unknown) from GetTime()\r
+        // TimeZone was EFI_UNSPECIFIED_TIMEZONE (unknown) from GetTime()\r
         //\r
       }\r
     }\r
index eaa7b2ba8fb4218824849f3623763afbdb603da0..eaaa05d65c7509fbda9d1678f72538e09127497b 100644 (file)
Binary files a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni and b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni differ