From 7c2f07d12458ce6d2ee9c98f78d56ec8b20762bb Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:40:37 +0200 Subject: [PATCH] [Ryujinx.Horizon.Common] Address dotnet-format issues (#5382) * dotnet format style --severity info Some changes were manually reverted. * Address most dotnet format whitespace warnings * Address IDE0251 warnings * dotnet format whitespace after rebase --- src/Ryujinx.Horizon.Common/KernelResult.cs | 62 +++++++++++----------- src/Ryujinx.Horizon.Common/OnScopeExit.cs | 2 +- src/Ryujinx.Horizon.Common/Result.cs | 22 ++++---- src/Ryujinx.Horizon.Common/ResultNames.cs | 2 +- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/Ryujinx.Horizon.Common/KernelResult.cs b/src/Ryujinx.Horizon.Common/KernelResult.cs index 51fec205..ff367ac4 100644 --- a/src/Ryujinx.Horizon.Common/KernelResult.cs +++ b/src/Ryujinx.Horizon.Common/KernelResult.cs @@ -4,36 +4,36 @@ { private const int ModuleId = 1; - public static Result SessionCountExceeded => new Result(ModuleId, 7); - public static Result InvalidCapability => new Result(ModuleId, 14); - public static Result ThreadNotStarted => new Result(ModuleId, 57); - public static Result ThreadTerminating => new Result(ModuleId, 59); - public static Result InvalidSize => new Result(ModuleId, 101); - public static Result InvalidAddress => new Result(ModuleId, 102); - public static Result OutOfResource => new Result(ModuleId, 103); - public static Result OutOfMemory => new Result(ModuleId, 104); - public static Result HandleTableFull => new Result(ModuleId, 105); - public static Result InvalidMemState => new Result(ModuleId, 106); - public static Result InvalidPermission => new Result(ModuleId, 108); - public static Result InvalidMemRange => new Result(ModuleId, 110); - public static Result InvalidPriority => new Result(ModuleId, 112); - public static Result InvalidCpuCore => new Result(ModuleId, 113); - public static Result InvalidHandle => new Result(ModuleId, 114); - public static Result UserCopyFailed => new Result(ModuleId, 115); - public static Result InvalidCombination => new Result(ModuleId, 116); - public static Result TimedOut => new Result(ModuleId, 117); - public static Result Cancelled => new Result(ModuleId, 118); - public static Result MaximumExceeded => new Result(ModuleId, 119); - public static Result InvalidEnumValue => new Result(ModuleId, 120); - public static Result NotFound => new Result(ModuleId, 121); - public static Result InvalidThread => new Result(ModuleId, 122); - public static Result PortRemoteClosed => new Result(ModuleId, 123); - public static Result InvalidState => new Result(ModuleId, 125); - public static Result ReservedValue => new Result(ModuleId, 126); - public static Result PortClosed => new Result(ModuleId, 131); - public static Result ResLimitExceeded => new Result(ModuleId, 132); - public static Result ReceiveListBroken => new Result(ModuleId, 258); - public static Result OutOfVaSpace => new Result(ModuleId, 259); - public static Result CmdBufferTooSmall => new Result(ModuleId, 260); + public static Result SessionCountExceeded => new(ModuleId, 7); + public static Result InvalidCapability => new(ModuleId, 14); + public static Result ThreadNotStarted => new(ModuleId, 57); + public static Result ThreadTerminating => new(ModuleId, 59); + public static Result InvalidSize => new(ModuleId, 101); + public static Result InvalidAddress => new(ModuleId, 102); + public static Result OutOfResource => new(ModuleId, 103); + public static Result OutOfMemory => new(ModuleId, 104); + public static Result HandleTableFull => new(ModuleId, 105); + public static Result InvalidMemState => new(ModuleId, 106); + public static Result InvalidPermission => new(ModuleId, 108); + public static Result InvalidMemRange => new(ModuleId, 110); + public static Result InvalidPriority => new(ModuleId, 112); + public static Result InvalidCpuCore => new(ModuleId, 113); + public static Result InvalidHandle => new(ModuleId, 114); + public static Result UserCopyFailed => new(ModuleId, 115); + public static Result InvalidCombination => new(ModuleId, 116); + public static Result TimedOut => new(ModuleId, 117); + public static Result Cancelled => new(ModuleId, 118); + public static Result MaximumExceeded => new(ModuleId, 119); + public static Result InvalidEnumValue => new(ModuleId, 120); + public static Result NotFound => new(ModuleId, 121); + public static Result InvalidThread => new(ModuleId, 122); + public static Result PortRemoteClosed => new(ModuleId, 123); + public static Result InvalidState => new(ModuleId, 125); + public static Result ReservedValue => new(ModuleId, 126); + public static Result PortClosed => new(ModuleId, 131); + public static Result ResLimitExceeded => new(ModuleId, 132); + public static Result ReceiveListBroken => new(ModuleId, 258); + public static Result OutOfVaSpace => new(ModuleId, 259); + public static Result CmdBufferTooSmall => new(ModuleId, 260); } } diff --git a/src/Ryujinx.Horizon.Common/OnScopeExit.cs b/src/Ryujinx.Horizon.Common/OnScopeExit.cs index 2b81e492..deba7bba 100644 --- a/src/Ryujinx.Horizon.Common/OnScopeExit.cs +++ b/src/Ryujinx.Horizon.Common/OnScopeExit.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Horizon.Common { - public struct OnScopeExit : IDisposable + public readonly struct OnScopeExit : IDisposable { private readonly Action _action; diff --git a/src/Ryujinx.Horizon.Common/Result.cs b/src/Ryujinx.Horizon.Common/Result.cs index 28056310..8e458475 100644 --- a/src/Ryujinx.Horizon.Common/Result.cs +++ b/src/Ryujinx.Horizon.Common/Result.cs @@ -13,13 +13,13 @@ namespace Ryujinx.Horizon.Common public int ErrorCode { get; } - public bool IsSuccess => ErrorCode == 0; - public bool IsFailure => ErrorCode != 0; + public readonly bool IsSuccess => ErrorCode == 0; + public readonly bool IsFailure => ErrorCode != 0; - public int Module => ErrorCode & (ModuleMax - 1); - public int Description => (ErrorCode >> ModuleBits) & (DescriptionMax - 1); + public readonly int Module => ErrorCode & (ModuleMax - 1); + public readonly int Description => (ErrorCode >> ModuleBits) & (DescriptionMax - 1); - public string PrintableResult => $"{2000 + Module:D4}-{Description:D4}"; + public readonly string PrintableResult => $"{2000 + Module:D4}-{Description:D4}"; public Result(int module, int description) { @@ -36,17 +36,17 @@ namespace Ryujinx.Horizon.Common ErrorCode = module | (description << ModuleBits); } - public override bool Equals(object obj) + public readonly override bool Equals(object obj) { return obj is Result result && result.Equals(this); } - public bool Equals(Result other) + public readonly bool Equals(Result other) { return other.ErrorCode == ErrorCode; } - public override int GetHashCode() + public readonly override int GetHashCode() { return ErrorCode; } @@ -61,7 +61,7 @@ namespace Ryujinx.Horizon.Common return !lhs.Equals(rhs); } - public bool InRange(int minInclusive, int maxInclusive) + public readonly bool InRange(int minInclusive, int maxInclusive) { return (uint)(Description - minInclusive) <= (uint)(maxInclusive - minInclusive); } @@ -105,7 +105,7 @@ namespace Ryujinx.Horizon.Common throw new InvalidResultException(this); } - public override string ToString() + public readonly override string ToString() { if (ResultNames.TryGet(ErrorCode, out string name)) { @@ -115,4 +115,4 @@ namespace Ryujinx.Horizon.Common return PrintableResult; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Horizon.Common/ResultNames.cs b/src/Ryujinx.Horizon.Common/ResultNames.cs index 8f8173ed..84058cf2 100644 --- a/src/Ryujinx.Horizon.Common/ResultNames.cs +++ b/src/Ryujinx.Horizon.Common/ResultNames.cs @@ -1698,4 +1698,4 @@ namespace Ryujinx.Horizon.Common return _names.TryGetValue(errorCode, out name); } } -} \ No newline at end of file +}