Skip to content

Commit

Permalink
macho: replace readStructBig with readStructEndian
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jan 23, 2024
1 parent aee192a commit 706065e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/MachO/fat.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const MachO = @import("../MachO.zig");

pub fn isFatLibrary(file: std.fs.File) bool {
const reader = file.reader();
const hdr = reader.readStructBig(macho.fat_header) catch return false;
const hdr = reader.readStructEndian(macho.fat_header, .big) catch return false;
defer file.seekTo(0) catch {};
return hdr.magic == macho.FAT_MAGIC;
}
Expand All @@ -23,13 +23,13 @@ pub const Arch = struct {

pub fn parseArchs(file: std.fs.File, buffer: *[2]Arch) ![]const Arch {
const reader = file.reader();
const fat_header = try reader.readStructBig(macho.fat_header);
const fat_header = try reader.readStructEndian(macho.fat_header, .big);
assert(fat_header.magic == macho.FAT_MAGIC);

var count: usize = 0;
var fat_arch_index: u32 = 0;
while (fat_arch_index < fat_header.nfat_arch) : (fat_arch_index += 1) {
const fat_arch = try reader.readStructBig(macho.fat_arch);
const fat_arch = try reader.readStructEndian(macho.fat_arch, .big);
// If we come across an architecture that we do not know how to handle, that's
// fine because we can keep looking for one that might match.
const arch: std.Target.Cpu.Arch = switch (fat_arch.cputype) {
Expand Down

0 comments on commit 706065e

Please sign in to comment.