mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +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/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
|
#include <Library/PrintLib.h>
|
||||||
#include <Library/FmpAuthenticationLib.h>
|
#include <Library/FmpAuthenticationLib.h>
|
||||||
#include <Library/FmpDeviceLib.h>
|
#include <Library/FmpDeviceLib.h>
|
||||||
#include <Library/FmpPayloadHeaderLib.h>
|
#include <Library/FmpPayloadHeaderLib.h>
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
|
PrintLib
|
||||||
UefiLib
|
UefiLib
|
||||||
BaseCryptLib
|
BaseCryptLib
|
||||||
FmpAuthenticationLib
|
FmpAuthenticationLib
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
|
PrintLib
|
||||||
UefiLib
|
UefiLib
|
||||||
BaseCryptLib
|
BaseCryptLib
|
||||||
FmpAuthenticationLib
|
FmpAuthenticationLib
|
||||||
|
@ -147,9 +147,15 @@ GenerateFmpVariableName (
|
|||||||
IN CHAR16 *BaseVariableName
|
IN CHAR16 *BaseVariableName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
UINTN Size;
|
||||||
CHAR16 *VariableName;
|
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) {
|
if (VariableName == NULL) {
|
||||||
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to generate variable name %s.\n", mImageIdName, BaseVariableName));
|
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to generate variable name %s.\n", mImageIdName, BaseVariableName));
|
||||||
return VariableName;
|
return VariableName;
|
||||||
@ -157,10 +163,13 @@ GenerateFmpVariableName (
|
|||||||
if (HardwareInstance == 0) {
|
if (HardwareInstance == 0) {
|
||||||
return VariableName;
|
return VariableName;
|
||||||
}
|
}
|
||||||
VariableName = CatSPrint (VariableName, L"%016lx", HardwareInstance);
|
UnicodeValueToStringS (
|
||||||
if (VariableName == NULL) {
|
&VariableName[StrLen(BaseVariableName)],
|
||||||
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to generate variable name %s.\n", mImageIdName, BaseVariableName));
|
Size,
|
||||||
}
|
PREFIX_ZERO | RADIX_HEX,
|
||||||
|
HardwareInstance,
|
||||||
|
16
|
||||||
|
);
|
||||||
return VariableName;
|
return VariableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user