Remove unsafe keyword where unused or extraneous
This commit is contained in:
parent
4d47861296
commit
3db06c4aa9
|
@ -37,7 +37,7 @@ namespace BizHawk.BizInvoke
|
|||
/// Didn't I have code somewhere else to do this already?
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static unsafe int ComputeClassFieldOffset()
|
||||
public static int ComputeClassFieldOffset()
|
||||
{
|
||||
var c = new CF();
|
||||
int ret;
|
||||
|
@ -48,7 +48,7 @@ namespace BizHawk.BizInvoke
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
public static unsafe int ComputeStringOffset()
|
||||
public static int ComputeStringOffset()
|
||||
{
|
||||
var s = new string(new char[0]);
|
||||
int ret;
|
||||
|
|
|
@ -5,7 +5,7 @@ using static BizHawk.BizInvoke.POSIXLibC;
|
|||
|
||||
namespace BizHawk.BizInvoke
|
||||
{
|
||||
internal sealed unsafe class MemoryBlockLinuxPal : IMemoryBlockPal
|
||||
internal sealed class MemoryBlockLinuxPal : IMemoryBlockPal
|
||||
{
|
||||
public ulong Start { get; }
|
||||
private readonly ulong _size;
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// If the close operation is forever, then internal backup copies of resources will be freed, but it can never be reopened.
|
||||
/// This function may take some time to run, as it is
|
||||
/// </summary>
|
||||
public unsafe void Close(bool forever = true)
|
||||
public void Close(bool forever = true)
|
||||
{
|
||||
AssertIsOpen(true);
|
||||
IsOpened = false;
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
UnlockBits(CurrLock);
|
||||
}
|
||||
|
||||
public unsafe void YFlip()
|
||||
public void YFlip()
|
||||
{
|
||||
//TODO - could be faster
|
||||
var bmpdata = LockBits();
|
||||
|
@ -107,7 +107,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// <summary>
|
||||
/// Makes sure the alpha channel is clean and optionally y-flips
|
||||
/// </summary>
|
||||
public unsafe void Normalize(bool yflip)
|
||||
public void Normalize(bool yflip)
|
||||
{
|
||||
var bmpdata = LockBits();
|
||||
int[] newPixels = new int[Width * Height];
|
||||
|
@ -380,7 +380,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// <summary>
|
||||
/// Loads the BitmapBuffer from a source buffer, which is expected to be the right pixel format
|
||||
/// </summary>
|
||||
public unsafe void LoadFrom(int width, int stride, int height, byte* data, BitmapLoadOptions options)
|
||||
public void LoadFrom(int width, int stride, int height, byte* data, BitmapLoadOptions options)
|
||||
{
|
||||
bool cleanup = options.CleanupAlpha0;
|
||||
Width = width;
|
||||
|
@ -447,7 +447,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// <summary>
|
||||
/// clears this instance to (0,0,0,0) -- without allocating a new array (to avoid GC churn)
|
||||
/// </summary>
|
||||
public unsafe void ClearWithoutAlloc()
|
||||
public void ClearWithoutAlloc()
|
||||
{
|
||||
//http://techmikael.blogspot.com/2009/12/filling-array-with-default-value.html
|
||||
//this guy says its faster
|
||||
|
@ -498,7 +498,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// <summary>
|
||||
/// Dumps this BitmapBuffer to a new System.Drawing.Bitmap
|
||||
/// </summary>
|
||||
public unsafe Bitmap ToSysdrawingBitmap()
|
||||
public Bitmap ToSysdrawingBitmap()
|
||||
{
|
||||
if (WrappedBitmap != null)
|
||||
return (Bitmap)WrappedBitmap.Clone();
|
||||
|
@ -514,7 +514,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// Dumps this BitmapBuffer to an existing System.Drawing.Bitmap.
|
||||
/// Some features of this may not be super fast (in particular, 32bpp to 24bpp conversion; we might fix that later with a customized loop)
|
||||
/// </summary>
|
||||
public unsafe void ToSysdrawingBitmap(Bitmap bmp)
|
||||
public void ToSysdrawingBitmap(Bitmap bmp)
|
||||
{
|
||||
if (WrappedBitmap != null)
|
||||
{
|
||||
|
|
|
@ -228,17 +228,17 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
g.Transform = new sd.Drawing2D.Matrix(mat.Row0.X, mat.Row0.Y, mat.Row1.X, mat.Row1.Y, mat.Row3.X, mat.Row3.Y);
|
||||
}
|
||||
|
||||
private unsafe void DrawInternal(Art art, float x, float y, float w, float h)
|
||||
private void DrawInternal(Art art, float x, float y, float w, float h)
|
||||
{
|
||||
DrawInternal(art.BaseTexture, x, y, w, h, art.u0, art.v0, art.u1, art.v1);
|
||||
}
|
||||
|
||||
private unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h)
|
||||
private void DrawInternal(Texture2d tex, float x, float y, float w, float h)
|
||||
{
|
||||
DrawInternal(tex, x, y, w, h, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
private unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
|
||||
private void DrawInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
|
||||
{
|
||||
var g = ((dynamic) Gdi).GetCurrentGraphics() as sd.Graphics;
|
||||
PrepDraw(g, tex);
|
||||
|
@ -264,7 +264,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
g.Transform = new sd.Drawing2D.Matrix(); //.Reset() doesn't work ? ?
|
||||
}
|
||||
|
||||
private unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy)
|
||||
private void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -554,7 +554,7 @@ namespace BizHawk.Bizware.DirectX
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, Matrix4 mat, bool transpose)
|
||||
public void SetPipelineUniformMatrix(PipelineUniform uniform, Matrix4 mat, bool transpose)
|
||||
{
|
||||
if (uniform.Owner == null)
|
||||
{
|
||||
|
@ -568,7 +568,7 @@ namespace BizHawk.Bizware.DirectX
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, ref Matrix4 mat, bool transpose)
|
||||
public void SetPipelineUniformMatrix(PipelineUniform uniform, ref Matrix4 mat, bool transpose)
|
||||
{
|
||||
if (uniform.Owner == null)
|
||||
{
|
||||
|
@ -617,7 +617,7 @@ namespace BizHawk.Bizware.DirectX
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void SetPipelineUniform(PipelineUniform uniform, Vector4[] values)
|
||||
public void SetPipelineUniform(PipelineUniform uniform, Vector4[] values)
|
||||
{
|
||||
if (uniform.Owner == null) return; // uniform was optimized out
|
||||
var v = new SlimDX.Vector4[values.Length];
|
||||
|
@ -688,7 +688,7 @@ namespace BizHawk.Bizware.DirectX
|
|||
}
|
||||
|
||||
/// <exception cref="InvalidOperationException">GDI+ call returned unexpected data</exception>
|
||||
public unsafe void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
|
||||
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
|
||||
{
|
||||
sdi.BitmapData bmpData = bmp.LockBits();
|
||||
var tw = tex.Opaque as TextureWrapper;
|
||||
|
@ -717,7 +717,7 @@ namespace BizHawk.Bizware.DirectX
|
|||
}
|
||||
|
||||
/// <exception cref="InvalidOperationException">SlimDX call returned unexpected data</exception>
|
||||
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
|
||||
public BitmapBuffer ResolveTexture2d(Texture2d tex)
|
||||
{
|
||||
//TODO - lazy create and cache resolving target in RT
|
||||
var target = new Texture(Dev, tex.IntWidth, tex.IntHeight, 1, Usage.None, Format.A8R8G8B8, Pool.SystemMemory);
|
||||
|
|
|
@ -218,7 +218,7 @@ namespace BizHawk.Bizware.OpenTK3
|
|||
DrawInternal(art, x, y, width, height);
|
||||
}
|
||||
|
||||
private unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h)
|
||||
private void DrawInternal(Texture2d tex, float x, float y, float w, float h)
|
||||
{
|
||||
Art art = new Art((ArtManager)null);
|
||||
art.Width = w;
|
||||
|
@ -258,7 +258,7 @@ namespace BizHawk.Bizware.OpenTK3
|
|||
}
|
||||
}
|
||||
|
||||
private unsafe void PrepDrawSubrectInternal(Texture2d tex)
|
||||
private void PrepDrawSubrectInternal(Texture2d tex)
|
||||
{
|
||||
if (sTexture != tex)
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ namespace BizHawk.Bizware.OpenTK3
|
|||
#endif
|
||||
}
|
||||
|
||||
private unsafe void DrawSubrectInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
|
||||
private void DrawSubrectInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
|
||||
{
|
||||
PrepDrawSubrectInternal(tex);
|
||||
EmitRectangleInternal(x, y, w, h, u0, v0, u1, v1);
|
||||
|
|
|
@ -577,7 +577,7 @@ namespace BizHawk.Bizware.OpenTK3
|
|||
return ret;
|
||||
}
|
||||
|
||||
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
|
||||
public BitmapBuffer ResolveTexture2d(Texture2d tex)
|
||||
{
|
||||
//note - this is dangerous since it changes the bound texture. could we save it?
|
||||
BindTexture2d(tex);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Client.Common
|
|||
private BitmapData _bmpData;
|
||||
private readonly int[] _pixels;
|
||||
|
||||
public unsafe void Clear()
|
||||
public void Clear()
|
||||
{
|
||||
FromBitmap(false);
|
||||
Util.Memset(PixelPtr, 0, Stride * Height);
|
||||
|
@ -37,7 +37,7 @@ namespace BizHawk.Client.Common
|
|||
return Graphics.FromImage(_bmp);
|
||||
}
|
||||
|
||||
public unsafe void ToBitmap(bool copy=true)
|
||||
public void ToBitmap(bool copy = true)
|
||||
{
|
||||
if (_isBitmap) return;
|
||||
_isBitmap = true;
|
||||
|
@ -70,7 +70,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private bool _isBitmap;
|
||||
|
||||
public unsafe void FromBitmap(bool copy = true)
|
||||
public void FromBitmap(bool copy = true)
|
||||
{
|
||||
if (!_isBitmap)
|
||||
{
|
||||
|
|
|
@ -351,7 +351,7 @@ namespace BizHawk.Client.Common
|
|||
return ret;
|
||||
}
|
||||
|
||||
private unsafe class SaveStateStream : Stream, ISpanStream
|
||||
private sealed class SaveStateStream : Stream, ISpanStream
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -445,7 +445,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
private unsafe class LoadStateStream : Stream, ISpanStream
|
||||
private sealed class LoadStateStream : Stream, ISpanStream
|
||||
{
|
||||
public LoadStateStream(Stream backingStore, long offset, long size, long mask)
|
||||
{
|
||||
|
@ -481,7 +481,7 @@ namespace BizHawk.Client.Common
|
|||
return Read(new Span<byte>(buffer, offset, count));
|
||||
}
|
||||
|
||||
public unsafe int Read(Span<byte> buffer)
|
||||
public int Read(Span<byte> buffer)
|
||||
{
|
||||
long n = Math.Min(_size - _position, buffer.Length);
|
||||
int ret = (int)n;
|
||||
|
|
|
@ -636,7 +636,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private static bool FAILED(int hr) => hr < 0;
|
||||
|
||||
private static unsafe int AVISaveOptions(IntPtr stream, ref AVIWriterImports.AVICOMPRESSOPTIONS opts, IntPtr owner)
|
||||
private static int AVISaveOptions(IntPtr stream, ref AVIWriterImports.AVICOMPRESSOPTIONS opts, IntPtr owner)
|
||||
{
|
||||
fixed (AVIWriterImports.AVICOMPRESSOPTIONS* _popts = &opts)
|
||||
{
|
||||
|
@ -847,7 +847,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// todo - why couldnt this take an ISoundProvider? it could do the timekeeping as well.. hmm
|
||||
public unsafe void AddSamples(short[] samples)
|
||||
public void AddSamples(short[] samples)
|
||||
{
|
||||
int todo = samples.Length;
|
||||
int idx = 0;
|
||||
|
@ -868,7 +868,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private unsafe void FlushBufferedAudio()
|
||||
private void FlushBufferedAudio()
|
||||
{
|
||||
int todo = _outStatus.audio_buffered_shorts;
|
||||
int todo_realsamples = todo / 2;
|
||||
|
@ -888,7 +888,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
/// <exception cref="InvalidOperationException">attempted frame resize during encoding</exception>
|
||||
public unsafe void AddFrame(IVideoProvider source)
|
||||
public void AddFrame(IVideoProvider source)
|
||||
{
|
||||
const int AVIIF_KEYFRAME = 0x00000010;
|
||||
|
||||
|
|
|
@ -104,11 +104,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
}
|
||||
|
||||
public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, Matrix4 mat, bool transpose)
|
||||
public void SetPipelineUniformMatrix(PipelineUniform uniform, Matrix4 mat, bool transpose)
|
||||
{
|
||||
}
|
||||
|
||||
public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, ref Matrix4 mat, bool transpose)
|
||||
public void SetPipelineUniformMatrix(PipelineUniform uniform, ref Matrix4 mat, bool transpose)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
}
|
||||
|
||||
public unsafe void SetPipelineUniform(PipelineUniform uniform, Vector4[] values)
|
||||
public void SetPipelineUniform(PipelineUniform uniform, Vector4[] values)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
rtw.Dispose();
|
||||
}
|
||||
|
||||
public unsafe RenderTarget CreateRenderTarget(int w, int h)
|
||||
public RenderTarget CreateRenderTarget(int w, int h)
|
||||
{
|
||||
var tw = new GDIPTextureWrapper
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
{
|
||||
public partial class QuickNES
|
||||
{
|
||||
private unsafe void InitMemoryDomains()
|
||||
private void InitMemoryDomains()
|
||||
{
|
||||
List<MemoryDomain> mm = new List<MemoryDomain>();
|
||||
for (int i = 0; ; i++)
|
||||
|
|
|
@ -358,10 +358,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
|
||||
//utilities
|
||||
//TODO: make internal, wrap on the API instead of the comm
|
||||
public unsafe string GetAscii() { return _getAscii(str); }
|
||||
public string GetAscii() => _getAscii(str);
|
||||
public bool GetBool() { return value != 0; }
|
||||
|
||||
private unsafe string _getAscii(sbyte* ptr)
|
||||
private string _getAscii(sbyte* ptr)
|
||||
{
|
||||
int len = 0;
|
||||
sbyte* junko = (sbyte*)ptr;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||
{
|
||||
unsafe partial class LibsnesApi
|
||||
public partial class LibsnesApi
|
||||
{
|
||||
public enum eMessage : int
|
||||
{
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void QUERY_peek_cpu_regs(out CPURegs ret)
|
||||
public void QUERY_peek_cpu_regs(out CPURegs ret)
|
||||
{
|
||||
using (_exe.EnterExit())
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ using BizHawk.Emulation.Common;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||
{
|
||||
public unsafe partial class LibsnesCore : IStatable
|
||||
public partial class LibsnesCore : IStatable
|
||||
{
|
||||
public void SaveStateBinary(BinaryWriter writer)
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
OctoshockDll.shock_SetMemCb(psx, mem_cb, mask);
|
||||
}
|
||||
|
||||
private unsafe void SetMemoryDomains()
|
||||
private void SetMemoryDomains()
|
||||
{
|
||||
var mmd = new List<MemoryDomain>();
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace BizHawk.Emulation.Cores.Libretro
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe struct CommStructEnv
|
||||
public struct CommStructEnv
|
||||
{
|
||||
public retro_system_info retro_system_info;
|
||||
public retro_system_av_info retro_system_av_info;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace BizHawk.Emulation.Cores.Libretro
|
||||
{
|
||||
unsafe partial class LibretroApi
|
||||
public partial class LibretroApi
|
||||
{
|
||||
private bool Handle_BRK(eMessage msg)
|
||||
{
|
||||
|
@ -18,4 +18,4 @@
|
|||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Libretro
|
||||
{
|
||||
unsafe partial class LibretroApi
|
||||
public partial class LibretroApi
|
||||
{
|
||||
public enum eMessage : int
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ using static BizHawk.Emulation.Cores.Waterbox.LibNymaCore;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Waterbox
|
||||
{
|
||||
unsafe partial class NymaCore
|
||||
public partial class NymaCore
|
||||
{
|
||||
private const int MAX_INPUT_DATA = 256;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ using NymaTypes;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Waterbox
|
||||
{
|
||||
unsafe partial class NymaCore : ISettable<NymaCore.NymaSettings, NymaCore.NymaSyncSettings>
|
||||
public partial class NymaCore : ISettable<NymaCore.NymaSettings, NymaCore.NymaSyncSettings>
|
||||
{
|
||||
public NymaSettingsInfo SettingsInfo { get; private set; }
|
||||
private NymaSettings _settings;
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
public bool SkipMemoryConsistencyCheck { get; set; } = false;
|
||||
}
|
||||
|
||||
public unsafe class WaterboxHost : IMonitor, IImportResolver, IStatable, IDisposable, ICallbackAdjuster
|
||||
public sealed class WaterboxHost : IMonitor, IImportResolver, IStatable, IDisposable, ICallbackAdjuster
|
||||
{
|
||||
private IntPtr _nativeHost;
|
||||
private int _enterCount;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
[FieldOffset(1024)]
|
||||
public IntPtr Data;
|
||||
|
||||
public unsafe IntPtr GetDataOrThrow()
|
||||
public IntPtr GetDataOrThrow()
|
||||
{
|
||||
if (ErrorMessageStart != 0)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ using static BizHawk.Emulation.Cores.Waterbox.LibWaterboxCore;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Waterbox
|
||||
{
|
||||
public abstract unsafe class WaterboxMemoryDomain : MemoryDomain
|
||||
public abstract class WaterboxMemoryDomain : MemoryDomain
|
||||
{
|
||||
protected readonly IntPtr _data;
|
||||
protected readonly IMonitor _monitor;
|
||||
|
|
Loading…
Reference in New Issue