Merge pull request #190 from Frassle/warnings

[Issue #61] Fix warnings.
This commit is contained in:
Fraser 2014-11-03 14:58:35 +01:00
commit f8af961d54
5 changed files with 28 additions and 9 deletions

View file

@ -50,7 +50,6 @@ namespace OpenTK.Rewrite
// mscorlib types // mscorlib types
static AssemblyDefinition mscorlib; static AssemblyDefinition mscorlib;
static TypeDefinition TypeMarshal; static TypeDefinition TypeMarshal;
static TypeDefinition TypeStringArray;
static TypeDefinition TypeStringBuilder; static TypeDefinition TypeStringBuilder;
static TypeDefinition TypeVoid; static TypeDefinition TypeVoid;
static TypeDefinition TypeIntPtr; static TypeDefinition TypeIntPtr;
@ -116,7 +115,6 @@ namespace OpenTK.Rewrite
return; return;
} }
TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal"); TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal");
TypeStringArray = mscorlib.MainModule.GetType("System.String").MakeArrayType().Resolve();
TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder"); TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder");
TypeVoid = mscorlib.MainModule.GetType("System.Void"); TypeVoid = mscorlib.MainModule.GetType("System.Void");
TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr"); TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr");

View file

@ -670,6 +670,12 @@ namespace OpenTK
#region Add Functions #region Add Functions
/// <summary>
/// Adds two instances.
/// </summary>
/// <param name="left">The left operand of the addition.</param>
/// <param name="right">The right operand of the addition.</param>
/// <returns>A new instance that is the result of the addition.</returns>
public static Matrix3 Add(Matrix3 left, Matrix3 right) public static Matrix3 Add(Matrix3 left, Matrix3 right)
{ {
Matrix3 result; Matrix3 result;
@ -677,6 +683,12 @@ namespace OpenTK
return result; return result;
} }
/// <summary>
/// Adds two instances.
/// </summary>
/// <param name="left">The left operand of the addition.</param>
/// <param name="right">The right operand of the addition.</param>
/// <param name="result">A new instance that is the result of the addition.</param>
public static void Add(ref Matrix3 left, ref Matrix3 right, out Matrix3 result) public static void Add(ref Matrix3 left, ref Matrix3 right, out Matrix3 result)
{ {
Vector3.Add(ref left.Row0, ref right.Row0, out result.Row0); Vector3.Add(ref left.Row0, ref right.Row0, out result.Row0);

View file

@ -667,6 +667,12 @@ namespace OpenTK
#region Add Functions #region Add Functions
/// <summary>
/// Adds two instances.
/// </summary>
/// <param name="left">The left operand of the addition.</param>
/// <param name="right">The right operand of the addition.</param>
/// <returns>A new instance that is the result of the addition.</returns>
public static Matrix3d Add(Matrix3d left, Matrix3d right) public static Matrix3d Add(Matrix3d left, Matrix3d right)
{ {
Matrix3d result; Matrix3d result;
@ -674,6 +680,12 @@ namespace OpenTK
return result; return result;
} }
/// <summary>
/// Adds two instances.
/// </summary>
/// <param name="left">The left operand of the addition.</param>
/// <param name="right">The right operand of the addition.</param>
/// <param name="result">A new instance that is the result of the addition.</param>
public static void Add(ref Matrix3d left, ref Matrix3d right, out Matrix3d result) public static void Add(ref Matrix3d left, ref Matrix3d right, out Matrix3d result)
{ {
Vector3d.Add(ref left.Row0, ref right.Row0, out result.Row0); Vector3d.Add(ref left.Row0, ref right.Row0, out result.Row0);

View file

@ -200,6 +200,7 @@ namespace OpenTK.Platform.Windows
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct HidProtocolNotRange struct HidProtocolNotRange
{ {
#pragma warning disable 169 // private field is never used
public short Usage; public short Usage;
short Reserved1; short Reserved1;
public short StringIndex; public short StringIndex;
@ -208,6 +209,7 @@ namespace OpenTK.Platform.Windows
short Reserved3; short Reserved3;
public short DataIndex; public short DataIndex;
short Reserved4; short Reserved4;
#pragma warning restore 169
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
@ -256,6 +258,7 @@ namespace OpenTK.Platform.Windows
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
struct HidProtocolValueCaps struct HidProtocolValueCaps
{ {
#pragma warning disable 169 // private field is never used
[FieldOffset(0)] public HIDPage UsagePage; [FieldOffset(0)] public HIDPage UsagePage;
[FieldOffset(2)] public byte ReportID; [FieldOffset(2)] public byte ReportID;
[FieldOffset(3), MarshalAs(UnmanagedType.U1)] public bool IsAlias; [FieldOffset(3), MarshalAs(UnmanagedType.U1)] public bool IsAlias;
@ -284,5 +287,6 @@ namespace OpenTK.Platform.Windows
[FieldOffset(52)] public int PhysicalMax; [FieldOffset(52)] public int PhysicalMax;
[FieldOffset(56)] public HidProtocolRange Range; [FieldOffset(56)] public HidProtocolRange Range;
[FieldOffset(56)] public HidProtocolNotRange NotRange; [FieldOffset(56)] public HidProtocolNotRange NotRange;
#pragma warning restore 169
} }
} }

View file

@ -178,7 +178,6 @@ namespace OpenTK.Platform.Windows
// Defines which types of HID devices we are interested in // Defines which types of HID devices we are interested in
readonly RawInputDevice[] DeviceTypes; readonly RawInputDevice[] DeviceTypes;
readonly IntPtr Window;
readonly object UpdateLock = new object(); readonly object UpdateLock = new object();
readonly DeviceCollection<Device> Devices = new DeviceCollection<Device>(); readonly DeviceCollection<Device> Devices = new DeviceCollection<Device>();
@ -194,7 +193,6 @@ namespace OpenTK.Platform.Windows
if (window == IntPtr.Zero) if (window == IntPtr.Zero)
throw new ArgumentNullException("window"); throw new ArgumentNullException("window");
Window = window;
DeviceTypes = new RawInputDevice[] DeviceTypes = new RawInputDevice[]
{ {
new RawInputDevice(HIDUsageGD.Joystick, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window), new RawInputDevice(HIDUsageGD.Joystick, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
@ -615,9 +613,6 @@ namespace OpenTK.Platform.Windows
static bool GetDeviceCaps(Device stick, byte[] preparsed_data, out HidProtocolCaps caps) static bool GetDeviceCaps(Device stick, byte[] preparsed_data, out HidProtocolCaps caps)
{ {
int axis_caps_count = 0;
int button_caps_count = 0;
// Query joystick capabilities // Query joystick capabilities
caps = new HidProtocolCaps(); caps = new HidProtocolCaps();
if (HidProtocol.GetCaps(preparsed_data, ref caps) != HidProtocolStatus.Success) if (HidProtocol.GetCaps(preparsed_data, ref caps) != HidProtocolStatus.Success)
@ -641,7 +636,6 @@ namespace OpenTK.Platform.Windows
Marshal.GetLastWin32Error()); Marshal.GetLastWin32Error());
return false; return false;
} }
axis_caps_count = (int)axis_count;
// Button capabilities // Button capabilities
ushort button_count = (ushort)button_caps.Length; ushort button_count = (ushort)button_caps.Length;
@ -653,7 +647,6 @@ namespace OpenTK.Platform.Windows
Marshal.GetLastWin32Error()); Marshal.GetLastWin32Error());
return false; return false;
} }
button_caps_count = (int)button_count;
stick.AxisCaps.Clear(); stick.AxisCaps.Clear();
stick.AxisCaps.AddRange(axis_caps); stick.AxisCaps.AddRange(axis_caps);