diff --git a/src/client.zig b/src/client.zig index ab2129b..2d52b2e 100644 --- a/src/client.zig +++ b/src/client.zig @@ -4,14 +4,15 @@ const write = @import("./qtshit/write.zig"); const qvar = @import("./qtshit/qvariant.zig"); fn dumpDebug(name: []const u8, list: std.ArrayList(u8)) !void { + std.debug.print("dumpDebug list len {d}\n", .{list.items.len}); + const file = try std.fs.cwd().createFile( name, - .{ .read = true }, + .{ .read = !true }, ); defer file.close(); try file.writeAll(list.items); - try file.seekTo(0); } pub const Client = struct { @@ -49,8 +50,7 @@ pub const Client = struct { try map.put("ClientVersion", .{ .string = "0.1 (quasselclient)" }); try map.put("ClientDate", .{ .string = "0" }); - try write.add_qvariantmap(list.writer(), map); - + try write.add_qvariantmap(list.writer(), map); try dumpDebug("ClientInit.bin", list); try s.stream.writer().writeAll(list.items); diff --git a/src/qtshit/write.zig b/src/qtshit/write.zig index ea20e09..4ec4044 100644 --- a/src/qtshit/write.zig +++ b/src/qtshit/write.zig @@ -66,7 +66,7 @@ pub fn add_qvariant(writer: anytype, variant: qvar.QVariant) !void { } } -pub fn add_qvariantmap(writer: anytype, map: std.StringHashMap(qvar.QVariant)) !void { +pub fn add_qvariantmap(writer: anytype, map: std.StringHashMap(qvar.QVariant)) @TypeOf(writer).Error!void { var size: u32 = 0; var iterator = map.iterator();