cache: datafile: simplify next sector calculation

This commit is contained in:
Adam
2019-04-06 12:16:05 -04:00
parent bd9a69dc19
commit ed8a24b069

View File

@@ -186,23 +186,9 @@ public class DataFile implements Closeable
for (int part = 0; data.hasRemaining(); ++part) for (int part = 0; data.hasRemaining(); ++part)
{ {
int nextSector = 0; int nextSector = sector + 1; // we always just append sectors
int dataToWrite; int dataToWrite;
if (nextSector == 0)
{
nextSector = (int) ((dat.length() + (long) (SECTOR_SIZE - 1)) / (long) SECTOR_SIZE);
if (nextSector == 0)
{
++nextSector;
}
if (nextSector == sector)
{
++nextSector;
}
}
if (0xFFFF < archiveId) if (0xFFFF < archiveId)
{ {
if (data.remaining() <= 510) if (data.remaining() <= 510)