fmt code.

This commit is contained in:
Kitteh 2021-06-04 17:48:50 +01:00
parent 1ec3cfb28f
commit 67c9353455
35 changed files with 48 additions and 42 deletions

View file

@ -6,7 +6,6 @@ const prettyPrintQVariant = @import("./qtshit/utils/prettyPrintQVariant.zig").pr
const freeQVariant = @import("./qtshit/utils/free/freeQVariant.zig").freeQVariant; const freeQVariant = @import("./qtshit/utils/free/freeQVariant.zig").freeQVariant;
const QVariantMapToQVariantList = @import("./qtshit/utils/QVariantMapToQVariantList.zig").QVariantMapToQVariantList; const QVariantMapToQVariantList = @import("./qtshit/utils/QVariantMapToQVariantList.zig").QVariantMapToQVariantList;
fn dumpDebug(name: []const u8, list: std.ArrayList(u8)) !void { fn dumpDebug(name: []const u8, list: std.ArrayList(u8)) !void {
std.debug.print("dumpDebug list len {d}\n", .{list.items.len}); std.debug.print("dumpDebug list len {d}\n", .{list.items.len});

View file

@ -26,7 +26,18 @@ pub fn readString(reader: anytype, allocator: *std.mem.Allocator) (@TypeOf(reade
} }
test "deserialize String" { test "deserialize String" {
var bytes = &[_]u8{ 0, 0, 0, 6, 0, 111, 0, 119, 0, 111, }; var bytes = &[_]u8{
0,
0,
0,
6,
0,
111,
0,
119,
0,
111,
};
var fBS = std.io.fixedBufferStream(bytes); var fBS = std.io.fixedBufferStream(bytes);
var str = try readString(fBS.reader(), std.testing.allocator); var str = try readString(fBS.reader(), std.testing.allocator);
@ -34,4 +45,3 @@ test "deserialize String" {
try std.testing.expectEqualStrings("owo", str); try std.testing.expectEqualStrings("owo", str);
} }

View file

@ -10,7 +10,6 @@ const readQVariantMap = @import("../readQVariantMap.zig").readQVariantMap;
const readBufferInfo = @import("./readBufferInfo.zig").readBufferInfo; const readBufferInfo = @import("./readBufferInfo.zig").readBufferInfo;
const readMessage = @import("./readMessage.zig").readMessage; const readMessage = @import("./readMessage.zig").readMessage;
pub fn readUserType(reader: anytype, allocator: *std.mem.Allocator) !UserType { pub fn readUserType(reader: anytype, allocator: *std.mem.Allocator) !UserType {
var userTypeName = try readQByteArray(reader, allocator); var userTypeName = try readQByteArray(reader, allocator);
userTypeName = userTypeName[0 .. userTypeName.len - 1]; userTypeName = userTypeName[0 .. userTypeName.len - 1];

View file

@ -7,7 +7,6 @@ const freeQByteArray = @import("./freeQByteArray.zig").freeQByteArray;
const freeString = @import("./freeString.zig").freeString; const freeString = @import("./freeString.zig").freeString;
const freeUserType = @import("./freeUserType.zig").freeUserType; const freeUserType = @import("./freeUserType.zig").freeUserType;
pub fn freeQVariant(variant: QVariant, allocator: *std.mem.Allocator) void { pub fn freeQVariant(variant: QVariant, allocator: *std.mem.Allocator) void {
switch (variant) { switch (variant) {
.Byte, .Int, .UInt, .Short, .QDateTime => { .Byte, .Int, .UInt, .Short, .QDateTime => {

View file

@ -4,7 +4,6 @@ const writeString = @import("./writeString.zig").writeString;
const writeUInt = @import("./writeUInt.zig").writeUInt; const writeUInt = @import("./writeUInt.zig").writeUInt;
const writeQVariant = @import("./writeQVariant.zig").writeQVariant; const writeQVariant = @import("./writeQVariant.zig").writeQVariant;
pub fn writeQVariantMap(writer: anytype, allocator: *std.mem.Allocator, map: std.StringHashMap(QVariantType)) !void { pub fn writeQVariantMap(writer: anytype, allocator: *std.mem.Allocator, map: std.StringHashMap(QVariantType)) !void {
var data = std.ArrayList(u8).init(allocator); var data = std.ArrayList(u8).init(allocator);
defer data.deinit(); defer data.deinit();