Some general-purpose lint cleanup

This commit is contained in:
TacoTheDank 2020-08-27 16:56:58 -04:00 committed by Stypox
parent 273c287fbf
commit f86b40302d
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
17 changed files with 24 additions and 31 deletions

View file

@ -633,7 +633,7 @@ public class DownloadMission extends Mission {
calculated = offsets[current < offsets.length ? current : (offsets.length - 1)] + length;
calculated -= offsets[0];// don't count reserved space
return calculated > nearLength ? calculated : nearLength;
return Math.max(calculated, nearLength);
}
/**

View file

@ -30,12 +30,12 @@ public class FileStream extends SharpStream {
}
@Override
public int read(byte b[]) throws IOException {
public int read(byte[] b) throws IOException {
return source.read(b);
}
@Override
public int read(byte b[], int off, int len) throws IOException {
public int read(byte[] b, int off, int len) throws IOException {
return source.read(b, off, len);
}

View file

@ -115,7 +115,7 @@ public abstract class Postprocessing implements Serializable {
mission.done = 0;
long length = mission.storage.length() - mission.offsets[0];
mission.length = length > mission.nearLength ? length : mission.nearLength;
mission.length = Math.max(length, mission.nearLength);
final ProgressReport readProgress = (long position) -> {
position -= mission.offsets[0];

View file

@ -49,6 +49,7 @@ import java.io.File;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import us.shandian.giga.get.DownloadMission;
@ -302,9 +303,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
float averageSpeed = speed;
if (h.lastSpeedIdx < 0) {
for (int i = 0; i < h.lastSpeed.length; i++) {
h.lastSpeed[i] = speed;
}
Arrays.fill(h.lastSpeed, speed);
h.lastSpeedIdx = 0;
} else {
for (int i = 0; i < h.lastSpeed.length; i++) {