From ae35a1b9169be35cbed2872c63d685643a81fcb9 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sat, 18 Dec 2021 23:45:06 -0700 Subject: [PATCH] Fix or suppress some ReSharper warnings --- src/LibHac/FsSrv/NcaFileSystemService.cs | 3 ++- src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs | 1 + .../FsSystem/HierarchicalIntegrityVerificationStorage.cs | 2 +- src/LibHac/FsSystem/NcaStructs.cs | 2 +- src/LibHac/Tools/FsSystem/AesXtsDirectory.cs | 2 +- src/LibHac/Tools/FsSystem/NcaUtils/Nca.cs | 1 + 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/LibHac/FsSrv/NcaFileSystemService.cs b/src/LibHac/FsSrv/NcaFileSystemService.cs index fd765879..d067160e 100644 --- a/src/LibHac/FsSrv/NcaFileSystemService.cs +++ b/src/LibHac/FsSrv/NcaFileSystemService.cs @@ -414,6 +414,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager return Result.Success; } + // ReSharper disable once OutParameterValueIsAlwaysDiscarded.Local private Result OpenDataFileSystemCore(ref SharedRef outFileSystem, out bool isHostFs, ulong programId, StorageId storageId) { @@ -594,4 +595,4 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager { return OpenDataStorageCore(ref outStorage, out ncaHeaderDigest, id, storageId); } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs b/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs index 9df95997..cc19675a 100644 --- a/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs +++ b/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs @@ -630,6 +630,7 @@ public class NcaFileSystemServiceImpl { ulong ncaProgramId = ncaTemp.Header.TitleId; + // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (ncaProgramId != ulong.MaxValue && ncaId != ncaProgramId) { return ResultFs.InvalidNcaId.Log(); diff --git a/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs b/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs index 36e80b29..69d7f091 100644 --- a/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs +++ b/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs @@ -212,7 +212,7 @@ public static class HierarchicalIntegrityVerificationStorageExtensions break; } - if (block == Validity.Unchecked && levelValidity != Validity.Invalid) + if (block == Validity.Unchecked) { levelValidity = Validity.Unchecked; } diff --git a/src/LibHac/FsSystem/NcaStructs.cs b/src/LibHac/FsSystem/NcaStructs.cs index 87c1e949..8c8efe3b 100644 --- a/src/LibHac/FsSystem/NcaStructs.cs +++ b/src/LibHac/FsSystem/NcaStructs.cs @@ -11,7 +11,7 @@ public struct NcaSparseInfo public Array16 MetaHeader; public long PhysicalOffset; public ushort Generation; - private Array6 _reserved; + public Array6 Reserved; public readonly uint GetGeneration() => (uint)(Generation << 16); public readonly long GetPhysicalSize() => MetaOffset + MetaSize; diff --git a/src/LibHac/Tools/FsSystem/AesXtsDirectory.cs b/src/LibHac/Tools/FsSystem/AesXtsDirectory.cs index fa0d3b27..8547924f 100644 --- a/src/LibHac/Tools/FsSystem/AesXtsDirectory.cs +++ b/src/LibHac/Tools/FsSystem/AesXtsDirectory.cs @@ -85,7 +85,7 @@ public class AesXtsDirectory : IDirectory if (bytesRead != sizeof(uint) || magic != AesXtsFileHeader.AesXtsFileMagic) return 0; 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; } diff --git a/src/LibHac/Tools/FsSystem/NcaUtils/Nca.cs b/src/LibHac/Tools/FsSystem/NcaUtils/Nca.cs index 3b7812a3..0f1dc916 100644 --- a/src/LibHac/Tools/FsSystem/NcaUtils/Nca.cs +++ b/src/LibHac/Tools/FsSystem/NcaUtils/Nca.cs @@ -195,6 +195,7 @@ public class Nca long nodeOffset = 0; long nodeSize = IndirectStorage.QueryNodeStorageSize(header.EntryCount); + // ReSharper disable once UselessBinaryOperation long entryOffset = nodeOffset + nodeSize; long entrySize = IndirectStorage.QueryEntryStorageSize(header.EntryCount);