Skip to content

Commit

Permalink
[Refactor] Merge into logical patterns.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed May 1, 2024
1 parent b75fcf0 commit c58d4a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Aaru.Filesystems/CBM/CBM.cs
Expand Up @@ -99,7 +99,7 @@ public ErrorNumber ReadLink(string path, out string dest)

ulong CbmChsToLba(byte track, byte sector, bool is1581)
{
if(track == 0 || track > 40) return 0;
if(track is 0 or > 40) return 0;

if(is1581) return (ulong)((track - 1) * 40 + sector - 1);

Expand Down
40 changes: 21 additions & 19 deletions Aaru.Images/AaruFormat/Write.cs
Expand Up @@ -1926,8 +1926,9 @@ public bool WriteSector(byte[] data, ulong sectorAddress)

// Fill FLAC block
if(remaining != 0)
for(var r = 0; r < remaining * 4; r++)
_writingBuffer[_writingBufferPosition + r] = 0;
{
for(var r = 0; r < remaining * 4; r++) _writingBuffer[_writingBufferPosition + r] = 0;
}

compressedLength = FLAC.EncodeBuffer(_writingBuffer,
_compressedBuffer,
Expand Down Expand Up @@ -2126,21 +2127,21 @@ public bool WriteSectorLong(byte[] data, ulong sectorAddress)
if(track.Sequence == 0 && track.StartSector == 0 && track.EndSector == 0) track.Type = TrackType.Data;

if(data.Length == 2064 &&
(_imageInfo.MediaType == MediaType.DVDROM ||
_imageInfo.MediaType == MediaType.PS2DVD ||
_imageInfo.MediaType == MediaType.SACD ||
_imageInfo.MediaType == MediaType.PS3DVD ||
_imageInfo.MediaType == MediaType.DVDR ||
_imageInfo.MediaType == MediaType.DVDRW ||
_imageInfo.MediaType == MediaType.DVDPR ||
_imageInfo.MediaType == MediaType.DVDPRW ||
_imageInfo.MediaType == MediaType.DVDPRWDL ||
_imageInfo.MediaType == MediaType.DVDRDL ||
_imageInfo.MediaType == MediaType.DVDPRDL ||
_imageInfo.MediaType == MediaType.DVDRAM ||
_imageInfo.MediaType == MediaType.DVDRWDL ||
_imageInfo.MediaType == MediaType.DVDDownload ||
_imageInfo.MediaType == MediaType.Nuon))
_imageInfo.MediaType is MediaType.DVDROM
or MediaType.PS2DVD
or MediaType.SACD
or MediaType.PS3DVD
or MediaType.DVDR
or MediaType.DVDRW
or MediaType.DVDPR
or MediaType.DVDPRW
or MediaType.DVDPRWDL
or MediaType.DVDRDL
or MediaType.DVDPRDL
or MediaType.DVDRAM
or MediaType.DVDRWDL
or MediaType.DVDDownload
or MediaType.Nuon)
{
sector = new byte[2048];
_sectorId ??= new byte[_imageInfo.Sectors * 4];
Expand Down Expand Up @@ -2719,8 +2720,9 @@ public bool Close()

// Fill FLAC block
if(remaining != 0)
for(var r = 0; r < remaining * 4; r++)
_writingBuffer[_writingBufferPosition + r] = 0;
{
for(var r = 0; r < remaining * 4; r++) _writingBuffer[_writingBufferPosition + r] = 0;
}

compressedLength = FLAC.EncodeBuffer(_writingBuffer,
_compressedBuffer,
Expand Down

0 comments on commit c58d4a4

Please sign in to comment.