]> TLD Linux GIT Repositories - packages/grub2.git/blob - add-X-option-to-printf-functions.patch
- grub2 from PLD
[packages/grub2.git] / add-X-option-to-printf-functions.patch
1 From 80f81f233bf74aac740d7a299d075ea46c9c7bd4 Mon Sep 17 00:00:00 2001
2 From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
3 Date: Tue, 27 Nov 2012 16:58:39 -0200
4 Subject: [PATCH 1/3] Add %X option to printf functions.
5
6 ---
7  grub-core/kern/misc.c |    7 +++++--
8  1 file changed, 5 insertions(+), 2 deletions(-)
9
10 diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
11 index 95d4624..8ac087a 100644
12 --- a/grub-core/kern/misc.c
13 +++ b/grub-core/kern/misc.c
14 @@ -596,7 +596,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
15  static char *
16  grub_lltoa (char *str, int c, unsigned long long n)
17  {
18 -  unsigned base = (c == 'x') ? 16 : 10;
19 +  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
20    char *p;
21  
22    if ((long long) n < 0 && c == 'd')
23 @@ -611,7 +611,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
24      do
25        {
26         unsigned d = (unsigned) (n & 0xf);
27 -       *p++ = (d > 9) ? d + 'a' - 10 : d + '0';
28 +       *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
29        }
30      while (n >>= 4);
31    else
32 @@ -702,6 +702,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
33         {
34         case 'p':
35         case 'x':
36 +       case 'X':
37         case 'u':
38         case 'd':
39         case 'c':
40 @@ -777,6 +778,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
41        switch (c)
42         {
43         case 'x':
44 +       case 'X':
45         case 'u':
46         case 'd':
47           if (longlongfmt)
48 @@ -918,6 +920,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
49           longlongfmt |= (sizeof (void *) == sizeof (long long));
50           /* Fall through. */
51         case 'x':
52 +       case 'X':
53         case 'u':
54           unsig = 1;
55           /* Fall through. */
56 -- 
57 1.7.10.4
58