31004e6
From 2a71d2434b01daaafa64cd340ea441def459d880 Mon Sep 17 00:00:00 2001
31004e6
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
31004e6
Date: Tue, 27 Nov 2012 16:58:39 -0200
f74b50e
Subject: [PATCH 455/482] Add %X option to printf functions.
31004e6
31004e6
---
31004e6
 grub-core/kern/misc.c | 7 +++++--
31004e6
 1 file changed, 5 insertions(+), 2 deletions(-)
31004e6
31004e6
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
31004e6
index 94b88a3..d5ca312 100644
31004e6
--- a/grub-core/kern/misc.c
31004e6
+++ b/grub-core/kern/misc.c
31004e6
@@ -596,7 +596,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
31004e6
 static char *
31004e6
 grub_lltoa (char *str, int c, unsigned long long n)
31004e6
 {
31004e6
-  unsigned base = (c == 'x') ? 16 : 10;
31004e6
+  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
31004e6
   char *p;
31004e6
 
31004e6
   if ((long long) n < 0 && c == 'd')
31004e6
@@ -611,7 +611,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
31004e6
     do
31004e6
       {
31004e6
 	unsigned d = (unsigned) (n & 0xf);
31004e6
-	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
31004e6
+	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
31004e6
       }
31004e6
     while (n >>= 4);
31004e6
   else
31004e6
@@ -702,6 +702,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
31004e6
 	{
31004e6
 	case 'p':
31004e6
 	case 'x':
31004e6
+	case 'X':
31004e6
 	case 'u':
31004e6
 	case 'd':
31004e6
 	case 'c':
31004e6
@@ -780,6 +781,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
31004e6
       switch (c)
31004e6
 	{
31004e6
 	case 'x':
31004e6
+	case 'X':
31004e6
 	case 'u':
31004e6
 	case 'd':
31004e6
 	  if (longlongfmt)
31004e6
@@ -921,6 +923,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
31004e6
 	  longlongfmt |= (sizeof (void *) == sizeof (long long));
31004e6
 	  /* Fall through. */
31004e6
 	case 'x':
31004e6
+	case 'X':
31004e6
 	case 'u':
31004e6
 	  unsig = 1;
31004e6
 	  /* Fall through. */
31004e6
-- 
31004e6
1.8.2.1
31004e6