Enable SA1129 and fix noncompliance (except in Cores)

calling implicit default struct ctor
This commit is contained in:
YoshiRulz 2022-03-08 11:52:07 +10:00
parent 8c4ceccab9
commit c1a7556d7f
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
15 changed files with 23 additions and 17 deletions

View File

@ -414,7 +414,7 @@
<Rule Id="SA1128" Action="Hidden" />
<!-- Do not use default value type constructor -->
<Rule Id="SA1129" Action="Hidden" />
<Rule Id="SA1129" Action="Error" />
<!-- Use readable conditions -->
<Rule Id="SA1131" Action="Hidden" />

View File

@ -269,7 +269,7 @@ namespace BizHawk.BizInvoke
var il = method.GetILGenerator();
Label exc = new Label();
Label exc = default;
if (monitorField != null) // monitor: enter and then begin try
{
il.Emit(OpCodes.Ldarg_0);
@ -376,7 +376,7 @@ namespace BizHawk.BizInvoke
var il = method.GetILGenerator();
Label exc = new Label();
Label exc = default;
if (monitorField != null) // monitor: enter and then begin try
{
il.Emit(OpCodes.Ldarg_0);

View File

@ -165,7 +165,7 @@ namespace BizHawk.Bizware.BizwareGL
var pFlIn = (float*) pMatIn;
for (var i = 0; i < 16; i++) pDbTemp[i] = pFlIn[i];
}
Matrix4 result = new();
Matrix4 result = default;
ref var refResult = ref result;
fixed (Matrix4* pMatOut = &refResult)
{

View File

@ -140,7 +140,7 @@ namespace BizHawk.Bizware.DirectX
if (XInputGetStateExProc != null)
{
_state = new XINPUT_STATE();
_state = default;
XInputGetStateExProc(_index0, out _state);
}
else

View File

@ -1,4 +1,5 @@
#if AVI_SUPPORT
#pragma warning disable SA1129
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@ -4832,6 +4832,6 @@ namespace BizHawk.Client.EmuHawk
LoadRom(args[0]);
}
public IQuickBmpFile QuickBmpFile { get; } = new QuickBmpFile();
public IQuickBmpFile QuickBmpFile { get; } = EmuHawk.QuickBmpFile.INSTANCE;
}
}

View File

@ -332,6 +332,8 @@ namespace BizHawk.Client.EmuHawk
s.Write(dst, 0, dst.Length);
}
public static readonly QuickBmpFile INSTANCE = default;
readonly void IQuickBmpFile.Copy(IVideoProvider src, IVideoProvider dst) => Copy(src, dst);
readonly bool IQuickBmpFile.Load(IVideoProvider v, Stream s) => Load(v, s);

View File

@ -178,7 +178,7 @@ namespace BizHawk.Client.EmuHawk
{
if (frame >= 0)
{
PendingChanges newChange = new PendingChanges();
PendingChanges newChange = default;
if (frame < Tastudio.CurrentTasMovie.InputLogLength)
{
@ -215,7 +215,7 @@ namespace BizHawk.Client.EmuHawk
{
if (frame >= 0)
{
PendingChanges newChange = new PendingChanges();
PendingChanges newChange = default;
if (frame < Tastudio.CurrentTasMovie.InputLogLength)
{

View File

@ -166,9 +166,12 @@ namespace BizHawk.Client.EmuHawk
var rec = _log[index];
PulseState pulse = new PulseState();
if (track == 0) pulse = rec.Pulse0;
if (track == 1) pulse = rec.Pulse1;
var pulse = track switch
{
0 => rec.Pulse0,
1 => rec.Pulse1,
_ => default
};
// transform quieted notes to dead notes
// blech its buggy, im tired

View File

@ -5,7 +5,7 @@
<Import Project="../MainSlnCommon.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);CA1806;CA1825;CA2214;SA1100;SA1120;SA1137;SA1205;SA1208;SA1400</NoWarn>
<NoWarn>$(NoWarn);CA1806;CA1825;CA2214;SA1100;SA1120;SA1129;SA1137;SA1205;SA1208;SA1400</NoWarn>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>

View File

@ -120,7 +120,7 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// Parameters set during disc loading which can be referenced by the sector synthesizers
/// </summary>
internal SectorSynthParams SynthParams = new SectorSynthParams();
internal SectorSynthParams SynthParams = default;
/// <summary>
/// Forbid public construction

View File

@ -160,7 +160,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
private void EmitRawTOCEntry(CompiledCueTrack cct)
{
SubchannelQ toc_sq = new SubchannelQ();
SubchannelQ toc_sq = default;
//absent some kind of policy for how to set it, this is a safe assumption:
byte toc_ADR = 1;
toc_sq.SetStatus(toc_ADR, (EControlQ)(int)cct.Flags);

View File

@ -42,7 +42,7 @@ namespace BizHawk.Emulation.DiscSystem
//NOTE: entries are inserted at the beginning due to observations of CCD indicating they might need to be that way
//Since I'm being asked to synthesize them here, I guess I can put them in whatever order I want, can't I?
SubchannelQ sq = new SubchannelQ();
SubchannelQ sq = default;
//ADR (q-Mode) is necessarily 0x01 for a RawTOCEntry
const int kADR = 1;

View File

@ -37,7 +37,7 @@ namespace BizHawk.Emulation.DiscSystem
{
//var se = new SectorEntry(sz);
//Disc.Sectors.Add(se);
SubchannelQ sq = new SubchannelQ();
SubchannelQ sq = default;
int track_relative_msf = i;
sq.min = BCD2.FromDecimal(new Timestamp(track_relative_msf).MIN);

View File

@ -239,7 +239,7 @@ namespace BizHawk.Emulation.DiscSystem
// else if(toc.disc_type == DISC_TYPE_CD_I) control |= 0x4;
control |= (EControlQ)(((int)ses.LastInformationTrack.Control) & 4);
SubchannelQ sq = new SubchannelQ();
SubchannelQ sq = default;
sq.SetStatus(ADR, control);
sq.q_tno.BCDValue = 0xAA;
sq.q_index.BCDValue = 0x01;