Исправлено возможное переполнение в downloader

This commit is contained in:
Victor 2016-12-08 13:46:00 +02:00
parent d902fe550a
commit 926ae52815

View File

@ -63,7 +63,7 @@ public final class downloader implements Module {
os.write(buffer, 0, readed);
downloaded += readed;
if (calculateProgressEnabled) {
final int percent = downloaded * 100 / contentLength;
final int percent = (int) (downloaded / ((double) contentLength) * 100.0);
progressCallback.execute(
NumberValue.of(percent),
NumberValue.of(downloaded),