General code style and feature fixes.

This commit is contained in:
2022-11-15 01:35:06 +00:00
parent 47965f0584
commit bd3fe7bd4e
94 changed files with 460 additions and 478 deletions

View File

@@ -213,8 +213,8 @@ public sealed partial class AaruFormat
static (byte minute, byte second, byte frame) LbaToMsf(long pos) =>
((byte)((pos + 150) / 75 / 60), (byte)((pos + 150) / 75 % 60), (byte)((pos + 150) % 75));
void ReconstructPrefix(ref byte[] sector, // must point to a full 2352-byte sector
TrackType type, long lba)
static void ReconstructPrefix(ref byte[] sector, // must point to a full 2352-byte sector
TrackType type, long lba)
{
//
// Sync

View File

@@ -2225,25 +2225,23 @@ public sealed partial class AaruFormat
return ErrorNumber.NoError;
}
if(_sectorPrefixDdt != null &&
_sectorSuffixDdt != null)
if(_sectorPrefixDdt == null ||
_sectorSuffixDdt == null)
return ReadSectors(sectorAddress, length, out buffer);
buffer = new byte[2352 * length];
for(uint i = 0; i < length; i++)
{
buffer = new byte[2352 * length];
errno = ReadSectorLong(sectorAddress + i, out byte[] temp);
for(uint i = 0; i < length; i++)
{
errno = ReadSectorLong(sectorAddress + i, out byte[] temp);
if(errno != ErrorNumber.NoError)
return errno;
if(errno != ErrorNumber.NoError)
return errno;
Array.Copy(temp, 0, buffer, 2352 * i, 2352);
}
return ErrorNumber.NoError;
Array.Copy(temp, 0, buffer, 2352 * i, 2352);
}
return ReadSectors(sectorAddress, length, out buffer);
return ErrorNumber.NoError;
// Join prefix (sync, header) with user data
case TrackType.CdMode2Formless:
@@ -2268,25 +2266,24 @@ public sealed partial class AaruFormat
return ErrorNumber.NoError;
}
if(_sectorPrefixDdt != null &&
_sectorSuffixDdt != null)
if(_sectorPrefixDdt == null ||
_sectorSuffixDdt == null)
return ReadSectors(sectorAddress, length, out buffer);
buffer = new byte[2352 * length];
for(uint i = 0; i < length; i++)
{
buffer = new byte[2352 * length];
errno = ReadSectorLong(sectorAddress + i, out byte[] temp);
for(uint i = 0; i < length; i++)
{
errno = ReadSectorLong(sectorAddress + i, out byte[] temp);
if(errno != ErrorNumber.NoError)
return errno;
if(errno != ErrorNumber.NoError)
return errno;
Array.Copy(temp, 0, buffer, 2352 * i, 2352);
}
return ErrorNumber.NoError;
Array.Copy(temp, 0, buffer, 2352 * i, 2352);
}
return ReadSectors(sectorAddress, length, out buffer);
return ErrorNumber.NoError;
}
break;