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: ...@@ -828,18 +828,15 @@ retry:
} }
} }
if (sign) { if (sign) {
if (v < 0) { if (v > 0) {
v = -v; if (flags & FPLUS) {
sc = '-'; sc = '+';
width--; width--;
} }
else if (flags & FPLUS) { else if (flags & FSPACE) {
sc = '+'; sc = ' ';
width--; width--;
} }
else if (flags & FSPACE) {
sc = ' ';
width--;
} }
switch (base) { switch (base) {
case 2: 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