make add_qvariantmap work more?
This commit is contained in:
parent
616e8015c4
commit
cbd70cc74e
|
@ -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 {
|
pub fn add_qvariantmap(writer: anytype, map: std.StringHashMap(qvar.QVariant)) @TypeOf(writer).Error!void {
|
||||||
var size: u32 = 0;
|
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(.{ .string = entry.key });
|
||||||
size += try qvar.qvariant_size(entry.value);
|
size += try qvar.qvariant_size(entry.value);
|
||||||
size += 4;
|
size += 4;
|
||||||
|
@ -82,7 +82,10 @@ pub fn add_qvariantmap(writer: anytype, map: std.StringHashMap(qvar.QVariant)) @
|
||||||
try add_byte(writer, 1);
|
try add_byte(writer, 1);
|
||||||
try add_int(writer, map.count());
|
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_string(writer, entry.key);
|
||||||
try add_qvariant(writer, entry.value);
|
try add_qvariant(writer, entry.value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue