mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-07 19:45:07 +02:00
FmpDevicePkg/FmpDxe: Remove use of CatSprint()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525 The size overhead for CatSPrint() is large. This function is only used to generate variable names with HardwareInstance value appended. Use UnicodeValueToStringS() instead that is much smaller. Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Eric Jin <eric.jin@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
11d354945c
commit
a5944b6a13
@ -23,6 +23,7 @@
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/FmpAuthenticationLib.h>
|
||||
#include <Library/FmpDeviceLib.h>
|
||||
#include <Library/FmpPayloadHeaderLib.h>
|
||||
|
@ -45,6 +45,7 @@
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
PrintLib
|
||||
UefiLib
|
||||
BaseCryptLib
|
||||
FmpAuthenticationLib
|
||||
|
@ -45,6 +45,7 @@
|
||||
BaseMemoryLib
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
PrintLib
|
||||
UefiLib
|
||||
BaseCryptLib
|
||||
FmpAuthenticationLib
|
||||
|
@ -147,9 +147,15 @@ GenerateFmpVariableName (
|
||||
IN CHAR16 *BaseVariableName
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
CHAR16 *VariableName;
|
||||
|
||||
VariableName = CatSPrint (NULL, BaseVariableName);
|
||||
//
|
||||
// Allocate Unicode string with room for BaseVariableName and a 16 digit
|
||||
// hexadecimal value for the HardwareInstance value.
|
||||
//
|
||||
Size = StrSize (BaseVariableName) + 16 * sizeof (CHAR16);
|
||||
VariableName = AllocateCopyPool (Size, BaseVariableName);
|
||||
if (VariableName == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to generate variable name %s.\n", mImageIdName, BaseVariableName));
|
||||
return VariableName;
|
||||
@ -157,10 +163,13 @@ GenerateFmpVariableName (
|
||||
if (HardwareInstance == 0) {
|
||||
return VariableName;
|
||||
}
|
||||
VariableName = CatSPrint (VariableName, L"%016lx", HardwareInstance);
|
||||
if (VariableName == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to generate variable name %s.\n", mImageIdName, BaseVariableName));
|
||||
}
|
||||
UnicodeValueToStringS (
|
||||
&VariableName[StrLen(BaseVariableName)],
|
||||
Size,
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
HardwareInstance,
|
||||
16
|
||||
);
|
||||
return VariableName;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user