From 1df993706aaac77455bbd103c8abf88beaf74e6b Mon Sep 17 00:00:00 2001 From: Jens Goldberg Date: Mon, 24 May 2021 09:13:25 +0000 Subject: [PATCH] Fix socklen_t cast in win32 recvfrom All other uses of `ws2_32.socklen_t` in windows.zig casts the value to an i32. `recvfrom` should do so as well; it currently errors out with `expected type '?*i32', found '?*u32'`. --- lib/std/os/windows.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index a01d35f210..4bdbe64fbf 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -1406,7 +1406,7 @@ pub fn recvfrom(s: ws2_32.SOCKET, buf: [*]u8, len: usize, flags: u32, from: ?*ws var buffer = ws2_32.WSABUF{ .len = @truncate(u31, len), .buf = buf }; var bytes_received: DWORD = undefined; var flags_inout = flags; - if (ws2_32.WSARecvFrom(s, @ptrCast([*]ws2_32.WSABUF, &buffer), 1, &bytes_received, &flags_inout, from, from_len, null, null) == ws2_32.SOCKET_ERROR) { + if (ws2_32.WSARecvFrom(s, @ptrCast([*]ws2_32.WSABUF, &buffer), 1, &bytes_received, &flags_inout, from, @ptrCast(?*i32, from_len), null, null) == ws2_32.SOCKET_ERROR) { return ws2_32.SOCKET_ERROR; } else { return @as(i32, @intCast(u31, bytes_received));