mruby-sprintf:fix double negative signs in printf; fix #3148

MRB_INT_MAX does not have corresponding positive integer
parent c5229074
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment