mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Refactor IMediaImage.ReadSector(s)Long to return error status instead of buffer.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
@@ -44,9 +45,9 @@ namespace Aaru.DiscImages
|
||||
if(!_rawCompactDisc)
|
||||
return null;
|
||||
|
||||
byte[] buffer = ReadSectorLong(sectorAddress);
|
||||
ErrorNumber errno = ReadSectorLong(sectorAddress, out byte[] buffer);
|
||||
|
||||
return CdChecksums.CheckCdSector(buffer);
|
||||
return errno != ErrorNumber.NoError ? null : CdChecksums.CheckCdSector(buffer);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -64,11 +65,15 @@ namespace Aaru.DiscImages
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] buffer = ReadSectorsLong(sectorAddress, length);
|
||||
int bps = (int)(buffer.Length / length);
|
||||
byte[] sector = new byte[bps];
|
||||
failingLbas = new List<ulong>();
|
||||
unknownLbas = new List<ulong>();
|
||||
ErrorNumber errno = ReadSectorsLong(sectorAddress, length, out byte[] buffer);
|
||||
|
||||
if(errno != ErrorNumber.NoError)
|
||||
return null;
|
||||
|
||||
int bps = (int)(buffer.Length / length);
|
||||
byte[] sector = new byte[bps];
|
||||
|
||||
for(int i = 0; i < length; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user