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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,6 +29,8 @@ public abstract class PartitionSchemeTest
// ReSharper disable once ConditionIsAlwaysTrueOrFalse // ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here... // It arrives here...
if(!exists) if(!exists)
// ReSharper disable once HeuristicUnreachableCode
continue; continue;
var filtersList = new FiltersList(); 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/=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/=WithExpressionInsteadOfInitializer/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=WrongIndentSize/@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: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; <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; &lt;Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"&gt;&#xD;