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

MRB_INT_MAX does not have corresponding positive integer
parent c5229074
......@@ -828,12 +828,8 @@ retry:
}
}
if (sign) {
if (v < 0) {
v = -v;
sc = '-';
width--;
}
else if (flags & FPLUS) {
if (v > 0) {
if (flags & FPLUS) {
sc = '+';
width--;
}
......@@ -841,6 +837,7 @@ retry:
sc = ' ';
width--;
}
}
switch (base) {
case 2:
strncpy(nbuf, RSTRING_PTR(val), sizeof(nbuf));
......
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