REFACTOR: Invert 'if' statement to reduce nesting.

This commit is contained in:
2017-12-21 06:06:19 +00:00
parent 9cd1869d1d
commit 4d886dae25
138 changed files with 9447 additions and 9806 deletions

View File

@@ -237,16 +237,17 @@ namespace DiscImageChef.DiscImages
}
// For empty cylinders
if(sectorsOff[cyl][head].Length == 0)
if(cyl + 1 == hdr.cylinders ||
// Next cylinder is also empty
sectorsOff[cyl + 1][head].Length == 0) emptyCyl = true;
// Create empty sectors
else
{
sectorsData[cyl][head] = new byte[spt][];
for(int i = 0; i < spt; i++) sectorsData[cyl][head][i] = new byte[ImageInfo.SectorSize];
}
if(sectorsOff[cyl][head].Length != 0) continue;
if(cyl + 1 == hdr.cylinders ||
// Next cylinder is also empty
sectorsOff[cyl + 1][head].Length == 0) emptyCyl = true;
// Create empty sectors
else
{
sectorsData[cyl][head] = new byte[spt][];
for(int i = 0; i < spt; i++) sectorsData[cyl][head][i] = new byte[ImageInfo.SectorSize];
}
}
if(emptyCyl) ImageInfo.Cylinders--;