Correctly handle phex(*,0) and phex_nz(*,0).
This commit is contained in:
parent
faf833caca
commit
45a1e86678
2 changed files with 6 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
* utils.c (phex_nz): For default case, set str to phex_nz return
|
||||
value.
|
||||
(phex): Ditto.
|
||||
|
||||
2001-11-15 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
|
|
|
@ -2418,22 +2418,25 @@ static int thirty_two = 32;
|
|||
char *
|
||||
phex (ULONGEST l, int sizeof_l)
|
||||
{
|
||||
char *str = get_cell ();
|
||||
char *str;
|
||||
switch (sizeof_l)
|
||||
{
|
||||
case 8:
|
||||
str = get_cell ();
|
||||
sprintf (str, "%08lx%08lx",
|
||||
(unsigned long) (l >> thirty_two),
|
||||
(unsigned long) (l & 0xffffffff));
|
||||
break;
|
||||
case 4:
|
||||
str = get_cell ();
|
||||
sprintf (str, "%08lx", (unsigned long) l);
|
||||
break;
|
||||
case 2:
|
||||
str = get_cell ();
|
||||
sprintf (str, "%04x", (unsigned short) (l & 0xffff));
|
||||
break;
|
||||
default:
|
||||
phex (l, sizeof (l));
|
||||
str = phex (l, sizeof (l));
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
|
|
Loading…
Reference in a new issue