mirror of https://github.com/aria2/aria2
uitos: Fix off-by-one error bug
parent
6b7a51d5e0
commit
549dd5b2a7
|
@ -193,7 +193,7 @@ std::string uitos(T n, bool comma = false)
|
||||||
--i;
|
--i;
|
||||||
for(int j = 0; n; --i, ++j, n /= 10) {
|
for(int j = 0; n; --i, ++j, n /= 10) {
|
||||||
res[i] = (n%10) + '0';
|
res[i] = (n%10) + '0';
|
||||||
if(comma && (j+1)%3 == 0) {
|
if(comma && i > 1 && (j+1)%3 == 0) {
|
||||||
res[--i] = ',';
|
res[--i] = ',';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue