]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
IntelFrameworkModulePkg: Replace [Ascii|Unicode]ValueToString
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / MemoryTest.c
index 5a6fa78553280b50ad621273c852915de379b46c..118808201d1f02db454ff6d34f346bcfe9de303e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Perform the platform memory test\r
 \r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -318,13 +318,18 @@ BdsMemoryTest (
                               TempData\r
                               );\r
       if (TestPercent != PreviousValue) {\r
-        UnicodeValueToString (StrPercent, 0, TestPercent, 0);\r
+        UnicodeValueToStringS (StrPercent, sizeof (StrPercent), 0, TestPercent, 0);\r
         TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));\r
         if (TmpStr != NULL) {\r
           //\r
           // TmpStr size is 64, StrPercent is reserved to 16.\r
           //\r
-          StrnCat (StrPercent, TmpStr, sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1);\r
+          StrnCatS (\r
+            StrPercent,\r
+            sizeof (StrPercent) / sizeof (CHAR16), \r
+            TmpStr,\r
+            sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1\r
+            );\r
           PrintXY (10, 10, NULL, NULL, StrPercent);\r
           FreePool (TmpStr);\r
         }\r
@@ -381,7 +386,7 @@ BdsMemoryTest (
 \r
 Done:\r
   if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
-    UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);\r
+    UnicodeValueToStringS (StrTotalMemory, StrTotalMemorySize, COMMA_TYPE, TotalMemorySize, 0);\r
     if (StrTotalMemory[0] == L',') {\r
       StrTotalMemory++;\r
       StrTotalMemorySize -= sizeof (CHAR16);\r
@@ -389,7 +394,12 @@ Done:
 \r
     TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));\r
     if (TmpStr != NULL) {\r
-      StrnCat (StrTotalMemory, TmpStr, StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1);\r
+      StrnCatS (\r
+        StrTotalMemory,\r
+        StrTotalMemorySize / sizeof (CHAR16),\r
+        TmpStr,\r
+        StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1\r
+        );\r
       FreePool (TmpStr);\r
     }\r
 \r
@@ -416,7 +426,10 @@ Done:
   //\r
   IsFirstBoot = PcdGetBool(PcdBootState);\r
   if (IsFirstBoot) {\r
-    PcdSetBool(PcdBootState, FALSE);\r
+    Status = PcdSetBoolS(PcdBootState, FALSE);\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "Set PcdBootState to FALSE failed.\n"));\r
+    }\r
   }\r
 \r
   return ReturnStatus;\r