]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
authorStar Zeng <star.zeng@intel.com>
Wed, 15 Jun 2016 05:40:46 +0000 (13:40 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 21 Jun 2016 04:46:27 +0000 (12:46 +0800)
It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49
to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with
UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c

index 68b32f32f0b7a40e6cf6312cc3a6c00a81b0f39a..bba62a801a51d0841ca8f768ce4588897dfcea8f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   BDS Lib functions which relate with create or process the boot option.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, 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
@@ -330,7 +330,7 @@ BdsCreateLegacyBootOption (
   //\r
   // Create new BBS device path node with description string\r
   //\r
-  UnicodeStrToAsciiStr (BootDesc, HelpString);\r
+  UnicodeStrToAsciiStrS (BootDesc, HelpString, sizeof (HelpString));\r
 \r
   StringLen = AsciiStrLen (HelpString);\r
   NewBbsDevPathNode = AllocateZeroPool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen);\r
index 1ed42d527a69a253afd9c6b92ed55dd157823bed..d3b48e8d0b9ec77f78ba50c8a6b4f78143603449 100644 (file)
@@ -3,7 +3,7 @@
   and manage the legacy boot option, all legacy boot option is getting from\r
   the legacy BBS table.\r
 \r
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, 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
@@ -183,7 +183,7 @@ LegacyBmBuildLegacyDevNameString (
     //\r
     CopyMem (StringBufferA, StringDesc, LEGACY_BM_BOOT_DESCRIPTION_LENGTH);\r
     StringBufferA[LEGACY_BM_BOOT_DESCRIPTION_LENGTH] = 0;\r
-    AsciiStrToUnicodeStr (StringBufferA, StringBufferU);\r
+    AsciiStrToUnicodeStrS (StringBufferA, StringBufferU, sizeof (StringBufferU) / sizeof (StringBufferU[0]));\r
     Fmt   = L"%s";\r
     Type  = StringBufferU;\r
   }\r
@@ -537,7 +537,7 @@ LegacyBmCreateLegacyBootOption (
   //\r
   // Create the BBS device path with description string\r
   //\r
-  UnicodeStrToAsciiStr (Description, HelpString);\r
+  UnicodeStrToAsciiStrS (Description, HelpString, sizeof (HelpString));\r
   StringLen = AsciiStrLen (HelpString);\r
   DevicePath = AllocatePool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen + END_DEVICE_PATH_LENGTH);\r
   ASSERT (DevicePath != NULL);\r
index 6958979cdc47d50339f61d412b7c79b2e6cbe0fd..9f4d32835771b0b4c85fc043499429d561b6906e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FrontPage routines to handle the callbacks and browser calls\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, 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
@@ -300,6 +300,7 @@ InitializeFrontPage (
   EFI_STATUS                  Status;\r
   CHAR8                       *LangCode;\r
   CHAR8                       *Lang;\r
+  UINTN                       LangSize;\r
   CHAR8                       *CurrentLang;\r
   UINTN                       OptionCount;\r
   CHAR16                      *StringBuffer;\r
@@ -448,9 +449,10 @@ InitializeFrontPage (
       }\r
 \r
       if (EFI_ERROR (Status)) {\r
-        StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));\r
+        LangSize = AsciiStrSize (Lang);\r
+        StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));\r
         ASSERT (StringBuffer != NULL);\r
-        AsciiStrToUnicodeStr (Lang, StringBuffer);\r
+        AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);\r
       }\r
 \r
       ASSERT (StringBuffer != NULL);\r
@@ -702,7 +704,7 @@ GetOptionalStringByIndex (
     *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));\r
   } else {\r
     *String = AllocatePool (StrSize * sizeof (CHAR16));\r
-    AsciiStrToUnicodeStr (OptionalStrStart, *String);\r
+    AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize);\r
   }\r
 \r
   return EFI_SUCCESS;\r