PerformancePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr

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

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@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>
This commit is contained in:
Star Zeng 2016-06-15 13:38:35 +08:00
parent b9679cd745
commit 23cfa2b9f0
2 changed files with 10 additions and 8 deletions

View File

@ -221,6 +221,7 @@ InitializeDp (
BOOLEAN CumulativeMode; BOOLEAN CumulativeMode;
CONST CHAR16 *CustomCumulativeToken; CONST CHAR16 *CustomCumulativeToken;
PERF_CUM_DATA *CustomCumulativeData; PERF_CUM_DATA *CustomCumulativeData;
UINTN NameSize;
EFI_HII_PACKAGE_LIST_HEADER *PackageList; EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_STRING StringDpOptionQh; EFI_STRING StringDpOptionQh;
@ -392,8 +393,9 @@ InitializeDp (
CustomCumulativeData->MaxDur = 0; CustomCumulativeData->MaxDur = 0;
CustomCumulativeData->Count = 0; CustomCumulativeData->Count = 0;
CustomCumulativeData->Duration = 0; CustomCumulativeData->Duration = 0;
CustomCumulativeData->Name = AllocateZeroPool (StrLen (CustomCumulativeToken) + 1); NameSize = StrLen (CustomCumulativeToken) + 1;
UnicodeStrToAsciiStr (CustomCumulativeToken, CustomCumulativeData->Name); CustomCumulativeData->Name = AllocateZeroPool (NameSize);
UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);
} }
/**************************************************************************** /****************************************************************************

View File

@ -1,7 +1,7 @@
/** @file /** @file
Trace reporting for the Dp utility. Trace reporting for the Dp utility.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -220,8 +220,8 @@ DumpAllTrace(
++Count; // Count the number of records printed ++Count; // Count the number of records printed
// If Handle is non-zero, see if we can determine a name for the driver // If Handle is non-zero, see if we can determine a name for the driver
AsciiStrToUnicodeStr (Measurement.Module, mGaugeString); // Use Module by default AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof (mGaugeString) / sizeof (mGaugeString[0])); // Use Module by default
AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken); AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0]));
if (Measurement.Handle != NULL) { if (Measurement.Handle != NULL) {
// See if the Handle is in the HandleBuffer // See if the Handle is in the HandleBuffer
for (TIndex = 0; TIndex < HandleCount; TIndex++) { for (TIndex = 0; TIndex < HandleCount; TIndex++) {
@ -594,7 +594,7 @@ ProcessHandles(
continue; continue;
} }
mGaugeString[0] = 0; // Empty driver name by default mGaugeString[0] = 0; // Empty driver name by default
AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken); AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0]));
// See if the Handle is in the HandleBuffer // See if the Handle is in the HandleBuffer
for (Index = 0; Index < HandleCount; Index++) { for (Index = 0; Index < HandleCount; Index++) {
if (Measurement.Handle == HandleBuffer[Index]) { if (Measurement.Handle == HandleBuffer[Index]) {
@ -777,8 +777,8 @@ ProcessGlobal(
&Measurement.EndTimeStamp, &Measurement.EndTimeStamp,
&Measurement.Identifier)) != 0) &Measurement.Identifier)) != 0)
{ {
AsciiStrToUnicodeStr (Measurement.Module, mGaugeString); AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof (mGaugeString) / sizeof (mGaugeString[0]));
AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken); AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0]));
mGaugeString[25] = 0; mGaugeString[25] = 0;
mUnicodeToken[31] = 0; mUnicodeToken[31] = 0;
if ( ! ( IsPhase( &Measurement) || if ( ! ( IsPhase( &Measurement) ||