mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-sprintf:fix double negative signs in printf; fix #3148
MRB_INT_MAX does not have corresponding positive integer
This commit is contained in:
@@ -828,18 +828,15 @@ retry:
|
||||
}
|
||||
}
|
||||
if (sign) {
|
||||
if (v < 0) {
|
||||
v = -v;
|
||||
sc = '-';
|
||||
width--;
|
||||
}
|
||||
else if (flags & FPLUS) {
|
||||
sc = '+';
|
||||
width--;
|
||||
}
|
||||
else if (flags & FSPACE) {
|
||||
sc = ' ';
|
||||
width--;
|
||||
if (v > 0) {
|
||||
if (flags & FPLUS) {
|
||||
sc = '+';
|
||||
width--;
|
||||
}
|
||||
else if (flags & FSPACE) {
|
||||
sc = ' ';
|
||||
width--;
|
||||
}
|
||||
}
|
||||
switch (base) {
|
||||
case 2:
|
||||
|
||||
Reference in New Issue
Block a user