Inline 'out' variable declaration.

This commit is contained in:
2022-11-14 01:10:11 +00:00
parent 073b7c183d
commit e0508f096c
11 changed files with 14 additions and 31 deletions

View File

@@ -71,8 +71,6 @@ partial class Dump
return sense; return sense;
} }
byte[] subBuf;
uint subSize = supportedPlextorSubchannel == PlextorSubchannel.Q16 ? 16u : 96u; uint subSize = supportedPlextorSubchannel == PlextorSubchannel.Q16 ? 16u : 96u;
if(supportedPlextorSubchannel is PlextorSubchannel.Q16 or PlextorSubchannel.Pack) if(supportedPlextorSubchannel is PlextorSubchannel.Q16 or PlextorSubchannel.Pack)
@@ -94,7 +92,7 @@ partial class Dump
if(sense) if(sense)
return true; return true;
sense = _dev.PlextorReadCdDa(out subBuf, out senseBuf, firstSectorToRead, subSize, blocksToRead, sense = _dev.PlextorReadCdDa(out byte[] subBuf, out senseBuf, firstSectorToRead, subSize, blocksToRead,
supportedPlextorSubchannel == PlextorSubchannel.Pack ? PlextorSubchannel.All supportedPlextorSubchannel == PlextorSubchannel.Pack ? PlextorSubchannel.All
: supportedPlextorSubchannel, 0, out cmdDuration); : supportedPlextorSubchannel, 0, out cmdDuration);

View File

@@ -71,7 +71,6 @@ partial class Dump
byte[] readBuffer; byte[] readBuffer;
Modes.DecodedMode? decMode = null; Modes.DecodedMode? decMode = null;
Dictionary<MediaTagType, byte[]> mediaTags = new(); Dictionary<MediaTagType, byte[]> mediaTags = new();
byte[] cmdBuf;
bool ret; bool ret;
if(_outputPlugin is not IWritableImage outputFormat) if(_outputPlugin is not IWritableImage outputFormat)
@@ -89,7 +88,7 @@ partial class Dump
_dumpLog.WriteLine("Requesting MODE SENSE (6)."); _dumpLog.WriteLine("Requesting MODE SENSE (6).");
UpdateStatus?.Invoke("Requesting MODE SENSE (6)."); UpdateStatus?.Invoke("Requesting MODE SENSE (6).");
sense = _dev.ModeSense6(out cmdBuf, out _, true, ScsiModeSensePageControl.Current, 0x3F, 5, out _); sense = _dev.ModeSense6(out byte[] cmdBuf, out _, true, ScsiModeSensePageControl.Current, 0x3F, 5, out _);
if(!sense && if(!sense &&
!_dev.Error && !_dev.Error &&

View File

@@ -388,9 +388,7 @@ partial class Dump
{ {
if(outputFormat is IWritableOpticalImage opticalPlugin) if(outputFormat is IWritableOpticalImage opticalPlugin)
{ {
byte[] readBuffer; sense = _dev.ReadDiscInformation(out byte[] readBuffer, out _, MmcDiscInformationDataTypes.DiscInformation,
sense = _dev.ReadDiscInformation(out readBuffer, out _, MmcDiscInformationDataTypes.DiscInformation,
_dev.Timeout, out _); _dev.Timeout, out _);
if(!sense) if(!sense)

View File

@@ -221,8 +221,6 @@ public sealed partial class DeviceReport
{ {
Modes.DecodedMode? decMode = null; Modes.DecodedMode? decMode = null;
PeripheralDeviceTypes devType = _dev.ScsiType; PeripheralDeviceTypes devType = _dev.ScsiType;
byte[] mode10Buffer;
byte[] mode6Buffer;
bool sense; bool sense;
mediumType = 0; mediumType = 0;
@@ -240,7 +238,7 @@ public sealed partial class DeviceReport
{ {
var saveBuffer = false; var saveBuffer = false;
sense = _dev.ModeSense10(out mode10Buffer, out _, false, true, pageControl, 0x3F, 0xFF, _dev.Timeout, sense = _dev.ModeSense10(out byte[] mode10Buffer, out _, false, true, pageControl, 0x3F, 0xFF, _dev.Timeout,
out _); out _);
if(sense || _dev.Error) if(sense || _dev.Error)
@@ -321,7 +319,7 @@ public sealed partial class DeviceReport
}) })
{ {
var saveBuffer = false; var saveBuffer = false;
sense = _dev.ModeSense6(out mode6Buffer, out _, true, pageControl, 0x3F, 0xFF, _dev.Timeout, out _); sense = _dev.ModeSense6(out byte[] mode6Buffer, out _, true, pageControl, 0x3F, 0xFF, _dev.Timeout, out _);
if(sense || _dev.Error) if(sense || _dev.Error)
{ {

View File

@@ -1606,7 +1606,6 @@ public static class CompactDisc
foreach(int sector in subchannelExtents) foreach(int sector in subchannelExtents)
{ {
Track track = tracks.LastOrDefault(t => (int)t.StartSector <= sector); Track track = tracks.LastOrDefault(t => (int)t.StartSector <= sector);
byte trkFlags;
byte flags; byte flags;
ulong trackStart; ulong trackStart;
ulong pregap; ulong pregap;
@@ -1627,7 +1626,7 @@ public static class CompactDisc
pregap = track.Pregap; pregap = track.Pregap;
} }
if(!trackFlags.TryGetValue((byte)(track?.Sequence ?? 0), out trkFlags) && if(!trackFlags.TryGetValue((byte)(track?.Sequence ?? 0), out byte trkFlags) &&
track?.Type != TrackType.Audio) track?.Type != TrackType.Audio)
flags = (byte)CdFlags.DataTrack; flags = (byte)CdFlags.DataTrack;
else else

View File

@@ -293,7 +293,6 @@ public static class MMC
{ {
uint startOfFirstDataTrack = uint.MaxValue; uint startOfFirstDataTrack = uint.MaxValue;
DI.DiscInformation? blurayDi = null; DI.DiscInformation? blurayDi = null;
byte[] cmdBuf;
bool sense; bool sense;
byte secondSessionFirstTrack = 0; byte secondSessionFirstTrack = 0;
byte[] sector0; byte[] sector0;
@@ -309,7 +308,7 @@ public static class MMC
hiddenTrack = false; hiddenTrack = false;
hiddenData = false; hiddenData = false;
sense = dev.GetConfiguration(out cmdBuf, out _, 0, MmcGetConfigurationRt.Current, dev.Timeout, out _); sense = dev.GetConfiguration(out byte[] cmdBuf, out _, 0, MmcGetConfigurationRt.Current, dev.Timeout, out _);
if(!sense) if(!sense)
{ {

View File

@@ -299,9 +299,7 @@ public sealed partial class Sidecar
xmlTrk.StartSector = trk.StartSector; xmlTrk.StartSector = trk.StartSector;
xmlTrk.EndSector = trk.EndSector; xmlTrk.EndSector = trk.EndSector;
int idx0; if(trk.Indexes?.TryGetValue(0, out int idx0) == true &&
if(trk.Indexes?.TryGetValue(0, out idx0) == true &&
idx0 >= 0) idx0 >= 0)
xmlTrk.StartSector = (ulong)idx0; xmlTrk.StartSector = (ulong)idx0;

View File

@@ -969,10 +969,9 @@ public sealed partial class CdrWin
if(leadouts.TryGetValue((byte)s, out int leadout)) if(leadouts.TryGetValue((byte)s, out int leadout))
{ {
int startSector;
sessions[s - 1].EndSector = (ulong)(leadout - 1); sessions[s - 1].EndSector = (ulong)(leadout - 1);
if(!cueTracks[lastSessionTrack].Indexes.TryGetValue(0, out startSector)) if(!cueTracks[lastSessionTrack].Indexes.TryGetValue(0, out int startSector))
cueTracks[lastSessionTrack].Indexes.TryGetValue(1, out startSector); cueTracks[lastSessionTrack].Indexes.TryGetValue(1, out startSector);
cueTracks[lastSessionTrack].Sectors = (ulong)(leadout - startSector); cueTracks[lastSessionTrack].Sectors = (ulong)(leadout - startSector);

View File

@@ -268,8 +268,7 @@ public sealed partial class WCDiskImage
case SectorFlag.Normal: /* read a normal sector and store it in cache */ case SectorFlag.Normal: /* read a normal sector and store it in cache */
stream.Read(sectorData, 0, 512); stream.Read(sectorData, 0, 512);
_sectorCache[(cyl, head, sect)] = sectorData; _sectorCache[(cyl, head, sect)] = sectorData;
byte[] crc; CRC16IBMContext.Data(sectorData, 512, out byte[] crc);
CRC16IBMContext.Data(sectorData, 512, out crc);
var calculatedCRC = (short)((256 * crc[0]) | crc[1]); var calculatedCRC = (short)((256 * crc[0]) | crc[1]);
/* /*
AaruConsole.DebugWriteLine("d2f plugin", "CHS {0},{1},{2}: Regular sector, stored CRC=0x{3:x4}, calculated CRC=0x{4:x4}", AaruConsole.DebugWriteLine("d2f plugin", "CHS {0},{1},{2}: Regular sector, stored CRC=0x{3:x4}, calculated CRC=0x{4:x4}",

View File

@@ -13,10 +13,8 @@ static partial class ScsiMmc
{ {
static void CheckGdromReadability(string devPath, Device dev) static void CheckGdromReadability(string devPath, Device dev)
{ {
int item;
var tocIsNotBcd = false; var tocIsNotBcd = false;
bool sense; bool sense;
byte[] buffer;
byte[] senseBuffer; byte[] senseBuffer;
start: start:
@@ -54,7 +52,7 @@ static partial class ScsiMmc
Thread.Sleep(2000); Thread.Sleep(2000);
} while(retries < 25); } while(retries < 25);
sense = dev.ReadRawToc(out buffer, out senseBuffer, 1, dev.Timeout, out _); sense = dev.ReadRawToc(out byte[] buffer, out senseBuffer, 1, dev.Timeout, out _);
if(sense) if(sense)
{ {
@@ -410,7 +408,7 @@ static partial class ScsiMmc
string strDev = Console.ReadLine(); string strDev = Console.ReadLine();
if(!int.TryParse(strDev, out item)) if(!int.TryParse(strDev, out int item))
{ {
AaruConsole.WriteLine("Not a number. Press any key to continue..."); AaruConsole.WriteLine("Not a number. Press any key to continue...");
Console.ReadKey(); Console.ReadKey();

View File

@@ -13,10 +13,8 @@ static partial class ScsiMmc
{ {
static void ReadLeadOutUsingTrapDisc(string devPath, Device dev) static void ReadLeadOutUsingTrapDisc(string devPath, Device dev)
{ {
int item;
var tocIsNotBcd = false; var tocIsNotBcd = false;
bool sense; bool sense;
byte[] buffer;
byte[] senseBuffer; byte[] senseBuffer;
start: start:
@@ -54,7 +52,7 @@ static partial class ScsiMmc
Thread.Sleep(2000); Thread.Sleep(2000);
} while(retries < 25); } while(retries < 25);
sense = dev.ReadRawToc(out buffer, out senseBuffer, 1, dev.Timeout, out _); sense = dev.ReadRawToc(out byte[] buffer, out senseBuffer, 1, dev.Timeout, out _);
if(sense) if(sense)
{ {
@@ -399,7 +397,7 @@ static partial class ScsiMmc
string strDev = Console.ReadLine(); string strDev = Console.ReadLine();
if(!int.TryParse(strDev, out item)) if(!int.TryParse(strDev, out int item))
{ {
AaruConsole.WriteLine("Not a number. Press any key to continue..."); AaruConsole.WriteLine("Not a number. Press any key to continue...");
Console.ReadKey(); Console.ReadKey();