From 54ee24eb96b1bd1e5390ffd011d7c03b3993d218 Mon Sep 17 00:00:00 2001 From: dahall Date: Sun, 9 Feb 2020 11:27:14 -0700 Subject: [PATCH] Fixed compiler warnings --- PInvoke/Gdi32/WinGdi.BITMAPINFO.cs | 4 +++- PInvoke/Security/AdvApi32/WinNT.cs | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs b/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs index f389eff4..fc5ca5f9 100644 --- a/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs +++ b/PInvoke/Gdi32/WinGdi.BITMAPINFO.cs @@ -101,7 +101,7 @@ namespace Vanara.PInvoke /// The number of entries in the array depends on the values of the biBitCount and biClrUsed members of the BITMAPINFOHEADER structure. /// The colors in the bmiColors table appear in order of importance. For more information, see the Remarks section. /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1, ArraySubType = UnmanagedType.Struct)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public RGBQUAD[] bmiColors; /// Initializes a new instance of the structure. @@ -307,7 +307,9 @@ namespace Vanara.PInvoke /// Specifies three color masks for the DIB. This field is only valid when the BitCount member of the BITMAPINFOHEADER structure has a value greater /// than 8. Each color mask indicates the bits that are used to encode one of the three color channels (red, green, and blue). /// +#pragma warning disable IDE1006 // Naming Styles public uint[] dsBitFields +#pragma warning restore IDE1006 // Naming Styles { get => new[] { dsBitField1, dsBitField2, dsBitField3 }; set { dsBitField1 = value[0]; dsBitField2 = value[1]; dsBitField3 = value[2]; } diff --git a/PInvoke/Security/AdvApi32/WinNT.cs b/PInvoke/Security/AdvApi32/WinNT.cs index 2794302b..97d2c4a3 100644 --- a/PInvoke/Security/AdvApi32/WinNT.cs +++ b/PInvoke/Security/AdvApi32/WinNT.cs @@ -4294,7 +4294,7 @@ namespace Vanara.PInvoke internal class Marshaler : ICustomMarshaler { - public static ICustomMarshaler GetInstance(string cookie) => new Marshaler(); + public static ICustomMarshaler GetInstance(string _) => new Marshaler(); public void CleanUpManagedData(object ManagedObj) { @@ -4406,7 +4406,7 @@ namespace Vanara.PInvoke { long nAuthority = 0; for (var i = 0; i <= 5; i++) - nAuthority |= (Value[i] << (8 * i)); + nAuthority |= (long)Value[i] << (8 * i); return nAuthority; } set @@ -4441,6 +4441,9 @@ namespace Vanara.PInvoke /// public override bool Equals(object obj) => obj is PSID_IDENTIFIER_AUTHORITY h ? h.LongValue == h.LongValue : false; + + /// + public override int GetHashCode() => LongValue.GetHashCode(); } /// A SafeHandle for access control lists. If owned, will call LocalFree on the pointer when disposed. @@ -4450,8 +4453,6 @@ namespace Vanara.PInvoke /// The null value for a SafePACL. public static readonly SafePACL Null = new SafePACL(); - private const SECURITY_INFORMATION defSecInfo = SECURITY_INFORMATION.DACL_SECURITY_INFORMATION | SECURITY_INFORMATION.SACL_SECURITY_INFORMATION | SECURITY_INFORMATION.OWNER_SECURITY_INFORMATION | SECURITY_INFORMATION.GROUP_SECURITY_INFORMATION; - /// Initializes a new instance of the class. public SafePACL() : base(IntPtr.Zero, 0, true) { }