mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Refactor IMediaImage.ReadSector(s) to return error status instead of buffer.
This commit is contained in:
@@ -35,6 +35,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Helpers;
|
||||
using Schemas;
|
||||
@@ -63,7 +64,7 @@ namespace Aaru.Filesystems
|
||||
/// <inheritdoc />
|
||||
public string Name => "F2FS Plugin";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
public Guid Id => new("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
@@ -87,7 +88,10 @@ namespace Aaru.Filesystems
|
||||
if(partition.Start + sbAddr + sbSize >= partition.End)
|
||||
return false;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||
ErrorNumber errno = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError)
|
||||
return false;
|
||||
|
||||
if(sector.Length < Marshal.SizeOf<Superblock>())
|
||||
return false;
|
||||
@@ -118,7 +122,10 @@ namespace Aaru.Filesystems
|
||||
if(Marshal.SizeOf<Superblock>() % imagePlugin.Info.SectorSize != 0)
|
||||
sbSize++;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||
ErrorNumber errno = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError)
|
||||
return;
|
||||
|
||||
if(sector.Length < Marshal.SizeOf<Superblock>())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user