mirror of
https://github.com/cc65/cc65.git
synced 2025-04-05 13:37:17 +00:00
Handling of the '+' and ' ' flags was incorrect if the value was negative
git-svn-id: svn://svn.cc65.org/cc65/trunk@389 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
7eae698264
commit
3b7f8eeaab
@ -148,15 +148,26 @@ flags_done:
|
||||
|
||||
case 'd':
|
||||
case 'i':
|
||||
if (addsign) {
|
||||
*s++ = '+';
|
||||
} else if (addblank) {
|
||||
*s++ = ' ';
|
||||
}
|
||||
if (islong) {
|
||||
ltoa (va_arg (ap, long), s, 10);
|
||||
} else {
|
||||
itoa (va_arg (ap, int), s, 10);
|
||||
if (islong) {
|
||||
l = va_arg (ap, long);
|
||||
if (l >= 0) {
|
||||
if (addsign) {
|
||||
*s++ = '+';
|
||||
} else if (addblank) {
|
||||
*s++ = ' ';
|
||||
}
|
||||
}
|
||||
ltoa (l, s, 10);
|
||||
} else {
|
||||
i = va_arg (ap, int);
|
||||
if (i >= 0) {
|
||||
if (addsign) {
|
||||
*s++ = '+';
|
||||
} else if (addblank) {
|
||||
*s++ = ' ';
|
||||
}
|
||||
}
|
||||
itoa (i, s, 10);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user