| ... | @@ -94,20 +94,20 @@ pub const Id = struct { | ... | @@ -94,20 +94,20 @@ pub const Id = struct { |
| 94 | var values: [3][]const u8 = undefined; | 94 | var values: [3][]const u8 = undefined; |
| 95 | | 95 | |
| 96 | var split = mem.split(string, "."); | 96 | var split = mem.split(string, "."); |
| 97 | var i: u4 = 0; | 97 | var count: u4 = 0; |
| 98 | while (split.next()) |value| { | 98 | while (split.next()) |value| { |
| 99 | if (i > 2) { | 99 | if (count > 2) { |
| 100 | log.warn("malformed version field: {s}", .{string}); | 100 | log.warn("malformed version field: {s}", .{string}); |
| 101 | return 0x10000; | 101 | return 0x10000; |
| 102 | } | 102 | } |
| 103 | values[i] = value; | 103 | values[count] = value; |
| 104 | i += 1; | 104 | count += 1; |
| 105 | } | 105 | } |
| 106 | | 106 | |
| 107 | if (values.len > 2) { | 107 | if (count > 2) { |
| 108 | out += try fmt.parseInt(u8, values[2], 10); | 108 | out += try fmt.parseInt(u8, values[2], 10); |
| 109 | } | 109 | } |
| 110 | if (values.len > 1) { | 110 | if (count > 1) { |
| 111 | out += @intCast(u32, try fmt.parseInt(u8, values[1], 10)) << 8; | 111 | out += @intCast(u32, try fmt.parseInt(u8, values[1], 10)) << 8; |
| 112 | } | 112 | } |
| 113 | out += @intCast(u32, try fmt.parseInt(u16, values[0], 10)) << 16; | 113 | out += @intCast(u32, try fmt.parseInt(u16, values[0], 10)) << 16; |