nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

606ea6
From 57d2bab2505883efe87bab31a80c42984671e4ac Mon Sep 17 00:00:00 2001
606ea6
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
606ea6
Date: Tue, 27 Nov 2012 16:58:39 -0200
606ea6
Subject: [PATCH 10/34] Add %X option to printf functions.
606ea6
606ea6
---
606ea6
 grub-core/kern/misc.c | 7 +++++--
606ea6
 1 file changed, 5 insertions(+), 2 deletions(-)
606ea6
606ea6
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
606ea6
index 54db2e1..50f7f53 100644
606ea6
--- a/grub-core/kern/misc.c
606ea6
+++ b/grub-core/kern/misc.c
606ea6
@@ -759,7 +759,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b)
606ea6
 static inline char *
606ea6
 grub_lltoa (char *str, int c, unsigned long long n)
606ea6
 {
606ea6
-  unsigned base = (c == 'x') ? 16 : 10;
606ea6
+  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
606ea6
   char *p;
606ea6
 
606ea6
   if ((long long) n < 0 && c == 'd')
606ea6
@@ -774,7 +774,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
606ea6
     do
606ea6
       {
606ea6
 	unsigned d = (unsigned) (n & 0xf);
606ea6
-	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
606ea6
+	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
606ea6
       }
606ea6
     while (n >>= 4);
606ea6
   else
606ea6
@@ -847,6 +847,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
606ea6
 	{
606ea6
 	case 'p':
606ea6
 	case 'x':
606ea6
+	case 'X':
606ea6
 	case 'u':
606ea6
 	case 'd':
606ea6
 	case 'c':
606ea6
@@ -927,6 +928,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
606ea6
       switch (c)
606ea6
 	{
606ea6
 	case 'x':
606ea6
+	case 'X':
606ea6
 	case 'u':
606ea6
 	  args->ptr[curn].type = UNSIGNED_INT + longfmt;
606ea6
 	  break;
606ea6
@@ -1064,6 +1066,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
606ea6
 	  c = 'x';
606ea6
 	  /* Fall through. */
606ea6
 	case 'x':
606ea6
+	case 'X':
606ea6
 	case 'u':
606ea6
 	case 'd':
606ea6
 	  {
606ea6
-- 
606ea6
1.8.4.2
606ea6