1104109978
Signed-off-by: Peter Jones <pjones@redhat.com>
221 lines
6.5 KiB
Diff
221 lines
6.5 KiB
Diff
From 212920a4c3dedc6fc119fb371be798dfc971a749 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Mon, 18 Nov 2019 13:05:15 -0500
|
|
Subject: [PATCH 40/45] Semi-asciibetize _Print()'s formatters.
|
|
|
|
This is ascii order but with upper and lower case letters mixed, so
|
|
things like 'X' and 'x' that use fallthrough still stay together.
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
lib/print.c | 132 ++++++++++++++++++++++++++--------------------------
|
|
1 file changed, 65 insertions(+), 67 deletions(-)
|
|
|
|
diff --git a/lib/print.c b/lib/print.c
|
|
index 35e43c03db5..0b823481347 100644
|
|
--- a/lib/print.c
|
|
+++ b/lib/print.c
|
|
@@ -1067,24 +1067,24 @@ Returns:
|
|
Item.Item.pw = Item.Scratch;
|
|
break;
|
|
|
|
- case '0':
|
|
- Item.Pad = '0';
|
|
+ case ',':
|
|
+ Item.Comma = TRUE;
|
|
break;
|
|
|
|
case '-':
|
|
Item.PadBefore = FALSE;
|
|
break;
|
|
|
|
- case ',':
|
|
- Item.Comma = TRUE;
|
|
+ case '*':
|
|
+ *Item.WidthParse = va_arg(ps->args, UINTN);
|
|
break;
|
|
|
|
case '.':
|
|
Item.WidthParse = &Item.FieldWidth;
|
|
break;
|
|
|
|
- case '*':
|
|
- *Item.WidthParse = va_arg(ps->args, UINTN);
|
|
+ case '0':
|
|
+ Item.Pad = '0';
|
|
break;
|
|
|
|
case '1':
|
|
@@ -1112,52 +1112,23 @@ Returns:
|
|
}
|
|
break;
|
|
|
|
- case 's':
|
|
- Item.Item.pw = va_arg(ps->args, CHAR16 *);
|
|
- if (!Item.Item.pw) {
|
|
- Item.Item.pw = L"(null)";
|
|
- }
|
|
- break;
|
|
-
|
|
case 'c':
|
|
Item.Scratch[0] = (CHAR16) va_arg(ps->args, UINTN);
|
|
Item.Scratch[1] = 0;
|
|
Item.Item.pw = Item.Scratch;
|
|
break;
|
|
|
|
- case 'l':
|
|
- Item.Long = TRUE;
|
|
- break;
|
|
-
|
|
- case 'X':
|
|
- Item.Width = Item.Long ? 16 : 8;
|
|
- Item.Pad = '0';
|
|
-#if __GNUC__ >= 7
|
|
- __attribute__ ((fallthrough));
|
|
-#endif
|
|
- case 'x':
|
|
- ValueToHex (
|
|
- Item.Scratch,
|
|
- Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32)
|
|
- );
|
|
- Item.Item.pw = Item.Scratch;
|
|
-
|
|
- break;
|
|
-
|
|
+ case 'D':
|
|
+ {
|
|
+ EFI_DEVICE_PATH *dp = va_arg(ps->args, EFI_DEVICE_PATH *);
|
|
+ CHAR16 *dpstr = DevicePathToStr(dp);
|
|
+ StrnCpy(Item.Scratch, dpstr, PRINT_ITEM_BUFFER_LEN);
|
|
+ Item.Scratch[PRINT_ITEM_BUFFER_LEN-1] = L'\0';
|
|
+ FreePool(dpstr);
|
|
|
|
- case 'g':
|
|
- GuidToString (Item.Scratch, va_arg(ps->args, EFI_GUID *));
|
|
- Item.Item.pw = Item.Scratch;
|
|
- break;
|
|
-
|
|
- case 'u':
|
|
- ValueToString (
|
|
- Item.Scratch,
|
|
- Item.Comma,
|
|
- Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32)
|
|
- );
|
|
Item.Item.pw = Item.Scratch;
|
|
break;
|
|
+ }
|
|
|
|
case 'd':
|
|
ValueToString (
|
|
@@ -1168,17 +1139,13 @@ Returns:
|
|
Item.Item.pw = Item.Scratch;
|
|
break;
|
|
|
|
- case 'D':
|
|
- {
|
|
- EFI_DEVICE_PATH *dp = va_arg(ps->args, EFI_DEVICE_PATH *);
|
|
- CHAR16 *dpstr = DevicePathToStr(dp);
|
|
- StrnCpy(Item.Scratch, dpstr, PRINT_ITEM_BUFFER_LEN);
|
|
- Item.Scratch[PRINT_ITEM_BUFFER_LEN-1] = L'\0';
|
|
- FreePool(dpstr);
|
|
+ case 'E':
|
|
+ Attr = ps->AttrError;
|
|
+ break;
|
|
|
|
- Item.Item.pw = Item.Scratch;
|
|
+ case 'e':
|
|
+ PSETATTR(ps, ps->AttrError);
|
|
break;
|
|
- }
|
|
|
|
case 'f':
|
|
FloatToString (
|
|
@@ -1189,38 +1156,69 @@ Returns:
|
|
Item.Item.pw = Item.Scratch;
|
|
break;
|
|
|
|
- case 't':
|
|
- TimeToString (Item.Scratch, va_arg(ps->args, EFI_TIME *));
|
|
- Item.Item.pw = Item.Scratch;
|
|
- break;
|
|
-
|
|
- case 'r':
|
|
- StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS));
|
|
+ case 'g':
|
|
+ GuidToString (Item.Scratch, va_arg(ps->args, EFI_GUID *));
|
|
Item.Item.pw = Item.Scratch;
|
|
break;
|
|
|
|
- case 'n':
|
|
- PSETATTR(ps, ps->AttrNorm);
|
|
+ case 'H':
|
|
+ Attr = ps->AttrHighlight;
|
|
break;
|
|
|
|
case 'h':
|
|
PSETATTR(ps, ps->AttrHighlight);
|
|
break;
|
|
|
|
- case 'e':
|
|
- PSETATTR(ps, ps->AttrError);
|
|
+ case 'l':
|
|
+ Item.Long = TRUE;
|
|
break;
|
|
|
|
case 'N':
|
|
Attr = ps->AttrNorm;
|
|
break;
|
|
|
|
- case 'H':
|
|
- Attr = ps->AttrHighlight;
|
|
+ case 'n':
|
|
+ PSETATTR(ps, ps->AttrNorm);
|
|
break;
|
|
|
|
- case 'E':
|
|
- Attr = ps->AttrError;
|
|
+ case 'r':
|
|
+ StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS));
|
|
+ Item.Item.pw = Item.Scratch;
|
|
+ break;
|
|
+
|
|
+ case 's':
|
|
+ Item.Item.pw = va_arg(ps->args, CHAR16 *);
|
|
+ if (!Item.Item.pw) {
|
|
+ Item.Item.pw = L"(null)";
|
|
+ }
|
|
+ break;
|
|
+
|
|
+ case 't':
|
|
+ TimeToString (Item.Scratch, va_arg(ps->args, EFI_TIME *));
|
|
+ Item.Item.pw = Item.Scratch;
|
|
+ break;
|
|
+
|
|
+ case 'u':
|
|
+ ValueToString (
|
|
+ Item.Scratch,
|
|
+ Item.Comma,
|
|
+ Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32)
|
|
+ );
|
|
+ Item.Item.pw = Item.Scratch;
|
|
+ break;
|
|
+
|
|
+ case 'X':
|
|
+ Item.Width = Item.Long ? 16 : 8;
|
|
+ Item.Pad = '0';
|
|
+#if __GNUC__ >= 7
|
|
+ __attribute__ ((fallthrough));
|
|
+#endif
|
|
+ case 'x':
|
|
+ ValueToHex (
|
|
+ Item.Scratch,
|
|
+ Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32)
|
|
+ );
|
|
+ Item.Item.pw = Item.Scratch;
|
|
break;
|
|
|
|
default:
|
|
--
|
|
2.24.1
|
|
|