From b35d5894563ff7fd0fdea2b85030317ead2bb7ec Mon Sep 17 00:00:00 2001 From: Kitteh Date: Wed, 2 Jun 2021 17:49:46 +0100 Subject: [PATCH] strings work maybe again? --- src/qtshit/read.zig | 2 +- src/qtshit/write.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qtshit/read.zig b/src/qtshit/read.zig index fa681e3..152f189 100644 --- a/src/qtshit/read.zig +++ b/src/qtshit/read.zig @@ -37,7 +37,7 @@ pub fn get_string(reader: anytype, allocator: *std.mem.Allocator) ![]u8 { defer data.deinit(); var length = try reader.readIntBig(i32); - var chars = @divTrunc(@divTrunc(length, 8), 2); + var chars = @divTrunc(length, 2); // std.debug.print("get_lenchars: {d} {d} \n", .{length, chars}); diff --git a/src/qtshit/write.zig b/src/qtshit/write.zig index f5167a0..1119908 100644 --- a/src/qtshit/write.zig +++ b/src/qtshit/write.zig @@ -26,7 +26,7 @@ pub fn add_string(writer: anytype, allocator: *std.mem.Allocator, str: []const u } // std.debug.print("add_lenchars: {d} {d} \n", .{@intCast(i32, ut16Str.len*8*2), str.len}); - try writer.writeIntBig(i32, @intCast(i32, ut16Str.len*8*2)); + try writer.writeIntBig(i32, @intCast(i32, ut16Str.len*2)); try writer.writeAll(std.mem.sliceAsBytes(ut16Str)); }