From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 18 Nov 2019 13:05:15 -0500 Subject: [PATCH] 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 --- lib/print.c | 148 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 73 insertions(+), 75 deletions(-) diff --git a/lib/print.c b/lib/print.c index 35e43c03db5..0b823481347 100644 --- a/lib/print.c +++ b/lib/print.c @@ -1067,26 +1067,26 @@ Returns: Item.Item.pw = Item.Scratch; break; - case '0': - Item.Pad = '0'; - break; - - case '-': - Item.PadBefore = FALSE; - break; - case ',': Item.Comma = TRUE; break; - case '.': - Item.WidthParse = &Item.FieldWidth; + case '-': + Item.PadBefore = FALSE; break; case '*': *Item.WidthParse = va_arg(ps->args, UINTN); break; + case '.': + Item.WidthParse = &Item.FieldWidth; + break; + + case '0': + Item.Pad = '0'; + break; + case '1': case '2': case '3': @@ -1112,62 +1112,12 @@ 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 '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 ( - 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: 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 'E': + Attr = ps->AttrError; + break; + + case 'e': + PSETATTR(ps, ps->AttrError); + break; + case 'f': FloatToString ( Item.Scratch, @@ -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; - case 'r': - StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS)); - 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: