zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1df993706aaac77455bbd103c8abf88beaf74e6b (tree)
parent 0a99898b984c1ed98486060129ab441849118d8a
Author: Jens Goldberg <jens.goldberg@gmail.com>
Date:   Mon, 24 May 2021 09:13:25 +0000

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'`.
Diffstat:
Mlib/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 @@ -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));