Avoid a compile-time format string warning
Obtained from: NetBSD MFC After: 1 week
This commit is contained in:
parent
facc2592c2
commit
698159c01a
@ -105,7 +105,6 @@ Field(buf, out, len)
|
||||
register char *bp = buf;
|
||||
int i, ibase, base16 = 0, base10 = 0, clen = 0;
|
||||
int hb[6], *hp;
|
||||
char *fmt;
|
||||
|
||||
/*
|
||||
* first try 2-273#2-852-151-014#socket
|
||||
@ -173,13 +172,11 @@ Field(buf, out, len)
|
||||
*--bp = 0; /* Ends Loop */
|
||||
}
|
||||
if (base16) {
|
||||
fmt = "%3x";
|
||||
ibase = 4096;
|
||||
} else if (base10 == 0 && *buf == '0') {
|
||||
fmt = "%3o";
|
||||
ibase = 512;
|
||||
} else {
|
||||
fmt = "%3d";
|
||||
base10 = 1;
|
||||
ibase = 1000;
|
||||
}
|
||||
|
||||
@ -190,13 +187,19 @@ Field(buf, out, len)
|
||||
bp = clen + buf - 3;
|
||||
hp = hb + i - 1;
|
||||
|
||||
while (hp > hb) {
|
||||
(void)sscanf(bp, fmt, hp);
|
||||
bp[0] = 0;
|
||||
hp--;
|
||||
bp -= 3;
|
||||
while (hp >= hb) {
|
||||
if (base16)
|
||||
(void)sscanf(bp, "%3x", hp);
|
||||
else if (base10)
|
||||
(void)sscanf(bp, "%3d", hp);
|
||||
else
|
||||
(void)sscanf(bp, "%3o", hp);
|
||||
if (hp > hb) {
|
||||
bp[0] = 0;
|
||||
hp--;
|
||||
bp -= 3;
|
||||
}
|
||||
}
|
||||
(void)sscanf(buf, fmt, hp);
|
||||
cvtbase((long)ibase, 256, hb, i, out, len);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user