Skip to content

Commit d1be2b7

Browse files
committed
Fixes after Zig v0.14.0 release
1 parent 5d288dc commit d1be2b7

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

build.zig.zon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.{
2-
.name = "maxminddb",
2+
.name = .maxminddb,
33
.version = "0.0.0",
4+
.fingerprint = 0x9ea10897ba27121c,
45
.paths = .{
56
"build.zig",
67
"build.zig.zon",

src/decoder.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ pub const Decoder = struct {
164164
// We support Structs or Optional Structs only to safely decode arrays and hashmaps.
165165
comptime var DecodedType: type = T;
166166
switch (@typeInfo(DecodedType)) {
167-
.Struct => {},
168-
.Optional => |opt| {
167+
.@"struct" => {},
168+
.optional => |opt| {
169169
DecodedType = opt.child;
170170
switch (@typeInfo(DecodedType)) {
171-
.Struct => {},
171+
.@"struct" => {},
172172
else => {
173173
std.debug.print("expected field {any} got optional {any}\n", .{ field, DecodedType });
174174
return DecodeError.UnsupportedFieldType;

src/mmap.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ pub fn map(f: std.fs.File) ![]u8 {
55
// see https://github.com/ziglang/zig/pull/21083.
66

77
const file_size = (try f.stat()).size;
8-
const aligned_file_size = std.mem.alignForward(usize, file_size, std.mem.page_size);
8+
const page_size = std.heap.pageSize();
9+
const aligned_file_size = std.mem.alignForward(usize, file_size, page_size);
910
const src = try std.posix.mmap(
1011
null,
1112
aligned_file_size,
@@ -19,6 +20,7 @@ pub fn map(f: std.fs.File) ![]u8 {
1920
}
2021

2122
pub fn unmap(src: []u8) void {
22-
const aligned_src_len = std.mem.alignForward(usize, src.len, std.mem.page_size);
23+
const page_size = std.heap.pageSize();
24+
const aligned_src_len = std.mem.alignForward(usize, src.len, page_size);
2325
std.posix.munmap(@alignCast(src.ptr[0..aligned_src_len]));
2426
}

src/reader.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ fn Iterator(comptime T: type) type {
324324
};
325325

326326
pub fn next(self: *Self) !?Item {
327-
while (self.stack.popOrNull()) |current| {
327+
while (self.stack.pop()) |current| {
328328
const reader = self.reader;
329329
const bit_count = current.ip_bytes.bitCount();
330330

0 commit comments

Comments
 (0)