Blame SOURCES/0098-Add-X-option-to-printf-functions.patch

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