|
@@ -405,7 +405,7 @@ _PoolCatPrint (
|
|
|
IN OUT POOL_PRINT *spc,
|
|
|
IN INTN (EFIAPI *Output)(VOID *context, CHAR16 *str)
|
|
|
)
|
|
|
-// Dispath function for SPrint, PoolPrint, and CatPrint
|
|
|
+// Dispatch function for SPrint, PoolPrint, and CatPrint
|
|
|
{
|
|
|
PRINT_STATE ps;
|
|
|
|
|
@@ -810,7 +810,7 @@ _IPrint (
|
|
|
|
|
|
|
|
|
UINTN
|
|
|
-APrint (
|
|
|
+AsciiPrint (
|
|
|
IN CONST CHAR8 *fmt,
|
|
|
...
|
|
|
)
|
|
@@ -842,6 +842,64 @@ Returns:
|
|
|
}
|
|
|
|
|
|
|
|
|
+UINTN
|
|
|
+AsciiVSPrint (
|
|
|
+ OUT CHAR8 *Str,
|
|
|
+ IN UINTN StrSize,
|
|
|
+ IN CONST CHAR8 *fmt,
|
|
|
+ va_list args
|
|
|
+)
|
|
|
+/*++
|
|
|
+
|
|
|
+Routine Description:
|
|
|
+
|
|
|
+ Prints a formatted ascii string to a buffer using a va_list
|
|
|
+
|
|
|
+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
|
|
|
+
|
|
|
+ args - va_list
|
|
|
+
|
|
|
+
|
|
|
+Returns:
|
|
|
+
|
|
|
+ String length returned in buffer
|
|
|
+
|
|
|
+--*/
|
|
|
+// Use Unicode VSPrint() and convert back to ASCII
|
|
|
+{
|
|
|
+ CHAR16 *UnicodeStr, *UnicodeFmt;
|
|
|
+ UINTN i, Len;
|
|
|
+
|
|
|
+ UnicodeStr = AllocatePool(StrSize * sizeof(CHAR16));
|
|
|
+ if (!UnicodeStr)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ UnicodeFmt = PoolPrint(L"%a", fmt);
|
|
|
+ if (!UnicodeFmt) {
|
|
|
+ FreePool(UnicodeStr);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ Len = VSPrint(UnicodeStr, StrSize, UnicodeFmt, args);
|
|
|
+ FreePool(UnicodeFmt);
|
|
|
+
|
|
|
+ // The strings are ASCII so just do a plain Unicode conversion
|
|
|
+ for (i = 0; i < Len; i++)
|
|
|
+ Str[i] = (CHAR8)UnicodeStr[i];
|
|
|
+ Str[Len] = 0;
|
|
|
+ FreePool(UnicodeStr);
|
|
|
+
|
|
|
+ return Len;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
STATIC
|
|
|
VOID
|
|
|
PFLUSH (
|