Fix or suppress some ReSharper warnings

This commit is contained in:
Alex Barney 2021-12-18 23:45:06 -07:00
parent 0846b86249
commit ae35a1b916
6 changed files with 7 additions and 4 deletions

View file

@ -414,6 +414,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
return Result.Success; return Result.Success;
} }
// ReSharper disable once OutParameterValueIsAlwaysDiscarded.Local
private Result OpenDataFileSystemCore(ref SharedRef<IFileSystem> outFileSystem, out bool isHostFs, private Result OpenDataFileSystemCore(ref SharedRef<IFileSystem> outFileSystem, out bool isHostFs,
ulong programId, StorageId storageId) ulong programId, StorageId storageId)
{ {
@ -594,4 +595,4 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
{ {
return OpenDataStorageCore(ref outStorage, out ncaHeaderDigest, id, storageId); return OpenDataStorageCore(ref outStorage, out ncaHeaderDigest, id, storageId);
} }
} }

View file

@ -630,6 +630,7 @@ public class NcaFileSystemServiceImpl
{ {
ulong ncaProgramId = ncaTemp.Header.TitleId; ulong ncaProgramId = ncaTemp.Header.TitleId;
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (ncaProgramId != ulong.MaxValue && ncaId != ncaProgramId) if (ncaProgramId != ulong.MaxValue && ncaId != ncaProgramId)
{ {
return ResultFs.InvalidNcaId.Log(); return ResultFs.InvalidNcaId.Log();

View file

@ -212,7 +212,7 @@ public static class HierarchicalIntegrityVerificationStorageExtensions
break; break;
} }
if (block == Validity.Unchecked && levelValidity != Validity.Invalid) if (block == Validity.Unchecked)
{ {
levelValidity = Validity.Unchecked; levelValidity = Validity.Unchecked;
} }

View file

@ -11,7 +11,7 @@ public struct NcaSparseInfo
public Array16<byte> MetaHeader; public Array16<byte> MetaHeader;
public long PhysicalOffset; public long PhysicalOffset;
public ushort Generation; public ushort Generation;
private Array6<byte> _reserved; public Array6<byte> Reserved;
public readonly uint GetGeneration() => (uint)(Generation << 16); public readonly uint GetGeneration() => (uint)(Generation << 16);
public readonly long GetPhysicalSize() => MetaOffset + MetaSize; public readonly long GetPhysicalSize() => MetaOffset + MetaSize;

View file

@ -85,7 +85,7 @@ public class AesXtsDirectory : IDirectory
if (bytesRead != sizeof(uint) || magic != AesXtsFileHeader.AesXtsFileMagic) return 0; if (bytesRead != sizeof(uint) || magic != AesXtsFileHeader.AesXtsFileMagic) return 0;
file.Get.Read(out bytesRead, fileSizeOffset, SpanHelpers.AsByteSpan(ref fileSize), ReadOption.None); file.Get.Read(out bytesRead, fileSizeOffset, SpanHelpers.AsByteSpan(ref fileSize), ReadOption.None);
if (bytesRead != sizeof(long) || magic != AesXtsFileHeader.AesXtsFileMagic) return 0; if (bytesRead != sizeof(long)) return 0;
return fileSize; return fileSize;
} }

View file

@ -195,6 +195,7 @@ public class Nca
long nodeOffset = 0; long nodeOffset = 0;
long nodeSize = IndirectStorage.QueryNodeStorageSize(header.EntryCount); long nodeSize = IndirectStorage.QueryNodeStorageSize(header.EntryCount);
// ReSharper disable once UselessBinaryOperation
long entryOffset = nodeOffset + nodeSize; long entryOffset = nodeOffset + nodeSize;
long entrySize = IndirectStorage.QueryEntryStorageSize(header.EntryCount); long entrySize = IndirectStorage.QueryEntryStorageSize(header.EntryCount);