chore: update to latest zig

This commit is contained in:
LordMZTE 2023-06-27 23:00:13 +02:00
parent e3034c1343
commit 64b8b9e715
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
13 changed files with 28 additions and 32 deletions

View file

@ -4,8 +4,8 @@
.dependencies = .{
.znvim = .{
.url = "https://mzte.de/git/LordMZTE/znvim/archive/7f3ee7246c8e45b6f9795c341bbb7c96166da87a.tar.gz",
.hash = "12202243825f04956b325c59831b1380810cba6210a7455441a9a357013f4f7b193a",
.url = "https://mzte.de/git/LordMZTE/znvim/archive/bce6595cc4a0867eea5403e2db927d8352a98d85.tar.gz",
.hash = "12203374d5927caa891985e5bfc02f60a2f066967606359a0b2e3863231af27b3023",
},
},
}

View file

@ -89,7 +89,7 @@ fn lOnTab(l: *c.lua_State) !c_int {
const b = std.mem.indexOfScalar(
u8,
" \t\n",
line[@intCast(usize, cursor_col) - 1],
line[@as(usize, @intCast(cursor_col)) - 1],
) == null;
// remove the string and the string array from the stack

View file

@ -7,9 +7,9 @@ pub fn luaPushAny(l: *c.lua_State, x: anytype) void {
switch (@typeInfo(T)) {
.Void, .Null => c.lua_pushnil(l),
.Bool => c.lua_pushboolean(l, @intCast(c_int, @intFromBool(x))),
.Int, .ComptimeInt => c.lua_pushinteger(l, @intCast(c_int, x)),
.Float, .ComptimeFloat => c.lua_pushnumber(l, @floatCast(c.lua_Number, x)),
.Bool => c.lua_pushboolean(l, @intCast(@intFromBool(x))),
.Int, .ComptimeInt => c.lua_pushinteger(l, @intCast(x)),
.Float, .ComptimeFloat => c.lua_pushnumber(l, @floatCast(x)),
.Pointer => |P| {
switch (P.size) {
.One => {

View file

@ -4,8 +4,8 @@
.dependencies = .{
.ansi_term = .{
.url = "https://github.com/ziglibs/ansi-term/archive/84b2a92970bc3328b1366abb3bffd677bd681669.tar.gz",
.hash = "1220d454469ddc251e46fff3b2b11f7016deb54bc5cd8618e809a09a4b1f5304f555",
.url = "https://github.com/ziglibs/ansi-term/archive/fe6df80ab1de74be9d0114cfbca7173d6dc3ed93.tar.gz",
.hash = "12206275be1f3720c1f33e6a9cda79f25069996e44a0e6e7bf4b802116edd245b49f",
},
},
}

View file

@ -73,10 +73,7 @@ pub fn winContent(state: *State) !void {
quality_popup_pos.y += quality_popup_size.y;
quality_popup_size.x += btn_size.x;
quality_popup_size.y += 5 + (quality_popup_size.y * @floatFromInt(
f32,
preset_qualities.len,
));
quality_popup_size.y += 5 + (quality_popup_size.y * @as(f32, @floatFromInt(preset_qualities.len)));
c.igSetNextWindowPos(quality_popup_pos, c.ImGuiCond_Always, .{ .x = 0.0, .y = 0.0 });
c.igSetNextWindowSize(quality_popup_size, c.ImGuiCond_Always);
@ -154,7 +151,7 @@ pub fn winContent(state: *State) !void {
c.igTableHeader("Live?");
for (state.channels.?, 0..) |entry, i| {
c.igPushID_Int(@intCast(c_int, i));
c.igPushID_Int(@intCast(i));
defer c.igPopID();
_ = c.igTableNextRow(0, 0.0);

View file

@ -61,7 +61,7 @@ fn streamlinkThread(state: *State, channel: []const u8) !void {
const lower_channel = std.ascii.lowerString(&ch_buf, channel);
const url = try std.fmt.allocPrintZ(arg_arena.allocator(), "https://twitch.tv/{s}", .{lower_channel});
const quality = try std.cstr.addNullByte(arg_arena.allocator(), std.mem.sliceTo(&state.quality_buf, 0));
const quality = try arg_arena.allocator().dupeZ(u8, std.mem.sliceTo(&state.quality_buf, 0));
const streamlink_argv = try arg_arena.allocator().allocSentinel(
?[*:0]const u8,

View file

@ -86,7 +86,7 @@ pub fn main() !void {
c.ImGuiCond_Always,
);
c.igSetWindowSize_Vec2(
.{ .x = @floatFromInt(f32, win_width), .y = @floatFromInt(f32, win_height) },
.{ .x = @floatFromInt(win_width), .y = @floatFromInt(win_height) },
c.ImGuiCond_Always,
);

View file

@ -4,12 +4,12 @@
.dependencies = .{
.ansi_term = .{
.url = "https://github.com/ziglibs/ansi-term/archive/84b2a92970bc3328b1366abb3bffd677bd681669.tar.gz",
.hash = "1220d454469ddc251e46fff3b2b11f7016deb54bc5cd8618e809a09a4b1f5304f555",
.url = "https://github.com/ziglibs/ansi-term/archive/fe6df80ab1de74be9d0114cfbca7173d6dc3ed93.tar.gz",
.hash = "12206275be1f3720c1f33e6a9cda79f25069996e44a0e6e7bf4b802116edd245b49f",
},
.known_folders = .{
.url = "https://github.com/ziglibs/known-folders/archive/d13ba6137084e55f873f6afb67447fe8906cc951.tar.gz",
.hash = "122028c00915d9b37296059be8a3883c718dbb5bd174350caedf152fed1f46f99607",
.url = "https://github.com/ziglibs/known-folders/archive/d070896807cbbd2847d24d561438994504b929dd.tar.gz",
.hash = "122001a81a0ba2faca0271d53c50e8069721fe66a19d71dd8498e61fa26d7ca6f558",
},
},
}

View file

@ -17,10 +17,12 @@ pub fn main() !void {
if (std.os.argv.len < 2)
return error.NotEnoughArguments;
if (std.cstr.cmp(std.os.argv[1], "printfish") == 0) {
const verb = std.mem.span(std.os.argv[1]);
if (std.mem.eql(u8, verb, "printfish")) {
const stdout = std.io.getStdOut();
try stdout.writer().print(fish_code ++ "\n", .{std.os.argv[0]});
} else if (std.cstr.cmp(std.os.argv[1], "show") == 0) {
} else if (std.mem.eql(u8, verb, "show")) {
const options = prompt.Options{
.status = try std.fmt.parseInt(
i16,

View file

@ -339,10 +339,7 @@ fn gitStatusCb(
c.GIT_STATUS_WT_RENAMED |
c.GIT_STATUS_WT_TYPECHANGE;
const counts = @ptrCast(
*GitStatusCounts,
@alignCast(@alignOf(GitStatusCounts), counts_),
);
const counts: *GitStatusCounts = @ptrCast(@alignCast(counts_));
if (flags & staged_flags > 0)
counts.staged += 1;

View file

@ -28,7 +28,7 @@ pub fn main() !u8 {
var feh_argv = try alloc.alloc(
[]const u8,
feh_baseargs.len + @intCast(usize, screens),
feh_baseargs.len + @as(usize, @intCast(screens)),
);
defer alloc.free(feh_argv);
std.mem.copy([]const u8, feh_argv, &feh_baseargs);

View file

@ -77,7 +77,7 @@ pub fn provide(self: ClipboardConnection, data: []const u8) !void {
c.XA_ATOM,
32,
c.PropModeReplace,
@ptrCast([*c]u8, &utf8_atom),
@ptrCast(&utf8_atom),
1,
);
} else if (xsr.target == c.XA_STRING or xsr.target == text_atom) {
@ -89,7 +89,7 @@ pub fn provide(self: ClipboardConnection, data: []const u8) !void {
8,
c.PropModeReplace,
data.ptr,
@intCast(c_int, data.len),
@intCast(data.len),
);
sent_data = true;
} else if (xsr.target == utf8_atom) {
@ -101,7 +101,7 @@ pub fn provide(self: ClipboardConnection, data: []const u8) !void {
8,
c.PropModeReplace,
data.ptr,
@intCast(c_int, data.len),
@intCast(data.len),
);
sent_data = true;
}
@ -120,7 +120,7 @@ pub fn provide(self: ClipboardConnection, data: []const u8) !void {
.send_event = 0,
};
_ = c.XSendEvent(self.dpy, ev.requestor, 0, 0, @ptrCast(*c.XEvent, &ev));
_ = c.XSendEvent(self.dpy, ev.requestor, 0, 0, @ptrCast(&ev));
if (sent_data) {
if (ffi.xGetWindowName(self.dpy, xsr.requestor)) |name| {
defer _ = c.XFree(name.ptr);
@ -191,5 +191,5 @@ fn getContentForType(self: ClipboardConnection, t: c.Atom) !?[]u8 {
);
defer _ = c.XDeleteProperty(xsel.display, xsel.requestor, xsel.property);
return (data orelse return null)[0..@intCast(usize, size)];
return (data orelse return null)[0..@intCast(size)];
}

View file

@ -46,5 +46,5 @@ pub fn xGetWindowName(dpy: *c.Display, win: c.Window) ?[]u8 {
if (name_cstr == null)
return null;
return name_cstr[0..@intCast(usize, n)];
return name_cstr[0..@intCast(n)];
}