Fix last piece length calculation for torrents > 2GB (ticket #361)
This commit is contained in:
@ -291,7 +291,7 @@ public class MetaInfo
|
|||||||
if (piece >= 0 && piece < pieces -1)
|
if (piece >= 0 && piece < pieces -1)
|
||||||
return piece_length;
|
return piece_length;
|
||||||
else if (piece == pieces -1)
|
else if (piece == pieces -1)
|
||||||
return (int)(length - piece * piece_length);
|
return (int)(length - ((long)piece * piece_length));
|
||||||
else
|
else
|
||||||
throw new IndexOutOfBoundsException("no piece: " + piece);
|
throw new IndexOutOfBoundsException("no piece: " + piece);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user