]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg: Replace [Ascii|Unicode]ValueToString
authorHao Wu <hao.a.wu@intel.com>
Tue, 17 Jan 2017 01:00:26 +0000 (09:00 +0800)
committerHao Wu <hao.a.wu@intel.com>
Thu, 2 Mar 2017 01:57:54 +0000 (09:57 +0800)
It is the follow up of commits 51f0ceb..9e32e97 to replace
AsciiValueToString/UnicodeValueToString with
AsciiValueToStringS/UnicodeValueToStringS.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c

index a2e38d2ee899222c8e7864e2ce060101671fcfa8..bdf26141d842de3887298b320d2421c8cfd0c3dc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Dynamically update the pages.\r
 \r
 /** @file\r
 Dynamically update the pages.\r
 \r
-Copyright (c) 2004 - 2016, 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
 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
@@ -844,11 +844,17 @@ UpdateConModePage (
     //\r
     // Build mode string Column x Row\r
     //\r
     //\r
     // Build mode string Column x Row\r
     //\r
-    UnicodeValueToString (ModeString, 0, Col, 0);\r
+    UnicodeValueToStringS (ModeString, sizeof (ModeString), 0, Col, 0);\r
     PStr = &ModeString[0];\r
     StrCatS (PStr, ARRAY_SIZE (ModeString), L" x ");\r
     PStr = PStr + StrLen (PStr);\r
     PStr = &ModeString[0];\r
     StrCatS (PStr, ARRAY_SIZE (ModeString), L" x ");\r
     PStr = PStr + StrLen (PStr);\r
-    UnicodeValueToString (PStr , 0, Row, 0);\r
+    UnicodeValueToStringS (\r
+      PStr,\r
+      sizeof (ModeString) - ((UINTN)PStr - (UINTN)&ModeString[0]),\r
+      0,\r
+      Row,\r
+      0\r
+      );\r
 \r
     ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);\r
 \r
 \r
     ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);\r
 \r
index af2b18a047e524da3a1c2e32f76903b4909ea366..125c49db5edb63f1f01371f16bfe1a5cc31eb6ef 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform device manager reference implementation\r
 \r
 /** @file\r
   The platform device manager reference implementation\r
 \r
-Copyright (c) 2004 - 2015, 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
 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
@@ -388,7 +388,14 @@ GetMacAddressString(
   //\r
   HwAddress = &MacAddressNode->MacAddress.Addr[0];\r
   for (Index = 0; Index < HwAddressSize; Index++) {\r
   //\r
   HwAddress = &MacAddressNode->MacAddress.Addr[0];\r
   for (Index = 0; Index < HwAddressSize; Index++) {\r
-    String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);\r
+    UnicodeValueToStringS (\r
+      String,\r
+      BufferLen - ((UINTN)String - (UINTN)*PBuffer),\r
+      PREFIX_ZERO | RADIX_HEX,\r
+      *(HwAddress++),\r
+      2\r
+      );\r
+    String += StrnLenS (String, (BufferLen - ((UINTN)String - (UINTN)*PBuffer)) / sizeof (CHAR16));\r
     if (Index < HwAddressSize - 1) {\r
       *String++ = L':';\r
     }\r
     if (Index < HwAddressSize - 1) {\r
       *String++ = L':';\r
     }\r
@@ -408,7 +415,14 @@ GetMacAddressString(
 \r
   if (VlanId != 0) {\r
     *String++ = L'\\';\r
 \r
   if (VlanId != 0) {\r
     *String++ = L'\\';\r
-    String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, VlanId, 4);\r
+    UnicodeValueToStringS (\r
+      String,\r
+      BufferLen - ((UINTN)String - (UINTN)*PBuffer),\r
+      PREFIX_ZERO | RADIX_HEX,\r
+      VlanId,\r
+      4\r
+      );\r
+    String += StrnLenS (String, (BufferLen - ((UINTN)String - (UINTN)*PBuffer)) / sizeof (CHAR16));\r
   }\r
 \r
   //\r
   }\r
 \r
   //\r
index c771974ca0d2b68e1016372812eae9f31c3ac2d4..ec9142245a46d7a3837ba2e90d87759a458ea228 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FrontPage routines to handle the callbacks and browser calls\r
 \r
 /** @file\r
   FrontPage routines to handle the callbacks and browser calls\r
 \r
-Copyright (c) 2004 - 2016, 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
 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
@@ -629,9 +629,16 @@ ConvertProcessorToString (
 \r
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
 \r
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
-  Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);\r
+  UnicodeValueToStringS (StringBuffer, 0x20, LEFT_JUSTIFY, FreqMhz / 1000, 3);\r
+  Index = StrnLenS (StringBuffer, 0x20 / sizeof (CHAR16));\r
   StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L".");\r
   StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L".");\r
-  UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);\r
+  UnicodeValueToStringS (\r
+    StringBuffer + Index + 1,\r
+    0x20 - sizeof (CHAR16) * (Index + 1),\r
+    PREFIX_ZERO,\r
+    (FreqMhz % 1000) / 10,\r
+    2\r
+    );\r
   StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" GHz");\r
   *String = (CHAR16 *) StringBuffer;\r
   return ;\r
   StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" GHz");\r
   *String = (CHAR16 *) StringBuffer;\r
   return ;\r
@@ -655,7 +662,7 @@ ConvertMemorySizeToString (
 \r
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
 \r
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
-  UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);\r
+  UnicodeValueToStringS (StringBuffer, 0x20, LEFT_JUSTIFY, MemorySize, 6);\r
   StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" MB RAM");\r
 \r
   *String = (CHAR16 *) StringBuffer;\r
   StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" MB RAM");\r
 \r
   *String = (CHAR16 *) StringBuffer;\r
index 700e3e6626af83cc908bd45a235cf5ca86f4955e..118808201d1f02db454ff6d34f346bcfe9de303e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Perform the platform memory test\r
 \r
 /** @file\r
   Perform the platform memory test\r
 \r
-Copyright (c) 2004 - 2015, 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
 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,7 +318,7 @@ BdsMemoryTest (
                               TempData\r
                               );\r
       if (TestPercent != PreviousValue) {\r
                               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 = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));\r
         if (TmpStr != NULL) {\r
           //\r
@@ -386,7 +386,7 @@ BdsMemoryTest (
 \r
 Done:\r
   if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
 \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
     if (StrTotalMemory[0] == L',') {\r
       StrTotalMemory++;\r
       StrTotalMemorySize -= sizeof (CHAR16);\r