summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-06-15 13:40:46 +0800
committerStar Zeng <star.zeng@intel.com>2016-06-21 12:46:27 +0800
commit9b82facd9cf6cb8b0d6ecacd2fc084f70650db62 (patch)
tree5a5863e9dde9b9b9dca506a2fa875ac3fc7f27ba
parent46213c8eb4055d3a75e3fca9daa7a48c1ba41217 (diff)
downloadedk2-platforms-9b82facd9cf6cb8b0d6ecacd2fc084f70650db62.tar.xz
IntelFrameworkModulePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
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>
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c4
-rw-r--r--IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c6
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c10
3 files changed, 11 insertions, 9 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 68b32f32f0..bba62a801a 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -1,7 +1,7 @@
/** @file
BDS Lib functions which relate with create or process the boot option.
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -330,7 +330,7 @@ BdsCreateLegacyBootOption (
//
// Create new BBS device path node with description string
//
- UnicodeStrToAsciiStr (BootDesc, HelpString);
+ UnicodeStrToAsciiStrS (BootDesc, HelpString, sizeof (HelpString));
StringLen = AsciiStrLen (HelpString);
NewBbsDevPathNode = AllocateZeroPool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen);
diff --git a/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c b/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
index 1ed42d527a..d3b48e8d0b 100644
--- a/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
+++ b/IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c
@@ -3,7 +3,7 @@
and manage the legacy boot option, all legacy boot option is getting from
the legacy BBS table.
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -183,7 +183,7 @@ LegacyBmBuildLegacyDevNameString (
//
CopyMem (StringBufferA, StringDesc, LEGACY_BM_BOOT_DESCRIPTION_LENGTH);
StringBufferA[LEGACY_BM_BOOT_DESCRIPTION_LENGTH] = 0;
- AsciiStrToUnicodeStr (StringBufferA, StringBufferU);
+ AsciiStrToUnicodeStrS (StringBufferA, StringBufferU, sizeof (StringBufferU) / sizeof (StringBufferU[0]));
Fmt = L"%s";
Type = StringBufferU;
}
@@ -537,7 +537,7 @@ LegacyBmCreateLegacyBootOption (
//
// Create the BBS device path with description string
//
- UnicodeStrToAsciiStr (Description, HelpString);
+ UnicodeStrToAsciiStrS (Description, HelpString, sizeof (HelpString));
StringLen = AsciiStrLen (HelpString);
DevicePath = AllocatePool (sizeof (BBS_BBS_DEVICE_PATH) + StringLen + END_DEVICE_PATH_LENGTH);
ASSERT (DevicePath != NULL);
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index 6958979cdc..9f4d328357 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -1,7 +1,7 @@
/** @file
FrontPage routines to handle the callbacks and browser calls
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -300,6 +300,7 @@ InitializeFrontPage (
EFI_STATUS Status;
CHAR8 *LangCode;
CHAR8 *Lang;
+ UINTN LangSize;
CHAR8 *CurrentLang;
UINTN OptionCount;
CHAR16 *StringBuffer;
@@ -448,9 +449,10 @@ InitializeFrontPage (
}
if (EFI_ERROR (Status)) {
- StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
+ LangSize = AsciiStrSize (Lang);
+ StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));
ASSERT (StringBuffer != NULL);
- AsciiStrToUnicodeStr (Lang, StringBuffer);
+ AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);
}
ASSERT (StringBuffer != NULL);
@@ -702,7 +704,7 @@ GetOptionalStringByIndex (
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
} else {
*String = AllocatePool (StrSize * sizeof (CHAR16));
- AsciiStrToUnicodeStr (OptionalStrStart, *String);
+ AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize);
}
return EFI_SUCCESS;