Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/fontviewer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ pub fn main() !u8 {
const list, _ = try source.readSynchronousReplyHeader(sink.sequence, .ListFonts);
std.log.info("font count {}", .{list.count});
const remaining_size = source.replyRemainingSize();
const font_mem = try allocator.alloc(u8, remaining_size);
const font_mem = try allocator.alloc(u8, @intCast(remaining_size));
try source.readReply(font_mem);
const fonts = try allocator.alloc(x11.Slice(u8, [*]const u8), list.count);
var font_mem_index: u34 = 0;
var font_mem_index: usize = 0;

for (fonts.ptr[0..list.count]) |*font| {
if (font_mem_index == font_mem.len) @panic("fonts truncated");
const len = font_mem[font_mem_index];
Expand Down Expand Up @@ -321,7 +322,7 @@ const State = struct {
"msg size is {} but fields require {}",
.{ msg_remaining_size, required_remaining_size },
);
try source.replyDiscard(msg_remaining_size);
try source.replyDiscard(@intCast(msg_remaining_size));
const font_info: FontInfo = .{
.font_ascent = font.font_ascent,
.font_descent = font.font_descent,
Expand Down
2 changes: 1 addition & 1 deletion examples/getserverfontnames.zig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn main() !void {
}
const remaining = source.replyRemainingSize();
std.log.info("discarding remaining {} bytes...", .{remaining});
try source.replyDiscard(remaining);
try source.replyDiscard(@intCast(remaining));

try stdout.flush();
}
4 changes: 2 additions & 2 deletions examples/testexample.zig
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ pub fn main() !u8 {
}
}
// NOTE: there is stil two more lists we could read
try source.replyDiscard(source.replyRemainingSize());
try source.replyDiscard(@intCast(source.replyRemainingSize()));

if (maybe_picture_format) |format| {
std.log.info("using format {f}", .{format});
Expand Down Expand Up @@ -810,7 +810,7 @@ fn checkTestImageIsDrawnToWindow(

const log_image = false;

for (0..image_size / 4) |_| {
for (0..@intCast(image_size / 4)) |_| {
if (width_index >= test_image.width) {
// For Debugging: Print a newline after each row
if (log_image) std.debug.print("\n", .{});
Expand Down
4 changes: 2 additions & 2 deletions src/x.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4323,7 +4323,7 @@ pub const Source = struct {
.reply => |*reply_state| {
const remaining = reply_state.remaining();
std.debug.assert(remaining > 0);
try source.reader.discardAll(remaining);
try source.reader.discardAll(@intCast(remaining));
source.state = .kind;
},
.err => return,
Expand Down Expand Up @@ -4535,7 +4535,7 @@ pub const Source = struct {
};
const total = reply_state.total();
std.debug.assert(reply_state.taken + n <= total);
const data = try source.reader.take(n);
const data = try source.reader.take(@intCast(n));
reply_state.taken += @intCast(data.len);
if (reply_state.taken == total) {
source.state = .kind;
Expand Down
5 changes: 4 additions & 1 deletion src/x/draft.zig
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ pub fn readSetupDynamic(
}
const vendor_written = old_remaining - source.replyRemainingSize();
const vendor_remaining = setup.vendor_len - vendor_written;
try source.replyDiscard(vendor_remaining + x11.pad4Len(@truncate(setup.vendor_len)));
const vendor_remaining_bytes: usize = @intCast(
vendor_remaining + x11.pad4Len(@truncate(setup.vendor_len)),
);
try source.replyDiscard(vendor_remaining_bytes);
}

for (0..setup.format_count) |index| {
Expand Down