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