mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
Add a function to specify that a returned Result is unused
This commit is contained in:
parent
cd5d46c81b
commit
d1110392b4
@ -160,10 +160,10 @@ namespace LibHac.FsService
|
||||
// Check if permissions allow deleting save data
|
||||
}
|
||||
|
||||
reader.Indexer.SetState(saveDataId, SaveDataState.Creating);
|
||||
rc = reader.Indexer.SetState(saveDataId, SaveDataState.Creating);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
reader.Indexer.Commit();
|
||||
rc = reader.Indexer.Commit();
|
||||
if (rc.IsFailure()) return rc;
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ namespace LibHac.FsService
|
||||
// Revert changes if an error happened in the middle of creation
|
||||
if (isDeleteNeeded)
|
||||
{
|
||||
DeleteSaveDataFileSystemImpl2(creationInfo.SpaceId, saveDataId);
|
||||
DeleteSaveDataFileSystemImpl2(creationInfo.SpaceId, saveDataId).IgnoreResult();
|
||||
|
||||
if (reader.IsInitialized && saveDataId != FileSystemServer.SaveIndexerId)
|
||||
{
|
||||
@ -414,8 +414,8 @@ namespace LibHac.FsService
|
||||
|
||||
if (rc.IsSuccess() && value.SpaceId == creationInfo.SpaceId)
|
||||
{
|
||||
reader.Indexer.Delete(saveDataId);
|
||||
reader.Indexer.Commit();
|
||||
reader.Indexer.Delete(saveDataId).IgnoreResult();
|
||||
reader.Indexer.Commit().IgnoreResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1151,7 +1151,7 @@ namespace LibHac.FsService
|
||||
rc = FsServer.SaveDataIndexerManager.GetSaveDataIndexer(out reader, SaveDataSpaceId.Temporary);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
reader.Indexer.Reset();
|
||||
reader.Indexer.Reset().IgnoreResult();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -677,7 +677,8 @@ namespace LibHac.FsService
|
||||
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
baseFileSystem.EnsureDirectoryExists(contentDirPath.ToString());
|
||||
rc = baseFileSystem.EnsureDirectoryExists(contentDirPath.ToString());
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = FsCreators.SubDirectoryFileSystemCreator.Create(out IFileSystem subDirFileSystem,
|
||||
baseFileSystem, contentDirPath);
|
||||
@ -879,7 +880,7 @@ namespace LibHac.FsService
|
||||
|
||||
if (cacheExtraData)
|
||||
{
|
||||
// Missing extra data caching
|
||||
// todo: Missing extra data caching
|
||||
}
|
||||
|
||||
fileSystem = openReadOnly ? new ReadOnlyFileSystem(saveFs) : saveFs;
|
||||
|
@ -42,7 +42,7 @@ namespace LibHac.FsService
|
||||
|
||||
SaveDataIndexerManager = new SaveDataIndexerManager(FsClient, SaveIndexerId);
|
||||
|
||||
fsProxy.CleanUpTemporaryStorage();
|
||||
fsProxy.CleanUpTemporaryStorage().IgnoreResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -70,6 +70,11 @@ namespace LibHac
|
||||
public bool IsSuccess() => _value == SuccessValue;
|
||||
public bool IsFailure() => !IsSuccess();
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that the <see cref="Result"/> from a returned function is explicitly ignored.
|
||||
/// </summary>
|
||||
public void IgnoreResult() { }
|
||||
|
||||
public void ThrowIfFailure()
|
||||
{
|
||||
if (IsFailure())
|
||||
@ -212,6 +217,7 @@ namespace LibHac
|
||||
/// <c>new Result.Base(ModuleFs, 2000, 2499)</c>. The property will need to have the aggressive inlining flag set like so:
|
||||
/// <c>public static Result.Base SdCardAccessFailed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 2000, 2499); }</c>
|
||||
/// </remarks>
|
||||
[DebuggerDisplay("{" + nameof(ToStringWithName) + "(),nq}")]
|
||||
public struct Base
|
||||
{
|
||||
private const int DescriptionEndBitsOffset = ReservedBitsOffset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user