Enable CA1806 and fix noncompliance (except in Cores)
return value implicitly discarded
This commit is contained in:
parent
d8ce0e6177
commit
33a487452d
|
@ -209,7 +209,7 @@
|
|||
<Rule Id="CA1805" Action="Hidden" />
|
||||
|
||||
<!-- Do not ignore method results -->
|
||||
<Rule Id="CA1806" Action="Hidden" />
|
||||
<Rule Id="CA1806" Action="Error" />
|
||||
|
||||
<!-- Initialize reference type static fields inline -->
|
||||
<Rule Id="CA1810" Action="Hidden" />
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace BizHawk.BizInvoke
|
|||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
munmap(Z.US(Start), Z.UU(_size));
|
||||
_ = munmap(Z.US(Start), Z.UU(_size));
|
||||
_disposed = true;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else if (argDowncased.StartsWith("--dump-length="))
|
||||
{
|
||||
int.TryParse(argDowncased.Substring(argDowncased.IndexOf('=') + 1), out var len);
|
||||
var len = int.TryParse(argDowncased.Substring(argDowncased.IndexOf('=') + 1), out var i1) ? i1 : default;
|
||||
autoDumpLength = len;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--dump-close"))
|
||||
|
@ -125,7 +125,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else if (argDowncased.StartsWith("--socket_port="))
|
||||
{
|
||||
int.TryParse(argDowncased.Substring(argDowncased.IndexOf('=') + 1), out var port);
|
||||
var port = int.TryParse(argDowncased.Substring(argDowncased.IndexOf('=') + 1), out var i1) ? i1 : default;
|
||||
if (port > 0) socketPort = port;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--socket_ip="))
|
||||
|
|
|
@ -40,8 +40,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else if (line.StartsWith("rerecordCount"))
|
||||
{
|
||||
int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount);
|
||||
Result.Movie.Rerecords = (ulong)rerecordCount;
|
||||
Result.Movie.Rerecords = (ulong) (int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount) ? rerecordCount : default);
|
||||
}
|
||||
else if (line.StartsWith("firmNickname"))
|
||||
{
|
||||
|
|
|
@ -97,8 +97,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else if (line.ToLower().StartsWith("rerecordcount"))
|
||||
{
|
||||
int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount);
|
||||
Result.Movie.Rerecords = (ulong)rerecordCount;
|
||||
Result.Movie.Rerecords = (ulong) (int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount) ? rerecordCount : default);
|
||||
}
|
||||
else if (line.ToLower().StartsWith("guid"))
|
||||
{
|
||||
|
|
|
@ -26,26 +26,13 @@ namespace BizHawk.Client.Common
|
|||
/// <returns>0 for equality, 1 if x comes first; -1 if y comes first</returns>
|
||||
public int Compare(Watch x, Watch y)
|
||||
{
|
||||
int xValue;
|
||||
int yValue;
|
||||
var xValue = x.Type is not WatchDisplayType.Signed
|
||||
? x.Value
|
||||
: int.TryParse(x.ValueString, out var i) ? i : default;
|
||||
|
||||
if (x.Type == WatchDisplayType.Signed)
|
||||
{
|
||||
int.TryParse(x.ValueString, out xValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
xValue = x.Value;
|
||||
}
|
||||
|
||||
if (y.Type == WatchDisplayType.Signed)
|
||||
{
|
||||
int.TryParse(y.ValueString, out yValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
yValue = y.Value;
|
||||
}
|
||||
var yValue = y.Type is not WatchDisplayType.Signed
|
||||
? y.Value
|
||||
: int.TryParse(y.ValueString, out var i1) ? i1 : default;
|
||||
|
||||
if (Equals(x, y))
|
||||
{
|
||||
|
|
|
@ -808,19 +808,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
CloseStreams();
|
||||
if (_pAviRawAudioStream != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIStreamRelease(_pAviRawAudioStream);
|
||||
_ = AVIWriterImports.AVIStreamRelease(_pAviRawAudioStream);
|
||||
_pAviRawAudioStream = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (_pAviRawVideoStream != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIStreamRelease(_pAviRawVideoStream);
|
||||
_ = AVIWriterImports.AVIStreamRelease(_pAviRawVideoStream);
|
||||
_pAviRawVideoStream = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (_pAviFile != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIFileRelease(_pAviFile);
|
||||
_ = AVIWriterImports.AVIFileRelease(_pAviFile);
|
||||
_pAviFile = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
@ -844,7 +844,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (_pAviCompressedVideoStream != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIStreamRelease(_pAviCompressedVideoStream);
|
||||
_ = AVIWriterImports.AVIStreamRelease(_pAviCompressedVideoStream);
|
||||
_pAviCompressedVideoStream = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// (TODO - inefficient- build directly in a buffer)
|
||||
AVIWriterImports.AVIStreamWrite(_pAviRawAudioStream, _outStatus.audio_samples, todo_realsamples, buf, todo_realsamples * 4, 0, IntPtr.Zero, out var bytes_written);
|
||||
_ = AVIWriterImports.AVIStreamWrite(_pAviRawAudioStream, _outStatus.audio_samples, todo_realsamples, buf, todo_realsamples * 4, 0, IntPtr.Zero, out var bytes_written);
|
||||
_outStatus.audio_samples += todo_realsamples;
|
||||
_outStatus.audio_bytes += bytes_written;
|
||||
_outStatus.audio_buffered_shorts = 0;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var hWndOwner = owner?.Handle ?? Win32Imports.GetActiveWindow();
|
||||
Win32Imports.SHGetSpecialFolderLocation(hWndOwner, startLocation, out var pidlRoot);
|
||||
_ = Win32Imports.SHGetSpecialFolderLocation(hWndOwner, startLocation, out var pidlRoot);
|
||||
if (pidlRoot == IntPtr.Zero) return DialogResult.Cancel;
|
||||
var mergedOptions = publicOptions | privateOptions;
|
||||
if ((mergedOptions & Win32Imports.BROWSEINFO.FLAGS.NewDialogStyle) != 0 && ApartmentState.MTA == Application.OleRequired())
|
||||
|
@ -75,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
finally
|
||||
{
|
||||
Win32Imports.SHGetMalloc(out var malloc);
|
||||
_ = Win32Imports.SHGetMalloc(out var malloc);
|
||||
malloc.Free(pidlRoot);
|
||||
if (pidlRet != IntPtr.Zero) malloc.Free(pidlRet);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
// this will look in subdirectory "dll" to load pinvoked stuff
|
||||
var dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
|
||||
SetDllDirectory(dllDir);
|
||||
_ = SetDllDirectory(dllDir);
|
||||
|
||||
//in case assembly resolution fails, such as if we moved them into the dll subdiretory, this event handler can reroute to them
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
|
@ -226,7 +226,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//note: this is pasted instead of being put in a static method due to this initialization code being sensitive to things like that, and not wanting to cause it to break
|
||||
//pasting should be safe (not affecting the jit order of things)
|
||||
var dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
|
||||
SetDllDirectory(dllDir);
|
||||
_ = SetDllDirectory(dllDir);
|
||||
}
|
||||
|
||||
Util.DebugWriteLine(EmuHawkUtil.CLRHostHasElevatedPrivileges ? "running as Superuser/Administrator" : "running as unprivileged user");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<Import Project="../MainSlnCommon.props" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NoWarn>$(NoWarn);CA2214;SA1100;SA1120;SA1137;SA1205;SA1208;SA1400</NoWarn>
|
||||
<NoWarn>$(NoWarn);CA1806;CA2214;SA1100;SA1120;SA1137;SA1205;SA1208;SA1400</NoWarn>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
{
|
||||
//read directly into the target buffer
|
||||
fixed(byte* pBuffer = &buffer[0])
|
||||
mednadisc_ReadSector(handle, LBA, pBuffer + offset);
|
||||
_ = mednadisc_ReadSector(handle, LBA, pBuffer + offset);
|
||||
}
|
||||
|
||||
#if false
|
||||
|
|
Loading…
Reference in New Issue