2005-06-23 Hollis Blanchard <hollis@penguinppc.org>
* kern/misc.c (grub_vsprintf): Add `longfmt'. If format string contains `l' modifier, get a long from va_arg().
This commit is contained in:
parent
50b5a0a793
commit
e75d76e157
2 changed files with 17 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-06-23 Hollis Blanchard <hollis@penguinppc.org>
|
||||||
|
|
||||||
|
* kern/misc.c (grub_vsprintf): Add `longfmt'. If format string
|
||||||
|
contains `l' modifier, get a long from va_arg().
|
||||||
|
|
||||||
2005-06-23 Yoshinori K. Okuji <okuji@enbug.org>
|
2005-06-23 Yoshinori K. Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
* kern/mm.c (grub_free): If the next free block which is being
|
* kern/mm.c (grub_free): If the next free block which is being
|
||||||
|
|
11
kern/misc.c
11
kern/misc.c
|
@ -562,6 +562,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
|
||||||
char zerofill = ' ';
|
char zerofill = ' ';
|
||||||
int rightfill = 0;
|
int rightfill = 0;
|
||||||
int n;
|
int n;
|
||||||
|
int longfmt = 0;
|
||||||
|
|
||||||
if (*fmt && *fmt =='-')
|
if (*fmt && *fmt =='-')
|
||||||
{
|
{
|
||||||
|
@ -600,6 +601,11 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
|
||||||
}
|
}
|
||||||
|
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
|
if (c == 'l')
|
||||||
|
{
|
||||||
|
longfmt = 1;
|
||||||
|
c = *fmt++;
|
||||||
|
}
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
@ -610,7 +616,10 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'u':
|
case 'u':
|
||||||
case 'd':
|
case 'd':
|
||||||
n = va_arg (args, int);
|
if (longfmt)
|
||||||
|
n = va_arg (args, long);
|
||||||
|
else
|
||||||
|
n = va_arg (args, int);
|
||||||
grub_itoa (tmp, c, n);
|
grub_itoa (tmp, c, n);
|
||||||
if (!rightfill && grub_strlen (tmp) < format1)
|
if (!rightfill && grub_strlen (tmp) < format1)
|
||||||
write_fill (zerofill, format1 - grub_strlen (tmp));
|
write_fill (zerofill, format1 - grub_strlen (tmp));
|
||||||
|
|
Loading…
Reference in a new issue