2018-04-11 18:42:03 +00:00
|
|
|
From 6237b1688124d6a72250b296e758ef2d59fde26f Mon Sep 17 00:00:00 2001
|
2012-11-27 20:08:53 +00:00
|
|
|
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
|
|
|
Date: Tue, 27 Nov 2012 16:58:39 -0200
|
2018-06-04 16:28:07 +00:00
|
|
|
Subject: [PATCH 086/243] Add %X option to printf functions.
|
2012-11-27 20:08:53 +00:00
|
|
|
|
|
|
|
---
|
2013-05-02 20:54:52 +00:00
|
|
|
grub-core/kern/misc.c | 7 +++++--
|
2012-11-27 20:08:53 +00:00
|
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
2018-02-27 18:56:41 +00:00
|
|
|
index 952411d5dc6..8344526be7f 100644
|
2012-11-27 20:08:53 +00:00
|
|
|
--- a/grub-core/kern/misc.c
|
|
|
|
+++ b/grub-core/kern/misc.c
|
2017-06-16 19:31:32 +00:00
|
|
|
@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
|
2014-01-06 16:39:16 +00:00
|
|
|
static inline char *
|
2012-11-27 20:08:53 +00:00
|
|
|
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')
|
2017-06-16 19:31:32 +00:00
|
|
|
@@ -603,7 +603,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
|
2012-11-27 20:08:53 +00:00
|
|
|
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
|
2017-06-16 19:31:32 +00:00
|
|
|
@@ -676,6 +676,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
|
2012-11-27 20:08:53 +00:00
|
|
|
{
|
|
|
|
case 'p':
|
|
|
|
case 'x':
|
|
|
|
+ case 'X':
|
|
|
|
case 'u':
|
|
|
|
case 'd':
|
|
|
|
case 'c':
|
2017-06-16 19:31:32 +00:00
|
|
|
@@ -762,6 +763,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
|
2012-11-27 20:08:53 +00:00
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case 'x':
|
|
|
|
+ case 'X':
|
|
|
|
case 'u':
|
2014-01-06 16:39:16 +00:00
|
|
|
args->ptr[curn].type = UNSIGNED_INT + longfmt;
|
|
|
|
break;
|
2017-06-16 19:31:32 +00:00
|
|
|
@@ -900,6 +902,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
|
2014-01-06 16:39:16 +00:00
|
|
|
c = 'x';
|
2012-11-27 20:08:53 +00:00
|
|
|
/* Fall through. */
|
|
|
|
case 'x':
|
|
|
|
+ case 'X':
|
|
|
|
case 'u':
|
2014-01-06 16:39:16 +00:00
|
|
|
case 'd':
|
|
|
|
{
|
2012-11-27 20:08:53 +00:00
|
|
|
--
|
2018-06-04 16:28:07 +00:00
|
|
|
2.17.1
|
2012-11-27 20:08:53 +00:00
|
|
|
|