grub2/0010-Add-X-option-to-printf-functions.patch
Peter Jones f4c76c02ae Reconcile even harder, so that it actually works.
Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 13:12:37 -04:00

59 lines
1.6 KiB
Diff

From 28297386b1d3801d3a79d31e957b0fbed9eb5baa 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 10/74] 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 906d2c2..6b3397f 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -587,7 +587,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
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')
@@ -602,7 +602,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
@@ -675,6 +675,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
{
case 'p':
case 'x':
+ case 'X':
case 'u':
case 'd':
case 'c':
@@ -755,6 +756,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;
@@ -892,6 +894,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.4.3