REFACTOR: Remove redundant parentheses.

This commit is contained in:
2017-12-20 17:26:28 +00:00
parent a4650c61aa
commit b0936d51c5
160 changed files with 1096 additions and 1106 deletions

View File

@@ -79,7 +79,7 @@ namespace DiscImageChef.Partitions
Marshal.FreeHGlobal(bbPtr);
int checksum = 0;
for(int i = 0; i < 0x1FF; i++) checksum = ((checksum & 0xFF) + (checksum >> 8) + sector[i]);
for(int i = 0; i < 0x1FF; i++) checksum = (checksum & 0xFF) + (checksum >> 8) + sector[i];
int heads = bootBlock.discRecord.heads + ((bootBlock.discRecord.lowsector >> 6) & 1);
int secCyl = bootBlock.discRecord.spt * heads;

View File

@@ -117,14 +117,14 @@ namespace DiscImageChef.Partitions
CommonTypes.Partition part = new CommonTypes.Partition()
{
Size = (ulong)(ddm.sbMap[i].ddSize * 512),
Length = (ulong)((ddm.sbMap[i].ddSize * 512) / sector_size),
Length = (ulong)(ddm.sbMap[i].ddSize * 512 / sector_size),
Sequence = sequence,
Offset = ddm.sbMap[i].ddBlock * sector_size,
Start = ddm.sbMap[i].ddBlock + sectorOffset,
Type = "Apple_Driver"
};
if((ddm.sbMap[i].ddSize * 512) % sector_size > 0) part.Length++;
if(ddm.sbMap[i].ddSize * 512 % sector_size > 0) part.Length++;
partitions.Add(part);
@@ -163,10 +163,10 @@ namespace DiscImageChef.Partitions
CommonTypes.Partition part = new CommonTypes.Partition
{
Size = old_entry.pdStart * ddm.sbBlockSize,
Length = (old_entry.pdStart * ddm.sbBlockSize) / sector_size,
Length = old_entry.pdStart * ddm.sbBlockSize / sector_size,
Sequence = sequence,
Offset = old_entry.pdSize * ddm.sbBlockSize,
Start = (old_entry.pdSize * ddm.sbBlockSize) / sector_size,
Start = old_entry.pdSize * ddm.sbBlockSize / sector_size,
Scheme = Name
};
@@ -200,7 +200,7 @@ namespace DiscImageChef.Partitions
entry_size = 512;
entry_count = entry.entries;
skip_ddm = 512;
sectors_to_read = (((entry_count + 1) * 512) / sector_size) + 1;
sectors_to_read = (entry_count + 1) * 512 / sector_size + 1;
}
else
{
@@ -291,8 +291,8 @@ namespace DiscImageChef.Partitions
Name = StringHandlers.CToString(entry.name),
Offset = entry.start * entry_size,
Size = entry.sectors * entry_size,
Start = ((entry.start * entry_size) / sector_size) + sectorOffset,
Length = (entry.sectors * entry_size) / sector_size,
Start = entry.start * entry_size / sector_size + sectorOffset,
Length = entry.sectors * entry_size / sector_size,
Scheme = Name
};
sb.AppendLine("Partition flags:");
@@ -306,7 +306,7 @@ namespace DiscImageChef.Partitions
if(flags.HasFlag(AppleMapFlags.Bootable))
{
sb.AppendFormat("First boot sector: {0}",
(entry.first_boot_block * entry_size) / sector_size).AppendLine();
entry.first_boot_block * entry_size / sector_size).AppendLine();
sb.AppendFormat("Boot is {0} bytes.", entry.boot_size).AppendLine();
sb.AppendFormat("Boot load address: 0x{0:X8}", entry.load_address).AppendLine();
sb.AppendFormat("Boot entry point: 0x{0:X8}", entry.entry_point).AppendLine();

View File

@@ -109,7 +109,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].flag = 0x{1:X2}", i,
(table.icdEntries[i].type & 0xFF000000) >> 24);
DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].type = 0x{1:X6}", i,
(table.icdEntries[i].type & 0x00FFFFFF));
table.icdEntries[i].type & 0x00FFFFFF);
DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].start = {1}", i,
table.icdEntries[i].start);
DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].length = {1}", i,
@@ -123,7 +123,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].flag = 0x{1:X2}", i,
(table.entries[i].type & 0xFF000000) >> 24);
DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].type = 0x{1:X6}", i,
(table.entries[i].type & 0x00FFFFFF));
table.entries[i].type & 0x00FFFFFF);
DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].start = {1}", i,
table.entries[i].start);
DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].length = {1}", i,
@@ -148,7 +148,7 @@ namespace DiscImageChef.Partitions
if(table.entries[i].start <= imagePlugin.GetSectors())
{
if((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors())
if(table.entries[i].start + table.entries[i].length > imagePlugin.GetSectors())
DicConsole.DebugWriteLine("Atari partition plugin",
"WARNING: End of partition goes beyond device size");
@@ -242,7 +242,7 @@ namespace DiscImageChef.Partitions
validTable = true;
if(extendedTable.entries[j].start <= imagePlugin.GetSectors())
{
if((extendedTable.entries[j].start + extendedTable.entries[j].length) >
if(extendedTable.entries[j].start + extendedTable.entries[j].length >
imagePlugin.GetSectors())
DicConsole.DebugWriteLine("Atari partition plugin",
"WARNING: End of partition goes beyond device size");
@@ -324,7 +324,7 @@ namespace DiscImageChef.Partitions
{
if(table.icdEntries[i].start <= imagePlugin.GetSectors())
{
if((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors())
if(table.icdEntries[i].start + table.icdEntries[i].length > imagePlugin.GetSectors())
DicConsole.DebugWriteLine("Atari partition plugin",
"WARNING: End of partition goes beyond device size");

View File

@@ -80,8 +80,8 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("BSD plugin",
"dl.magic on sector {0} at offset {1} = 0x{2:X8} (expected 0x{3:X8})",
location + sectorOffset, offset, dl.d_magic, DISKMAGIC);
if((dl.d_magic == DISKMAGIC && dl.d_magic2 == DISKMAGIC) ||
(dl.d_magic == DISKCIGAM && dl.d_magic2 == DISKCIGAM))
if(dl.d_magic == DISKMAGIC && dl.d_magic2 == DISKMAGIC ||
dl.d_magic == DISKCIGAM && dl.d_magic2 == DISKCIGAM)
{
found = true;
break;
@@ -143,10 +143,10 @@ namespace DiscImageChef.Partitions
dl.d_partitions[i].p_fstype, fsTypeToString(dl.d_partitions[i].p_fstype));
Partition part = new Partition
{
Start = ((dl.d_partitions[i].p_offset * dl.d_secsize) / imagePlugin.GetSectorSize()),
Offset = (dl.d_partitions[i].p_offset * dl.d_secsize),
Length = (dl.d_partitions[i].p_size * dl.d_secsize) / imagePlugin.GetSectorSize(),
Size = (dl.d_partitions[i].p_size * dl.d_secsize),
Start = dl.d_partitions[i].p_offset * dl.d_secsize / imagePlugin.GetSectorSize(),
Offset = dl.d_partitions[i].p_offset * dl.d_secsize,
Length = dl.d_partitions[i].p_size * dl.d_secsize / imagePlugin.GetSectorSize(),
Size = dl.d_partitions[i].p_size * dl.d_secsize,
Type = fsTypeToString(dl.d_partitions[i].p_fstype),
Sequence = counter,
Scheme = Name
@@ -159,7 +159,7 @@ namespace DiscImageChef.Partitions
if(addSectorOffset)
{
part.Start += sectorOffset;
part.Offset += (sectorOffset * imagePlugin.GetSectorSize());
part.Offset += sectorOffset * imagePlugin.GetSectorSize();
}
DicConsole.DebugWriteLine("BSD plugin", "part.start = {0}", part.Start);
DicConsole.DebugWriteLine("BSD plugin", "Adding it...");

View File

@@ -73,16 +73,16 @@ namespace DiscImageChef.Partitions
{
Partition part = new Partition
{
Start = (entry.p_boffset / imagePlugin.GetSectorSize()) + sectorOffset,
Offset = entry.p_boffset + (sectorOffset * imagePlugin.GetSectorSize()),
Start = entry.p_boffset / imagePlugin.GetSectorSize() + sectorOffset,
Offset = entry.p_boffset + sectorOffset * imagePlugin.GetSectorSize(),
Size = entry.p_bsize,
Length = (entry.p_bsize / imagePlugin.GetSectorSize()),
Length = entry.p_bsize / imagePlugin.GetSectorSize(),
Name = entry.p_stor_uuid.ToString(),
Sequence = counter,
Scheme = Name
};
if((entry.p_bsize % imagePlugin.GetSectorSize()) > 0) part.Length++;
if(entry.p_bsize % imagePlugin.GetSectorSize() > 0) part.Length++;
if((BSD.fsType)entry.p_fstype == BSD.fsType.Other) part.Type = entry.p_type_uuid.ToString();
else part.Type = BSD.fsTypeToString((BSD.fsType)entry.p_fstype);

View File

@@ -124,11 +124,11 @@ namespace DiscImageChef.Partitions
sectorSize = imagePlugin.GetSectorSize();
}
uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize();
if((hdr.entries * hdr.entriesSize) % imagePlugin.GetSectorSize() > 0) totalEntriesSectors++;
uint totalEntriesSectors = hdr.entries * hdr.entriesSize / imagePlugin.GetSectorSize();
if(hdr.entries * hdr.entriesSize % imagePlugin.GetSectorSize() > 0) totalEntriesSectors++;
byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo);
byte[] entriesBytes = new byte[temp.Length - (modulo * 512)];
byte[] entriesBytes = new byte[temp.Length - modulo * 512];
Array.Copy(temp, modulo * 512, entriesBytes, 0, entriesBytes.Length);
List<GptEntry> entries = new List<GptEntry>();
@@ -163,8 +163,8 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("GPT Plugin", "entry.attributes = 0x{0:X16}", entry.attributes);
DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name);
if((entry.startLBA / divisor) > imagePlugin.GetSectors() ||
(entry.endLBA / divisor) > imagePlugin.GetSectors()) return false;
if(entry.startLBA / divisor > imagePlugin.GetSectors() ||
entry.endLBA / divisor > imagePlugin.GetSectors()) return false;
CommonTypes.Partition part = new CommonTypes.Partition
{

View File

@@ -285,7 +285,7 @@ namespace DiscImageChef.Partitions
imagePlugin.ImageInfo.Heads,
imagePlugin.ImageInfo.SectorsPerTrack) - ext_start;
}
ext_minix |= (ebr_entry.type == 0x81 || ebr_entry.type == 0x80);
ext_minix |= ebr_entry.type == 0x81 || ebr_entry.type == 0x80;
// For optical media
ext_start /= divider;
@@ -345,7 +345,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("MBR plugin", "next_start {0}", next_start);
processing_extended &= next_start != 0;
processing_extended &= (next_start <= imagePlugin.GetSectors());
processing_extended &= next_start <= imagePlugin.GetSectors();
lba_start = next_start;
}
}

View File

@@ -179,9 +179,9 @@ namespace DiscImageChef.Partitions
Type = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type),
Sequence = (ulong)i,
Name = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt),
Length = (ulong)((label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize) / sector_size),
Start = (ulong)(((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) *
label.dl_dt.d_secsize) / sector_size),
Length = (ulong)(label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize / sector_size),
Start = (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) *
label.dl_dt.d_secsize / sector_size),
Scheme = Name
};

View File

@@ -72,11 +72,11 @@ namespace DiscImageChef.Partitions
Partition _part = new Partition
{
Length = (end - start) + 1,
Length = end - start + 1,
Offset = (start + sectorOffset) * imagePlugin.GetSectorSize(),
Scheme = Name,
Sequence = (ulong)partitions.Count,
Size = ((end - start) + 1) * imagePlugin.GetSectorSize(),
Size = (end - start + 1) * imagePlugin.GetSectorSize(),
Start = start + sectorOffset,
Type = tokens[1]
};

View File

@@ -117,11 +117,11 @@ namespace DiscImageChef.Partitions
Partition part = new Partition
{
Start =
(dvh.partitions[i].first_block * dvh.device_params.dp_secbytes) / imagePlugin.GetSectorSize(),
Offset = (dvh.partitions[i].first_block * dvh.device_params.dp_secbytes),
dvh.partitions[i].first_block * dvh.device_params.dp_secbytes / imagePlugin.GetSectorSize(),
Offset = dvh.partitions[i].first_block * dvh.device_params.dp_secbytes,
Length =
(dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes) / imagePlugin.GetSectorSize(),
Size = (dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes),
dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes / imagePlugin.GetSectorSize(),
Size = dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes,
Type = TypeToString(dvh.partitions[i].type),
Sequence = counter,
Scheme = Name

View File

@@ -61,7 +61,7 @@ namespace DiscImageChef.Partitions
const int LEN_DKL_PAD = DK_LABEL_SIZE - (LEN_DKL_ASCII + NDKMAP * 8 + 14 * 2);
/// <summary>Size of padding in Solaris disk label with 8 partitions</summary>
const int LEN_DKL_PAD8 = DK_LABEL_SIZE - (LEN_DKL_ASCII + 136 + // sizeof(dk_vtoc8)
(NDKMAP * 8) + 14 * 2 + 2 * 2);
NDKMAP * 8 + 14 * 2 + 2 * 2);
const int LEN_DKL_PAD16 = DK_LABEL_SIZE - (456 + // sizeof(dk_vtoc16)
4 * 4 + 12 * 2 + 2 * 2);
@@ -197,12 +197,12 @@ namespace DiscImageChef.Partitions
CommonTypes.Partition part = new CommonTypes.Partition
{
Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
Length = (ulong)((dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE) / imagePlugin.GetSectorSize()),
Length = (ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.GetSectorSize()),
Sequence = (ulong)i,
Offset =
((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
Start = (((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
DK_LABEL_SIZE) / imagePlugin.GetSectorSize(),
Start = ((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
DK_LABEL_SIZE / imagePlugin.GetSectorSize(),
Type = "SunOS partition",
Scheme = Name
};
@@ -265,13 +265,13 @@ namespace DiscImageChef.Partitions
{
Description = SunFlagsToString(dkl8.dkl_vtoc.v_part[i].p_flag),
Size = (ulong)dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
Length = (ulong)((dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE) / imagePlugin.GetSectorSize()),
Length = (ulong)(dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.GetSectorSize()),
Sequence = (ulong)i,
Offset =
((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
Start =
(((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
DK_LABEL_SIZE) / imagePlugin.GetSectorSize(),
((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
DK_LABEL_SIZE / imagePlugin.GetSectorSize(),
Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag),
Scheme = Name
};
@@ -336,13 +336,13 @@ namespace DiscImageChef.Partitions
Description = SunFlagsToString(dkl16.dkl_vtoc.v_part[i].p_flag),
Size = (ulong)dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz,
Length =
(ulong)((dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz) /
(ulong)(dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz /
imagePlugin.GetSectorSize()),
Sequence = (ulong)i,
Offset =
((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz,
Start =
(((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz) /
((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz /
imagePlugin.GetSectorSize(),
Type = SunIdToString(dkl16.dkl_vtoc.v_part[i].p_tag),
Scheme = Name

View File

@@ -337,7 +337,7 @@ namespace DiscImageChef.Partitions
{
Partition part = new Partition
{
Start = ((ulong)(parts[i].p_start * bps) / imagePlugin.GetSectorSize()),
Start = (ulong)(parts[i].p_start * bps) / imagePlugin.GetSectorSize(),
Length = (ulong)(parts[i].p_size * bps) / imagePlugin.GetSectorSize(),
Offset = (ulong)(parts[i].p_start * bps),
Size = (ulong)(parts[i].p_size * bps),

View File

@@ -80,12 +80,12 @@ namespace DiscImageChef.Partitions
Partition part = new Partition
{
Start =
((ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.GetSectorSize()) +
(ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.GetSectorSize() +
sectorOffset,
Length = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE) / imagePlugin.GetSectorSize(),
Offset =
(ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) +
(imagePlugin.GetSectorSize() * sectorOffset),
imagePlugin.GetSectorSize() * sectorOffset,
Size = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE),
Sequence = (ulong)i,
Type = "XENIX",