2020-01-28 19:24:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-11-14 14:35:45 +00:00
|
|
|
From: Peter Jones <pjones@redhat.com>
|
|
|
|
Date: Mon, 18 Nov 2019 13:05:15 -0500
|
2020-01-28 19:24:49 +00:00
|
|
|
Subject: [PATCH] Semi-asciibetize _Print()'s formatters.
|
2019-11-14 14:35:45 +00:00
|
|
|
|
|
|
|
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>
|
|
|
|
---
|
2020-01-28 19:24:49 +00:00
|
|
|
lib/print.c | 148 ++++++++++++++++++++++++++++++------------------------------
|
|
|
|
1 file changed, 73 insertions(+), 75 deletions(-)
|
2019-11-14 14:35:45 +00:00
|
|
|
|
|
|
|
diff --git a/lib/print.c b/lib/print.c
|
|
|
|
index 35e43c03db5..0b823481347 100644
|
|
|
|
--- a/lib/print.c
|
|
|
|
+++ b/lib/print.c
|
2020-01-28 19:24:49 +00:00
|
|
|
@@ -1067,26 +1067,26 @@ Returns:
|
2019-11-14 14:35:45 +00:00
|
|
|
Item.Item.pw = Item.Scratch;
|
|
|
|
break;
|
|
|
|
|
|
|
|
- case '0':
|
|
|
|
- Item.Pad = '0';
|
2020-01-28 19:24:49 +00:00
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case '-':
|
|
|
|
- Item.PadBefore = FALSE;
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
case ',':
|
|
|
|
Item.Comma = TRUE;
|
2019-11-14 14:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2020-01-28 19:24:49 +00:00
|
|
|
- case '.':
|
|
|
|
- Item.WidthParse = &Item.FieldWidth;
|
|
|
|
+ case '-':
|
|
|
|
+ Item.PadBefore = FALSE;
|
2019-11-14 14:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2020-01-28 19:24:49 +00:00
|
|
|
case '*':
|
|
|
|
*Item.WidthParse = va_arg(ps->args, UINTN);
|
2019-11-14 14:35:45 +00:00
|
|
|
break;
|
|
|
|
|
2020-01-28 19:24:49 +00:00
|
|
|
+ case '.':
|
|
|
|
+ Item.WidthParse = &Item.FieldWidth;
|
|
|
|
+ break;
|
|
|
|
+
|
2019-11-14 14:35:45 +00:00
|
|
|
+ case '0':
|
|
|
|
+ Item.Pad = '0';
|
2020-01-28 19:24:49 +00:00
|
|
|
+ break;
|
|
|
|
+
|
2019-11-14 14:35:45 +00:00
|
|
|
case '1':
|
2020-01-28 19:24:49 +00:00
|
|
|
case '2':
|
|
|
|
case '3':
|
|
|
|
@@ -1112,62 +1112,12 @@ Returns:
|
2019-11-14 14:35:45 +00:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
-
|
2020-01-28 19:24:49 +00:00
|
|
|
-
|
2019-11-14 14:35:45 +00:00
|
|
|
- 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)
|
|
|
|
- );
|
2020-01-28 19:24:49 +00:00
|
|
|
- Item.Item.pw = Item.Scratch;
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case 'd':
|
|
|
|
- ValueToString (
|
|
|
|
- Item.Scratch,
|
|
|
|
- Item.Comma,
|
|
|
|
- Item.Long ? va_arg(ps->args, INT64) : va_arg(ps->args, INT32)
|
|
|
|
- );
|
|
|
|
- Item.Item.pw = Item.Scratch;
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
case 'D':
|
|
|
|
{
|
|
|
|
EFI_DEVICE_PATH *dp = va_arg(ps->args, EFI_DEVICE_PATH *);
|
|
|
|
@@ -1180,6 +1130,23 @@ Returns:
|
2019-11-14 14:35:45 +00:00
|
|
|
break;
|
2020-01-28 19:24:49 +00:00
|
|
|
}
|
2019-11-14 14:35:45 +00:00
|
|
|
|
2020-01-28 19:24:49 +00:00
|
|
|
+ case 'd':
|
|
|
|
+ ValueToString (
|
|
|
|
+ Item.Scratch,
|
|
|
|
+ Item.Comma,
|
|
|
|
+ Item.Long ? va_arg(ps->args, INT64) : va_arg(ps->args, INT32)
|
|
|
|
+ );
|
|
|
|
+ Item.Item.pw = Item.Scratch;
|
|
|
|
+ break;
|
|
|
|
+
|
2019-11-14 14:35:45 +00:00
|
|
|
+ case 'E':
|
|
|
|
+ Attr = ps->AttrError;
|
|
|
|
+ break;
|
2020-01-28 19:24:49 +00:00
|
|
|
+
|
2019-11-14 14:35:45 +00:00
|
|
|
+ case 'e':
|
|
|
|
+ PSETATTR(ps, ps->AttrError);
|
2020-01-28 19:24:49 +00:00
|
|
|
+ break;
|
|
|
|
+
|
2019-11-14 14:35:45 +00:00
|
|
|
case 'f':
|
|
|
|
FloatToString (
|
2020-01-28 19:24:49 +00:00
|
|
|
Item.Scratch,
|
2019-11-14 14:35:45 +00:00
|
|
|
@@ -1189,38 +1156,69 @@ Returns:
|
|
|
|
Item.Item.pw = Item.Scratch;
|
|
|
|
break;
|
|
|
|
|
|
|
|
- case 't':
|
|
|
|
- TimeToString (Item.Scratch, va_arg(ps->args, EFI_TIME *));
|
|
|
|
+ case 'g':
|
|
|
|
+ GuidToString (Item.Scratch, va_arg(ps->args, EFI_GUID *));
|
|
|
|
Item.Item.pw = Item.Scratch;
|
|
|
|
break;
|
|
|
|
|
2020-01-28 19:24:49 +00:00
|
|
|
- case 'r':
|
|
|
|
- StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS));
|
|
|
|
- Item.Item.pw = Item.Scratch;
|
|
|
|
- break;
|
|
|
|
-
|
2019-11-14 14:35:45 +00:00
|
|
|
- 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:
|