use correct max blocks

This commit is contained in:
Denis Molony 2016-02-28 16:41:30 +11:00
parent 445ec60318
commit 7603a89c3a

View File

@ -56,9 +56,14 @@ class VolumeDirectoryHeader extends DirectoryHeader
}
block = 0;
// int max = (totalBlocks - 1) / 8 + 1; // bytes required for sector map
// nb dual-dos disk needs to use totalBlocks obtained from disk
// int max1 = (totalBlocks - 1) / 8 + 1; // bytes required for sector map
// nb disk may be truncated, so use actual number of blocks
int max = (disk.getTotalBlocks () - 1) / 8 + 1; // bytes required for sector map
// int max2 = (disk.getTotalBlocks () - 1) / 8 + 1; // bytes required for sector map
int max = (Math.min (totalBlocks, disk.getTotalBlocks ()) - 1) / 8 + 1;
for (int i = 0; i < max; i++)
{