Add AsciiSPrint()

AsciiSPrint() is really snprintf(), but gnu-efi has a different naming
convention.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2025-07-21 14:36:16 -04:00
parent 0d74e15af1
commit dc7fd96f23
2 changed files with 45 additions and 0 deletions

View file

@ -596,6 +596,14 @@ AsciiVSPrint(
__builtin_ms_va_list args
);
UINTN EFIAPI
AsciiSPrint (
OUT CHAR8 *Str,
IN UINTN StrSize,
IN CONST CHAR8 *fmt,
...
);
VOID
ValueToHex (
IN CHAR16 *Buffer,

View file

@ -899,6 +899,43 @@ Returns:
return Len;
}
UINTN EFIAPI
AsciiSPrint (
OUT CHAR8 *Str,
IN UINTN StrSize,
IN CONST CHAR8 *fmt,
...
)
/*++
Routine Description:
Prints a formatted unicode string to a buffer
Arguments:
Str - Output buffer to print the formatted string into
StrSize - Size of Str. String is truncated to this size.
A size of 0 means there is no limit
fmt - The format string
Returns:
String length returned in buffer
--*/
{
ms_va_list args;
UINTN len;
ms_va_start (args, fmt);
len = AsciiVSPrint(Str, StrSize, fmt, args);
ms_va_end (args);
return len;
}
STATIC
VOID