make add_qvariantmap work more?

This commit is contained in:
Kitteh 2021-06-02 12:48:27 +01:00
parent 616e8015c4
commit cbd70cc74e

View file

@ -69,9 +69,9 @@ pub fn add_qvariant(writer: anytype, variant: 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();
var sizeIterator = map.iterator();
while (iterator.next()) |entry| {
while (sizeIterator.next()) |entry| {
size += try qvar.qvariant_size(.{ .string = entry.key });
size += try qvar.qvariant_size(entry.value);
size += 4;
@ -82,7 +82,10 @@ pub fn add_qvariantmap(writer: anytype, map: std.StringHashMap(qvar.QVariant)) @
try add_byte(writer, 1);
try add_int(writer, map.count());
while (iterator.next()) |entry| {
var writeIterator = map.iterator();
while (writeIterator.next()) |entry| {
try add_string(writer, entry.key);
try add_qvariant(writer, entry.value);
}