Corrected minor build warnings

pull/363/head
David Hall 2022-12-08 17:23:33 -07:00
parent 4c66e36105
commit 27b1fb5d95
3 changed files with 9 additions and 6 deletions

View File

@ -289,9 +289,9 @@ public class DistributedRoutingTable : IDisposable
private static void DrtEventCallback(IntPtr Param, bool TimedOut)
{
var Drt = (DistributedRoutingTable)GCHandle.FromIntPtr(Param).Target;
var Drt = (DistributedRoutingTable?)GCHandle.FromIntPtr(Param).Target;
HRESULT hr = DrtGetEventDataSize(Drt.hDrt, out var ulDrtEventDataLen);
HRESULT hr = DrtGetEventDataSize(Drt?.hDrt, out var ulDrtEventDataLen);
if (hr.Failed)
{
if (hr != HRESULT.DRT_E_NO_MORE)

View File

@ -8,6 +8,7 @@ namespace Vanara.PInvoke;
/// <summary>Items from the WebSocket.dll.</summary>
public static partial class WebSocket
{
/// <summary/>
public const int WEB_SOCKET_MAX_CLOSE_REASON_LENGTH = 123;
private const string Lib_Websocket = "websocket.dll";

View File

@ -322,7 +322,7 @@ public class FirewallProfile
/// </remarks>
public string[]? ExcludedInterfaces
{
get => iPol.ExcludedInterfaces[type] is null ? null : (string[]?)Array.ConvertAll((object[])iPol.ExcludedInterfaces[type], o => o.ToString());
get => iPol.ExcludedInterfaces[type] is null ? null : (string[])Array.ConvertAll((object[])iPol.ExcludedInterfaces[type], o => o.ToString());
set => iPol.ExcludedInterfaces[type] = value is null || value.Length == 0 ? null : Array.ConvertAll(value, s => (object)s);
}
@ -624,7 +624,7 @@ public class FirewallRule : INamedEntity, IEquatable<FirewallRule>
/// </remarks>
public string[]? InterfaceNames
{
get => iRule.Interfaces is null ? null : (string[]?)Array.ConvertAll((object[])iRule.Interfaces, o => o.ToString());
get => iRule.Interfaces is null ? null : (string[])Array.ConvertAll((object[])iRule.Interfaces, o => o.ToString());
set => iRule.Interfaces = value is null || value.Length == 0 ? null : Array.ConvertAll(value, s => (object)s);
}
@ -916,7 +916,8 @@ public class FirewallRules : IReadOnlyList<FirewallRule>, ICollection<FirewallRu
IEnumerator enumerator = iRules.GetEnumerator();
while (enumerator.MoveNext())
{
iRules.Remove(((INetFwRule)enumerator.Current).Name);
if (enumerator.Current is INetFwRule rule)
iRules.Remove(rule.Name);
}
}
@ -932,7 +933,8 @@ public class FirewallRules : IReadOnlyList<FirewallRule>, ICollection<FirewallRu
IEnumerator enumerator = iRules.GetEnumerator();
while (enumerator.MoveNext())
{
yield return new FirewallRule((INetFwRule)enumerator.Current);
if (enumerator.Current is INetFwRule rule)
yield return new FirewallRule(rule);
}
}