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

MRB_INT_MAX does not have corresponding positive integer
This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-04-23 22:25:33 +09:00
parent c5229074bb
commit 8f0c1c7d3c
+9 -12
View File
@@ -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: