fix: sprinkle @intCast to fix 32 bit arm builds

This commit is contained in:
CJ van den Berg 2024-08-16 22:02:53 +02:00
parent 1f6bc86265
commit 2a735cee5c
6 changed files with 7 additions and 7 deletions

View file

@ -1093,7 +1093,7 @@ pub fn load_from_file(self: *const Self, file_path: []const u8, file_exists: *bo
file_exists.* = true;
defer file.close();
const stat = try file.stat();
return self.load(file.reader(), stat.size);
return self.load(file.reader(), @intCast(stat.size));
}
pub fn load_from_file_and_update(self: *Self, file_path: []const u8) !void {

View file

@ -399,7 +399,7 @@ const Process = struct {
};
defer file.close();
const stat = try file.stat();
var buffer = try self.a.alloc(u8, stat.size);
var buffer = try self.a.alloc(u8, @intCast(stat.size));
defer self.a.free(buffer);
const size = try file.readAll(buffer);
try project.restore_state(buffer[0..size]);

View file

@ -187,7 +187,7 @@ pub fn render_relative(self: *Self, theme: *const Widget.Theme) void {
var diff_symbols = self.diff_symbols.items;
var buf: [31:0]u8 = undefined;
while (rows > 0) : (rows -= 1) {
if (pos > self.lines - row) return;
if (pos > self.lines - @as(u32, @intCast(row))) return;
self.plane.set_base_style(" ", if (linenum == 0) theme.editor_gutter_active else theme.editor_gutter);
const val = @abs(if (linenum == 0) line else linenum);
const fmt = std.fmt.bufPrintZ(&buf, "{d} ", .{val}) catch return;

View file

@ -568,7 +568,7 @@ fn read_restore_info(self: *Self) !void {
const file = try std.fs.cwd().openFile(file_name, .{ .mode = .read_only });
defer file.close();
const stat = try file.stat();
var buf = try self.a.alloc(u8, stat.size);
var buf = try self.a.alloc(u8, @intCast(stat.size));
defer self.a.free(buf);
const size = try file.readAll(buf);
try editor.extract_state(buf[0..size]);

View file

@ -97,7 +97,7 @@ pub fn restore_state(palette: *Type) !void {
};
defer file.close();
const stat = try file.stat();
var buffer = try a.alloc(u8, stat.size);
var buffer = try a.alloc(u8, @intCast(stat.size));
defer a.free(buffer);
const size = try file.readAll(buffer);
const data = buffer[0..size];

View file

@ -86,7 +86,7 @@ fn render_idle(self: *Self) bool {
return self.animate();
} else {
const i = @mod(self.idle_frame / 8, idle_spinner.len);
_ = self.plane.print_aligned_center(0, "{s} {s} {s}", .{ idle_spinner[i], idle_msg, idle_spinner[i] }) catch {};
_ = self.plane.print_aligned_center(0, "{s} {s} {s}", .{ idle_spinner[@intCast(i)], idle_msg, idle_spinner[@intCast(i)] }) catch {};
}
return true;
}
@ -196,7 +196,7 @@ const eighths_r = [_][]const u8{ " ", "▕", "🮇", "🮈", "▐", "🮉", "
const eighths_c = eighths_l.len;
fn smooth_block_at(plane: *Plane, pos: u64) void {
const blk = @mod(pos, eighths_c) + 1;
const blk: u32 = @intCast(@mod(pos, eighths_c) + 1);
const l = eighths_l[eighths_c - blk];
const r = eighths_r[eighths_c - blk];
plane.erase();