Skip to content

Commit

Permalink
IntelFrameworkModulePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnico…
Browse files Browse the repository at this point in the history
…deStr

It is the follow up of 3ab41b7
to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with
UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.

Cc: Jiewen Yao <[email protected]>
Cc: Jeff Fan <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
  • Loading branch information
lzeng14 committed Jun 21, 2016
1 parent 46213c8 commit 9b82fac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -300,6 +300,7 @@ InitializeFrontPage (
EFI_STATUS Status;
CHAR8 *LangCode;
CHAR8 *Lang;
UINTN LangSize;
CHAR8 *CurrentLang;
UINTN OptionCount;
CHAR16 *StringBuffer;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9b82fac

Please sign in to comment.