Skip to content

Commit 1df9937

Browse files
Aransentinandrewrk
authored andcommitted
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'`.
1 parent 0a99898 commit 1df9937

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/os/windows.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ pub fn recvfrom(s: ws2_32.SOCKET, buf: [*]u8, len: usize, flags: u32, from: ?*ws
14061406
var buffer = ws2_32.WSABUF{ .len = @truncate(u31, len), .buf = buf };
14071407
var bytes_received: DWORD = undefined;
14081408
var flags_inout = flags;
1409-
if (ws2_32.WSARecvFrom(s, @ptrCast([*]ws2_32.WSABUF, &buffer), 1, &bytes_received, &flags_inout, from, from_len, null, null) == ws2_32.SOCKET_ERROR) {
1409+
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) {
14101410
return ws2_32.SOCKET_ERROR;
14111411
} else {
14121412
return @as(i32, @intCast(u31, bytes_received));

0 commit comments

Comments
 (0)