]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PerformancePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
authorStar Zeng <star.zeng@intel.com>
Wed, 15 Jun 2016 05:38:35 +0000 (13:38 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 21 Jun 2016 04:46:25 +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: 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>
PerformancePkg/Dp_App/Dp.c
PerformancePkg/Dp_App/DpTrace.c

index 6d980e5c55dc82d8956a8c3da673bb8e67c22a43..6890a99c2937096dd020b78612c8adc5b861da1c 100644 (file)
@@ -221,6 +221,7 @@ InitializeDp (
   BOOLEAN                       CumulativeMode;\r
   CONST CHAR16                  *CustomCumulativeToken;\r
   PERF_CUM_DATA                 *CustomCumulativeData;\r
+  UINTN                         NameSize;\r
   EFI_HII_PACKAGE_LIST_HEADER   *PackageList;\r
 \r
   EFI_STRING                StringDpOptionQh;\r
@@ -392,8 +393,9 @@ InitializeDp (
     CustomCumulativeData->MaxDur = 0;\r
     CustomCumulativeData->Count  = 0;\r
     CustomCumulativeData->Duration = 0;\r
-    CustomCumulativeData->Name   = AllocateZeroPool (StrLen (CustomCumulativeToken) + 1);\r
-    UnicodeStrToAsciiStr (CustomCumulativeToken, CustomCumulativeData->Name);\r
+    NameSize = StrLen (CustomCumulativeToken) + 1;\r
+    CustomCumulativeData->Name   = AllocateZeroPool (NameSize);\r
+    UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);\r
   }\r
 \r
 /****************************************************************************\r
index fc21cdc7078a2214d4fc3a3a427becf18e22ba5f..256f7462838c8b7dbae26b13890372089961a3d1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Trace reporting for the Dp utility.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -220,8 +220,8 @@ DumpAllTrace(
       ++Count;    // Count the number of records printed\r
 \r
       // If Handle is non-zero, see if we can determine a name for the driver\r
-      AsciiStrToUnicodeStr (Measurement.Module, mGaugeString); // Use Module by default\r
-      AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);\r
+      AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof (mGaugeString) / sizeof (mGaugeString[0])); // Use Module by default\r
+      AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0]));\r
       if (Measurement.Handle != NULL) {\r
         // See if the Handle is in the HandleBuffer\r
         for (TIndex = 0; TIndex < HandleCount; TIndex++) {\r
@@ -594,7 +594,7 @@ ProcessHandles(
         continue;\r
       }\r
       mGaugeString[0] = 0;    // Empty driver name by default\r
-      AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);\r
+      AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0]));\r
       // See if the Handle is in the HandleBuffer\r
       for (Index = 0; Index < HandleCount; Index++) {\r
         if (Measurement.Handle == HandleBuffer[Index]) {\r
@@ -777,8 +777,8 @@ ProcessGlobal(
                           &Measurement.EndTimeStamp,\r
                           &Measurement.Identifier)) != 0)\r
   {\r
-    AsciiStrToUnicodeStr (Measurement.Module, mGaugeString);\r
-    AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);\r
+    AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, sizeof (mGaugeString) / sizeof (mGaugeString[0]));\r
+    AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, sizeof (mUnicodeToken) / sizeof (mUnicodeToken[0]));\r
     mGaugeString[25] = 0;\r
     mUnicodeToken[31] = 0;\r
     if ( ! ( IsPhase( &Measurement)  ||\r