diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-06-24 23:34:22 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-06-24 23:34:31 +0200 |
| commit | ddd2cd73307c06906a8d120b41fd5ab8864797a1 (patch) | |
| tree | 8c0f8fe31061a60db637ffc9120f800a0379beb1 /src | |
| parent | 264f5f4544fc87330d328d1aea96a27934738368 (diff) | |
| download | zig-ddd2cd73307c06906a8d120b41fd5ab8864797a1.tar.gz zig-ddd2cd73307c06906a8d120b41fd5ab8864797a1.zip | |
zld: fix Dylib.Id parsing logic for string values
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO/Dylib.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index 737c83f2f9..e91ff30ad2 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -94,20 +94,20 @@ pub const Id = struct { var values: [3][]const u8 = undefined; var split = mem.split(string, "."); - var i: u4 = 0; + var count: u4 = 0; while (split.next()) |value| { - if (i > 2) { + if (count > 2) { log.warn("malformed version field: {s}", .{string}); return 0x10000; } - values[i] = value; - i += 1; + values[count] = value; + count += 1; } - if (values.len > 2) { + if (count > 2) { out += try fmt.parseInt(u8, values[2], 10); } - if (values.len > 1) { + if (count > 1) { out += @intCast(u32, try fmt.parseInt(u8, values[1], 10)) << 8; } out += @intCast(u32, try fmt.parseInt(u16, values[0], 10)) << 16; |
