Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 7e864570 authored by Deucе's avatar Deucе 👌🏾

Fix pretty_int() commas for negative values.

parent 671e287f
Pipeline #1412 passed with stage
in 9 minutes and 2 seconds
...@@ -1064,7 +1064,7 @@ function space_pad(str, len) ...@@ -1064,7 +1064,7 @@ function space_pad(str, len)
function pretty_int(int, rpad) function pretty_int(int, rpad)
{ {
var ret = parseInt(int, 10).toString(); var ret = parseInt(Math.abs(int), 10).toString();
var i; var i;
if (rpad === undefined) if (rpad === undefined)
rpad = 0; rpad = 0;
...@@ -1072,6 +1072,8 @@ function pretty_int(int, rpad) ...@@ -1072,6 +1072,8 @@ function pretty_int(int, rpad)
for (i = ret.length - 3; i > 0; i-= 3) { for (i = ret.length - 3; i > 0; i-= 3) {
ret = ret.substr(0, i)+','+ret.substr(i); ret = ret.substr(0, i)+','+ret.substr(i);
} }
if (int < 0)
ret = '-' + ret;
ret = space_pad(ret, rpad); ret = space_pad(ret, rpad);
return ret; return ret;
} }
......
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