Remove unreachable code.

This commit is contained in:
2022-11-15 00:17:12 +00:00
parent 0eb589d785
commit 2f6ef0c498
11 changed files with 69 additions and 92 deletions

View File

@@ -63,55 +63,55 @@ sealed partial class Dump
/// <summary>Dumps a compact disc</summary>
void CompactDisc()
{
ExtentsULong audioExtents; // Extents with audio sectors
ulong blocks; // Total number of positive sectors
uint blockSize; // Size of the read sector in bytes
CdOffset cdOffset; // Read offset from database
byte[] cmdBuf; // Data buffer
DumpHardwareType currentTry = null; // Current dump hardware try
double currentSpeed = 0; // Current read speed
int? discOffset = null; // Disc write offset
DateTime dumpStart = DateTime.UtcNow; // Time of dump start
DateTime end; // Time of operation end
ExtentsULong extents = null; // Extents
bool hiddenData; // Hidden track is data
IbgLog ibgLog; // IMGBurn log
double imageWriteDuration = 0; // Duration of image write
long lastSector; // Last sector number
ExtentsULong audioExtents; // Extents with audio sectors
ulong blocks; // Total number of positive sectors
uint blockSize; // Size of the read sector in bytes
CdOffset cdOffset; // Read offset from database
byte[] cmdBuf; // Data buffer
DumpHardwareType currentTry = null; // Current dump hardware try
double currentSpeed = 0; // Current read speed
int? discOffset = null; // Disc write offset
DateTime dumpStart = DateTime.UtcNow; // Time of dump start
DateTime end; // Time of operation end
ExtentsULong extents = null; // Extents
bool hiddenData; // Hidden track is data
IbgLog ibgLog; // IMGBurn log
double imageWriteDuration = 0; // Duration of image write
long lastSector; // Last sector number
var leadOutExtents = new ExtentsULong(); // Lead-out extents
Dictionary<int, long> leadOutStarts = new(); // Lead-out starts
double maxSpeed = double.MinValue; // Maximum speed
MhddLog mhddLog; // MHDD log
double minSpeed = double.MaxValue; // Minimum speed
bool newTrim; // Is trim a new one?
var offsetBytes = 0; // Read offset
var read6 = false; // Device supports READ(6)
var read10 = false; // Device supports READ(10)
var read12 = false; // Device supports READ(12)
var read16 = false; // Device supports READ(16)
bool readcd; // Device supports READ CD
bool ret; // Image writing return status
const uint sectorSize = 2352; // Full sector size
var sectorsForOffset = 0; // Sectors needed to fix offset
var sense = true; // Sense indicator
int sessions; // Number of sessions in disc
DateTime start; // Start of operation
SubchannelLog subLog = null; // Subchannel log
uint subSize; // Subchannel size in bytes
TrackSubchannelType subType; // Track subchannel type
var supportsLongSectors = true; // Supports reading EDC and ECC
bool supportsPqSubchannel; // Supports reading PQ subchannel
bool supportsRwSubchannel; // Supports reading RW subchannel
byte[] tmpBuf; // Temporary buffer
FullTOC.CDFullTOC? toc; // Full CD TOC
double totalDuration = 0; // Total commands duration
Dictionary<byte, byte> trackFlags = new(); // Track flags
Track[] tracks; // Tracks in disc
int firstTrackLastSession; // Number of first track in last session
bool hiddenTrack; // Disc has a hidden track before track 1
MmcSubchannel supportedSubchannel; // Drive's maximum supported subchannel
MmcSubchannel desiredSubchannel; // User requested subchannel
var bcdSubchannel = false; // Subchannel positioning is in BCD
Dictionary<int, long> leadOutStarts = new(); // Lead-out starts
double maxSpeed = double.MinValue; // Maximum speed
MhddLog mhddLog; // MHDD log
double minSpeed = double.MaxValue; // Minimum speed
bool newTrim; // Is trim a new one?
var offsetBytes = 0; // Read offset
var read6 = false; // Device supports READ(6)
var read10 = false; // Device supports READ(10)
var read12 = false; // Device supports READ(12)
var read16 = false; // Device supports READ(16)
var readcd = true; // Device supports READ CD
bool ret; // Image writing return status
const uint sectorSize = 2352; // Full sector size
var sectorsForOffset = 0; // Sectors needed to fix offset
var sense = true; // Sense indicator
int sessions; // Number of sessions in disc
DateTime start; // Start of operation
SubchannelLog subLog = null; // Subchannel log
uint subSize = 0; // Subchannel size in bytes
TrackSubchannelType subType = TrackSubchannelType.None; // Track subchannel type
var supportsLongSectors = true; // Supports reading EDC and ECC
bool supportsPqSubchannel; // Supports reading PQ subchannel
bool supportsRwSubchannel; // Supports reading RW subchannel
byte[] tmpBuf; // Temporary buffer
FullTOC.CDFullTOC? toc; // Full CD TOC
double totalDuration = 0; // Total commands duration
Dictionary<byte, byte> trackFlags = new(); // Track flags
Track[] tracks; // Tracks in disc
int firstTrackLastSession; // Number of first track in last session
bool hiddenTrack; // Disc has a hidden track before track 1
MmcSubchannel supportedSubchannel; // Drive's maximum supported subchannel
MmcSubchannel desiredSubchannel; // User requested subchannel
var bcdSubchannel = false; // Subchannel positioning is in BCD
Dictionary<byte, string> isrcs = new();
string mcn = null;
HashSet<int> subchannelExtents = new();
@@ -338,13 +338,6 @@ sealed partial class Dump
readcd = true;
break;
default:
_dumpLog.WriteLine("Handling subchannel type {0} not supported, exiting...", supportedSubchannel);
StoppingErrorMessage?.Invoke($"Handling subchannel type {supportedSubchannel
} not supported, exiting...");
return;
}
switch(desiredSubchannel)

View File

@@ -559,7 +559,6 @@ partial class Dump
supportedPlextorSubchannel = supportedSubchannel switch
{
MmcSubchannel.None => PlextorSubchannel.None,
MmcSubchannel.Raw => PlextorSubchannel.All,
MmcSubchannel.Q16 => PlextorSubchannel.Q16,
MmcSubchannel.Rw => PlextorSubchannel.Pack,

View File

@@ -962,9 +962,9 @@ public sealed partial class BlindWrite4
if(length + sectorAddress > aaruTrack.EndSector - aaruTrack.StartSector + 1)
return ErrorNumber.OutOfRange;
uint sectorOffset;
uint sectorSize;
uint sectorSkip;
uint sectorOffset = 0;
uint sectorSize = 0;
uint sectorSkip = 0;
if(aaruTrack.Type == CommonTypes.Enums.TrackType.Data)
return ErrorNumber.NotSupported;
@@ -1054,7 +1054,6 @@ public sealed partial class BlindWrite4
break;
}
default: return ErrorNumber.NotSupported;
}
break;
@@ -1091,7 +1090,6 @@ public sealed partial class BlindWrite4
break;
}
default: return ErrorNumber.NotSupported;
}
break;

View File

@@ -1097,9 +1097,9 @@ public sealed partial class Cdrdao
if(length > aaruTrack.Sectors)
return ErrorNumber.OutOfRange;
uint sectorOffset;
uint sectorSize;
uint sectorSkip = 0;
uint sectorOffset = 0;
uint sectorSize = 0;
uint sectorSkip = 0;
if(!aaruTrack.Subchannel &&
tag == SectorTagType.CdSectorSubchannel)
@@ -1236,7 +1236,6 @@ public sealed partial class Cdrdao
break;
}
default: return ErrorNumber.NotSupported;
}
break;

View File

@@ -1869,9 +1869,9 @@ public sealed partial class CdrWin
if(length > aaruTrack.Sectors)
return ErrorNumber.OutOfRange;
uint sectorOffset;
uint sectorSize;
uint sectorSkip;
uint sectorOffset = 0;
uint sectorSize = 0;
uint sectorSkip = 0;
switch(tag)
{
@@ -1968,7 +1968,6 @@ public sealed partial class CdrWin
break;
}
default: return ErrorNumber.NotSupported;
}
break;
@@ -2037,7 +2036,6 @@ public sealed partial class CdrWin
break;
}
default: return ErrorNumber.NotSupported;
}
break;

View File

@@ -1621,7 +1621,6 @@ public sealed partial class Chd
{
case SectorTagType.CdSectorSync:
case SectorTagType.CdSectorHeader:
case SectorTagType.CdSectorSubchannel:
case SectorTagType.CdSectorEcc:
case SectorTagType.CdSectorEccP:
case SectorTagType.CdSectorEccQ: return ErrorNumber.NotSupported;

View File

@@ -1101,9 +1101,9 @@ public sealed partial class CloneCd
default: return ErrorNumber.NotSupported;
}
uint sectorOffset;
uint sectorSize;
uint sectorSkip;
uint sectorOffset = 0;
uint sectorSize = 0;
uint sectorSkip = 0;
switch(aaruTrack.Type)
{
@@ -1159,7 +1159,6 @@ public sealed partial class CloneCd
break;
}
default: return ErrorNumber.NotSupported;
}
break;
@@ -1188,7 +1187,6 @@ public sealed partial class CloneCd
break;
}
default: return ErrorNumber.NotSupported;
}
break;
@@ -1252,7 +1250,6 @@ public sealed partial class CloneCd
break;
}
default: return ErrorNumber.NotSupported;
}
break;

View File

@@ -555,9 +555,9 @@ public sealed partial class Gdi
if(length > aaruTrack.Sectors)
return ErrorNumber.OutOfRange;
uint sectorOffset;
uint sectorSize;
uint sectorSkip;
uint sectorOffset = 0;
uint sectorSize = 0;
uint sectorSkip = 0;
switch(tag)
{
@@ -605,8 +605,6 @@ public sealed partial class Gdi
break;
}
case SectorTagType.CdSectorSubchannel:
case SectorTagType.CdSectorSubHeader: return ErrorNumber.NotSupported;
case SectorTagType.CdSectorEcc:
{
sectorOffset = 2076;
@@ -639,7 +637,6 @@ public sealed partial class Gdi
break;
}
default: return ErrorNumber.NotSupported;
}
break;

View File

@@ -1757,9 +1757,9 @@ public sealed partial class Nero
if(length > aaruTrack.Sectors)
return ErrorNumber.OutOfRange;
uint sectorOffset;
uint sectorSize;
uint sectorSkip;
uint sectorOffset = 0;
uint sectorSize = 0;
uint sectorSkip = 0;
switch(tag)
{
@@ -1820,8 +1820,6 @@ public sealed partial class Nero
break;
}
default: return ErrorNumber.NotSupported;
}
break;
@@ -1888,8 +1886,6 @@ public sealed partial class Nero
break;
}
default: return ErrorNumber.NotSupported;
}
break;
@@ -2014,8 +2010,6 @@ public sealed partial class Nero
break;
}
default: return ErrorNumber.NotSupported;
}
break;

View File

@@ -29,6 +29,8 @@ public abstract class PartitionSchemeTest
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
// ReSharper disable once HeuristicUnreachableCode
continue;
var filtersList = new FiltersList();

View File

@@ -302,6 +302,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VirtualMemberNeverOverridden_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WithExpressionInsteadOfInitializer/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WrongIndentSize/@EntryIndexedValue">WARNING</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_COMMENTS_AT_FIRST_COLUMN/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/HtmlFormatter/DeleteQuotesInSpaceFreeText/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&#xD;
&lt;Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"&gt;&#xD;