commit ddd2cd73307c06906a8d120b41fd5ab8864797a1 (tree)
parent 264f5f4544fc87330d328d1aea96a27934738368
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Thu, 24 Jun 2021 23:34:22 +0200
zld: fix Dylib.Id parsing logic for string values
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git 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;