forked from I2P_Developers/i2p.i2p
i2psnark: Fix overflow in ratio sorter (ticket #2129)
This commit is contained in:
@ -313,16 +313,18 @@ class Sorters {
|
||||
|
||||
private static class RatioComparator extends Sort {
|
||||
|
||||
private static final long M = 128 * 1024 * 1024;
|
||||
|
||||
public RatioComparator(boolean rev) { super(rev); }
|
||||
|
||||
public int compareIt(Snark l, Snark r) {
|
||||
long lt = l.getTotalLength();
|
||||
long ld = lt > 0 ? ((M * l.getUploaded()) / lt) : 0;
|
||||
long rt = r.getTotalLength();
|
||||
long rd = rt > 0 ? ((M * r.getUploaded()) / rt) : 0;
|
||||
return compLong(ld, rd);
|
||||
double lt = l.getTotalLength();
|
||||
double ld = lt > 0 ? (l.getUploaded() / lt) : 0d;
|
||||
double rt = r.getTotalLength();
|
||||
double rd = rt > 0 ? (r.getUploaded() / rt) : 0d;
|
||||
if (ld < rd)
|
||||
return -1;
|
||||
if (ld > rd)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
27
history.txt
27
history.txt
@ -1,3 +1,28 @@
|
||||
2018-01-04 zzz
|
||||
* i2psnark: Fix overflow in ratio sorter (ticket #2129)
|
||||
|
||||
2017-12-23 zzz
|
||||
* SusiMail:
|
||||
- Fix filenames for inline attachments
|
||||
- Support RFC 5987/6266 for attachment and save-as filenames
|
||||
- Add alt tags for images
|
||||
- Fix long encoded lines in headers
|
||||
- Fix replacing underscores in Base 64 decoded headers
|
||||
|
||||
2017-12-22 zzz
|
||||
* SusiMail:
|
||||
- Fix bug sending CC recipients as a 2nd To line
|
||||
- Separate recipients by commas
|
||||
- Workaround on receive side for CC bug
|
||||
- Display To and CC lists on show page
|
||||
- Case-insensitive handling of all mail headers
|
||||
- Escape leading '-' in q-p encoding
|
||||
|
||||
2017-12-16 zzz
|
||||
* SusiMail:
|
||||
- Sorting cleanups and fixes, only sort when required
|
||||
- Show result after server check (ticket #2087)
|
||||
|
||||
2017-12-15 zzz
|
||||
* SusiMail: Don't store state in session object (ticket #1373)
|
||||
|
||||
@ -5,7 +30,7 @@
|
||||
* SusiMail (ticket #1373):
|
||||
- Put more parameters in forms and use P-R-G to
|
||||
put several parameters into the URLs
|
||||
- Redesign search parameter handling
|
||||
- Redesign sort parameter handling
|
||||
- Fix state tracking issues with delete
|
||||
|
||||
2017-12-13 zzz
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 16;
|
||||
public final static long BUILD = 17;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user