|
|
f731ee |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
f731ee |
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
|
|
f731ee |
Date: Tue, 27 Nov 2012 16:58:39 -0200
|
|
|
f731ee |
Subject: [PATCH] Add %X option to printf functions.
|
|
|
f731ee |
|
|
|
f731ee |
---
|
|
|
f731ee |
grub-core/kern/misc.c | 7 +++++--
|
|
|
f731ee |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
f731ee |
|
|
|
f731ee |
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
|
|
f731ee |
index c5c815d8d13..a56cfe78994 100644
|
|
|
f731ee |
--- a/grub-core/kern/misc.c
|
|
|
f731ee |
+++ b/grub-core/kern/misc.c
|
|
|
f731ee |
@@ -762,7 +762,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b)
|
|
|
f731ee |
static inline char *
|
|
|
f731ee |
grub_lltoa (char *str, int c, unsigned long long n)
|
|
|
f731ee |
{
|
|
|
f731ee |
- unsigned base = (c == 'x') ? 16 : 10;
|
|
|
f731ee |
+ unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
|
|
|
f731ee |
char *p;
|
|
|
f731ee |
|
|
|
f731ee |
if ((long long) n < 0 && c == 'd')
|
|
|
f731ee |
@@ -777,7 +777,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
|
|
|
f731ee |
do
|
|
|
f731ee |
{
|
|
|
f731ee |
unsigned d = (unsigned) (n & 0xf);
|
|
|
f731ee |
- *p++ = (d > 9) ? d + 'a' - 10 : d + '0';
|
|
|
f731ee |
+ *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
|
|
|
f731ee |
}
|
|
|
f731ee |
while (n >>= 4);
|
|
|
f731ee |
else
|
|
|
f731ee |
@@ -850,6 +850,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
|
|
|
f731ee |
{
|
|
|
f731ee |
case 'p':
|
|
|
f731ee |
case 'x':
|
|
|
f731ee |
+ case 'X':
|
|
|
f731ee |
case 'u':
|
|
|
f731ee |
case 'd':
|
|
|
f731ee |
case 'c':
|
|
|
f731ee |
@@ -930,6 +931,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
|
|
|
f731ee |
switch (c)
|
|
|
f731ee |
{
|
|
|
f731ee |
case 'x':
|
|
|
f731ee |
+ case 'X':
|
|
|
f731ee |
case 'u':
|
|
|
f731ee |
args->ptr[curn].type = UNSIGNED_INT + longfmt;
|
|
|
f731ee |
break;
|
|
|
f731ee |
@@ -1067,6 +1069,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
|
|
|
f731ee |
c = 'x';
|
|
|
f731ee |
/* Fall through. */
|
|
|
f731ee |
case 'x':
|
|
|
f731ee |
+ case 'X':
|
|
|
f731ee |
case 'u':
|
|
|
f731ee |
case 'd':
|
|
|
f731ee |
{
|