Skip to content

Commit ed0301a

Browse files
authored
Merge pull request #1027 from dorssel/refactor_nint
Refactor IntPtr to nint
2 parents 85e0251 + 0a1558c commit ed0301a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Usbipd/AttachedEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public async Task HandleSubmitAsync(UsbIpHeaderBasic basic, UsbIpHeaderCmdSubmit
334334
}
335335
else
336336
{
337-
urb.buf = IntPtr.Zero;
337+
urb.buf = 0;
338338
StructToBytes(urb, bytes);
339339
ioctl = Device.IoControlAsync(SUPUSB_IOCTL.SEND_URB, bytes, bytes);
340340
}

Usbipd/ConnectedClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async Task HandleRequestImportAsync(CancellationToken cancellationToken)
231231
{
232232
case CM_NOTIFY_ACTION.CM_NOTIFY_ACTION_DEVICEREMOVEPENDING:
233233
case CM_NOTIFY_ACTION.CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE:
234-
PInvoke.SetEvent((HANDLE)(IntPtr)context);
234+
PInvoke.SetEvent((HANDLE)(nint)context);
235235
break;
236236
}
237237
return (uint)WIN32_ERROR.ERROR_SUCCESS;

Usbipd/Interop/VBoxUsb.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public struct UsbSupUrb
109109
public UsbSupXferFlags flags; /* [in] USBSUP_FLAG_XXX */
110110
public UsbSupError error; /* [out] USBSUP_XFER_XXX */
111111
public ulong len; /* [in/out] may change */
112-
public IntPtr buf; /* [in/out] depends on dir */
112+
public nint buf; /* [in/out] depends on dir */
113113
public uint numIsoPkts; /* [in] number of isochronous packets (8 max) */
114114
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
115115
public UsbSupIsoPkt[] aIsoPkts; /* [in/out] isochronous packet descriptors */

Usbipd/Tools.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static void StructToBytes<T>(in T s, Span<byte> bytes) where T : struct
5656
{
5757
fixed (byte* dst = bytes)
5858
{
59-
Marshal.StructureToPtr(s, (IntPtr)dst, false);
59+
Marshal.StructureToPtr(s, (nint)dst, false);
6060
}
6161
}
6262
}
@@ -79,7 +79,7 @@ public static byte[] StructToBytes<T>(in T s) where T : struct
7979
{
8080
fixed (byte* src = bytes)
8181
{
82-
s = Marshal.PtrToStructure<T>((IntPtr)src);
82+
s = Marshal.PtrToStructure<T>((nint)src);
8383
}
8484
}
8585
}

0 commit comments

Comments
 (0)