Merge pull request 'Utils: improve bytes formatting' (#255) from tobtoht/feather:bytes_formatting into master

Reviewed-on: https://git.wownero.com/feather/feather/pulls/255
This commit is contained in:
tobtoht 2020-12-24 12:52:01 +00:00
commit 3b7731d44f

View file

@ -553,14 +553,14 @@ QString Utils::formatBytes(quint64 bytes)
int i; int i;
double _data; double _data;
for (i = 0; i < sizes.count() && bytes >= 1000; i++, bytes /= 1000) for (i = 0; i < sizes.count() && bytes >= 10000; i++, bytes /= 1000)
_data = bytes / 1000.0; _data = bytes / 1000.0;
if (_data < 0) if (_data < 0)
_data = 0; _data = 0;
// unrealistic // unrealistic
if (_data > 1000) if (_data > 10000)
_data = 0; _data = 0;
return QString("%1 %2").arg(QString::number(_data, 'f', 1), sizes[i]); return QString("%1 %2").arg(QString::number(_data, 'f', 1), sizes[i]);