mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 09:10:53 +00:00
asprintf and snprintf support
This commit is contained in:
1 parent
c181849b95
commit
8b442f3f4c
60 files changed
+396
-345
No files matched your search
+4
-3
@@ -31,21 +31,22 @@ hexdump (unsigned long bse, char *buf, int len)
|
||||
{
|
||||
int cnt, i;
|
||||
|
||||
pos = grub_sprintf (line, "%08lx ", bse);
|
||||
pos = grub_snprintf (line, sizeof (line), "%08lx ", bse);
|
||||
cnt = 16;
|
||||
if (cnt > len)
|
||||
cnt = len;
|
||||
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
pos += grub_sprintf (&line[pos], "%02x ", (unsigned char) buf[i]);
|
||||
pos += grub_snprintf (&line[pos], sizeof (line) - pos,
|
||||
"%02x ", (unsigned char) buf[i]);
|
||||
if ((i & 7) == 7)
|
||||
line[pos++] = ' ';
|
||||
}
|
||||
|
||||
for (; i < 16; i++)
|
||||
{
|
||||
pos += grub_sprintf (&line[pos], " ");
|
||||
pos += grub_snprintf (&line[pos], sizeof (line) - pos, " ");
|
||||
if ((i & 7) == 7)
|
||||
line[pos++] = ' ';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user