You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
From cf0b5ad37f8bdfd77e1d0e81962ddc8db477db65 Mon Sep 17 00:00:00 2001 |
|
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com> |
|
Date: Tue, 27 Nov 2012 16:58:39 -0200 |
|
Subject: [PATCH 098/237] Add %X option to printf functions. |
|
|
|
--- |
|
grub-core/kern/misc.c | 7 +++++-- |
|
1 file changed, 5 insertions(+), 2 deletions(-) |
|
|
|
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c |
|
index c5c815d..a56cfe7 100644 |
|
--- a/grub-core/kern/misc.c |
|
+++ b/grub-core/kern/misc.c |
|
@@ -762,7 +762,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b) |
|
static inline char * |
|
grub_lltoa (char *str, int c, unsigned long long n) |
|
{ |
|
- unsigned base = (c == 'x') ? 16 : 10; |
|
+ unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10; |
|
char *p; |
|
|
|
if ((long long) n < 0 && c == 'd') |
|
@@ -777,7 +777,7 @@ grub_lltoa (char *str, int c, unsigned long long n) |
|
do |
|
{ |
|
unsigned d = (unsigned) (n & 0xf); |
|
- *p++ = (d > 9) ? d + 'a' - 10 : d + '0'; |
|
+ *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0'; |
|
} |
|
while (n >>= 4); |
|
else |
|
@@ -850,6 +850,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, |
|
{ |
|
case 'p': |
|
case 'x': |
|
+ case 'X': |
|
case 'u': |
|
case 'd': |
|
case 'c': |
|
@@ -930,6 +931,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, |
|
switch (c) |
|
{ |
|
case 'x': |
|
+ case 'X': |
|
case 'u': |
|
args->ptr[curn].type = UNSIGNED_INT + longfmt; |
|
break; |
|
@@ -1067,6 +1069,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, |
|
c = 'x'; |
|
/* Fall through. */ |
|
case 'x': |
|
+ case 'X': |
|
case 'u': |
|
case 'd': |
|
{ |
|
-- |
|
2.9.3 |
|
|
|
|