From b28b04d710e7e6a9c82320f20d128c0f15f8ebf7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 14 Oct 2022 09:44:22 -0700 Subject: [PATCH] pkg/libuv: fix stage2 compilation issues --- pkg/libuv/Embed.zig | 8 ++++++-- pkg/libuv/stream.zig | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/libuv/Embed.zig b/pkg/libuv/Embed.zig index 48ec09eac..39a75b87c 100644 --- a/pkg/libuv/Embed.zig +++ b/pkg/libuv/Embed.zig @@ -24,12 +24,16 @@ cond: Cond, ready: bool = false, terminate: BoolAtomic, sleeping: BoolAtomic, -callback: fn () void, +callback: std.meta.FnPtr(fn () void), thread: ?Thread, /// Initialize a new embedder. The callback is called when libuv should /// tick. The callback should be as fast as possible. -pub fn init(alloc: Allocator, loop: Loop, callback: fn () void) !Embed { +pub fn init( + alloc: Allocator, + loop: Loop, + callback: std.meta.FnPtr(fn () void), +) !Embed { return Embed{ .loop = loop, .mutex = try Mutex.init(alloc), diff --git a/pkg/libuv/stream.zig b/pkg/libuv/stream.zig index 482351e63..06206cf82 100644 --- a/pkg/libuv/stream.zig +++ b/pkg/libuv/stream.zig @@ -96,10 +96,12 @@ pub fn Stream(comptime T: type) type { }); if (result) |slice| { - buf.* = @bitCast(c.uv_buf_t, slice); + buf.* = .{ + .base = slice.ptr, + .len = slice.len, + }; } else { - buf.*.base = null; - buf.*.len = 0; + buf.* = .{ .base = null, .len = 0 }; } } @@ -112,7 +114,7 @@ pub fn Stream(comptime T: type) type { @call(.{ .modifier = .always_inline }, read_cb, .{ ¶m, cbnread, - @bitCast([]const u8, cbbuf.*), + cbbuf.*.base[0..cbbuf.*.len], }); } };