From e011e342420fe1f1f5d2fee932447b194f989032 Mon Sep 17 00:00:00 2001 From: Tesseract22 Date: Sat, 9 Aug 2025 18:57:19 +0800 Subject: chore: update to zig 0.15 Everything other than loadextension works. zig 0.15 remove usingnamespac, so tha whole mechanism has to be reworked, and idk how --- build/Preprocessor.zig | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'build') diff --git a/build/Preprocessor.zig b/build/Preprocessor.zig index a069523..f3d0dc6 100644 --- a/build/Preprocessor.zig +++ b/build/Preprocessor.zig @@ -27,10 +27,10 @@ const mem = std.mem; fn readOriginalData(allocator: mem.Allocator, path: []const u8) ![]const u8 { var file = try std.fs.cwd().openFile(path, .{}); defer file.close(); + var buf: [1024]u8 = undefined; + var reader = file.reader(&buf); - var reader = file.reader(); - - const data = reader.readAllAlloc(allocator, 1024 * 1024); + const data = reader.interface.readAlloc(allocator, 1024 * 1024); return data; } @@ -127,13 +127,13 @@ const Processor = struct { switch (range) { .delete => |dr| { const to_write = self.data[pos..dr.start]; - try writer.writeAll(to_write); + try writer.interface.writeAll(to_write); pos = dr.end; }, .replace => |rr| { const to_write = self.data[pos..rr.start]; - try writer.writeAll(to_write); - try writer.writeAll(rr.replacement); + try writer.interface.writeAll(to_write); + try writer.interface.writeAll(rr.replacement); pos = rr.end; }, } @@ -148,7 +148,7 @@ const Processor = struct { // Finally append the remaining data in the buffer (the last range will probably not be the end of the file) if (pos < self.data.len) { const remaining_data = self.data[pos..]; - try writer.writeAll(remaining_data); + try writer.interface.writeAll(remaining_data); } } }; @@ -196,7 +196,9 @@ pub fn sqlite3(allocator: mem.Allocator, input_path: []const u8, output_path: [] defer output_file.close(); try output_file.writeAll("/* sqlite3.h edited by the zig-sqlite build script */\n"); - try processor.dump(output_file.writer()); + var buf: [1024]u8 = undefined; + var out_writer = output_file.writer(&buf); + try processor.dump(&out_writer); } pub fn sqlite3ext(allocator: mem.Allocator, input_path: []const u8, output_path: []const u8) !void { @@ -232,5 +234,7 @@ pub fn sqlite3ext(allocator: mem.Allocator, input_path: []const u8, output_path: defer output_file.close(); try output_file.writeAll("/* sqlite3ext.h edited by the zig-sqlite build script */\n"); - try processor.dump(output_file.writer()); + var buf: [1024]u8 = undefined; + var out_writer = output_file.writer(&buf); + try processor.dump(&out_writer); } -- cgit v1.2.3