zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 59bd296328ec290c5e00948003d98e83bf54a047 (tree)
parent dd4ca88ca7a350189a27beb272e9869d2be0026e
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sun, 11 Dec 2022 01:24:10 -0700

std.build.InstallRawStep: fix compilation on wasm32-wasi

Diffstat:
Mlib/std/build/InstallRawStep.zig | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/std/build/InstallRawStep.zig b/lib/std/build/InstallRawStep.zig @@ -26,7 +26,7 @@ const BinaryElfSegment = struct { virtualAddress: u64, elfOffset: u64, binaryOffset: u64, - fileSize: usize, + fileSize: u64, firstSection: ?*BinaryElfSection, }; @@ -69,7 +69,7 @@ const BinaryElfOutput = struct { const shstrtab_shdr = (try section_headers.next()).?; - const buffer = try allocator.alloc(u8, shstrtab_shdr.sh_size); + const buffer = try allocator.alloc(u8, @intCast(usize, shstrtab_shdr.sh_size)); errdefer allocator.free(buffer); const num_read = try elf_file.preadAll(buffer, shstrtab_shdr.sh_offset); @@ -301,7 +301,7 @@ const HexWriter = struct { const row_address = @intCast(u32, segment.physicalAddress + bytes_read); const remaining = segment.fileSize - bytes_read; - const to_read = @min(remaining, MAX_PAYLOAD_LEN); + const to_read = @intCast(usize, @min(remaining, MAX_PAYLOAD_LEN)); const did_read = try elf_file.preadAll(buf[0..to_read], segment.elfOffset + bytes_read); if (did_read < to_read) return error.UnexpectedEOF;