| ... | @@ -26,7 +26,7 @@ const BinaryElfSegment = struct { | ... | @@ -26,7 +26,7 @@ const BinaryElfSegment = struct { |
| 26 | virtualAddress: u64, | 26 | virtualAddress: u64, |
| 27 | elfOffset: u64, | 27 | elfOffset: u64, |
| 28 | binaryOffset: u64, | 28 | binaryOffset: u64, |
| 29 | fileSize: usize, | 29 | fileSize: u64, |
| 30 | firstSection: ?*BinaryElfSection, | 30 | firstSection: ?*BinaryElfSection, |
| 31 | }; | 31 | }; |
| 32 | | 32 | |
| ... | @@ -69,7 +69,7 @@ const BinaryElfOutput = struct { | ... | @@ -69,7 +69,7 @@ const BinaryElfOutput = struct { |
| 69 | | 69 | |
| 70 | const shstrtab_shdr = (try section_headers.next()).?; | 70 | const shstrtab_shdr = (try section_headers.next()).?; |
| 71 | | 71 | |
| 72 | const buffer = try allocator.alloc(u8, shstrtab_shdr.sh_size); | 72 | const buffer = try allocator.alloc(u8, @intCast(usize, shstrtab_shdr.sh_size)); |
| 73 | errdefer allocator.free(buffer); | 73 | errdefer allocator.free(buffer); |
| 74 | | 74 | |
| 75 | const num_read = try elf_file.preadAll(buffer, shstrtab_shdr.sh_offset); | 75 | const num_read = try elf_file.preadAll(buffer, shstrtab_shdr.sh_offset); |
| ... | @@ -301,7 +301,7 @@ const HexWriter = struct { | ... | @@ -301,7 +301,7 @@ const HexWriter = struct { |
| 301 | const row_address = @intCast(u32, segment.physicalAddress + bytes_read); | 301 | const row_address = @intCast(u32, segment.physicalAddress + bytes_read); |
| 302 | | 302 | |
| 303 | const remaining = segment.fileSize - bytes_read; | 303 | const remaining = segment.fileSize - bytes_read; |
| 304 | const to_read = @min(remaining, MAX_PAYLOAD_LEN); | 304 | const to_read = @intCast(usize, @min(remaining, MAX_PAYLOAD_LEN)); |
| 305 | const did_read = try elf_file.preadAll(buf[0..to_read], segment.elfOffset + bytes_read); | 305 | const did_read = try elf_file.preadAll(buf[0..to_read], segment.elfOffset + bytes_read); |
| 306 | if (did_read < to_read) return error.UnexpectedEOF; | 306 | if (did_read < to_read) return error.UnexpectedEOF; |
| 307 | | 307 | |