fix: zig update build errors
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m35s

This commit is contained in:
2025-08-06 16:14:22 +02:00
parent 4f6cabf898
commit c50b10f32d
4 changed files with 9 additions and 10 deletions

View File

@@ -176,7 +176,7 @@ pub fn main() !void {
if (now_ms >= next_frame_ms) { if (now_ms >= next_frame_ms) {
next_frame_ms = now_ms + tick_ms; next_frame_ms = now_ms + tick_ms;
} else { } else {
time.sleep((next_frame_ms - now_ms) * time.ns_per_ms); std.Thread.sleep((next_frame_ms - now_ms) * time.ns_per_ms);
next_frame_ms += tick_ms; next_frame_ms += tick_ms;
} }

View File

@@ -67,7 +67,7 @@ pub fn main() !void {
if (now_ms >= next_frame_ms) { if (now_ms >= next_frame_ms) {
next_frame_ms = now_ms + tick_ms; next_frame_ms = now_ms + tick_ms;
} else { } else {
time.sleep((next_frame_ms - now_ms) * time.ns_per_ms); std.Thread.sleep((next_frame_ms - now_ms) * time.ns_per_ms);
next_frame_ms += tick_ms; next_frame_ms += tick_ms;
} }

View File

@@ -33,7 +33,7 @@ pub fn App(comptime E: type) type {
// global variable for the registered handler for WINCH // global variable for the registered handler for WINCH
var handler_ctx: *anyopaque = undefined; var handler_ctx: *anyopaque = undefined;
/// registered WINCH handler to report resize events /// registered WINCH handler to report resize events
fn handleWinch(_: c_int) callconv(.C) void { fn handleWinch(_: c_int) callconv(.c) void {
const this: *@This() = @ptrCast(@alignCast(handler_ctx)); const this: *@This() = @ptrCast(@alignCast(handler_ctx));
// NOTE this does not have to be done if in-band resize events are supported // NOTE this does not have to be done if in-band resize events are supported
// -> the signal might not work correctly when hosting the application over ssh! // -> the signal might not work correctly when hosting the application over ssh!

View File

@@ -62,19 +62,18 @@ pub fn write(buf: []const u8) !usize {
return try posix.write(posix.STDIN_FILENO, buf); return try posix.write(posix.STDIN_FILENO, buf);
} }
fn contextWrite(context: @This(), data: []const u8) anyerror!usize { fn contextWrite(context: *const anyopaque, data: []const u8) anyerror!usize {
_ = context; _ = context;
return try posix.write(posix.STDOUT_FILENO, data); return try posix.write(posix.STDOUT_FILENO, data);
} }
const Writer = std.io.Writer( const Writer = std.io.AnyWriter;
@This(),
anyerror,
contextWrite,
);
pub fn writer() Writer { pub fn writer() Writer {
return .{ .context = .{} }; return .{
.context = &.{},
.writeFn = contextWrite,
};
} }
pub fn setCursorPosition(pos: Point) !void { pub fn setCursorPosition(pos: Point) !void {