If just data increment the pointer if not handle the items with
a loop.

Signed-off-by: Frediano Ziglio <fzig...@redhat.com>
---
 python_modules/dissector.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/python_modules/dissector.py b/python_modules/dissector.py
index c9331cd..6e9f0d6 100644
--- a/python_modules/dissector.py
+++ b/python_modules/dissector.py
@@ -227,6 +227,20 @@ def write_switch(writer, container, switch, dest, scope):
 def write_array(writer, container, member, nelements, array, dest, scope):
     assert(container and member)
 
+    element_type = array.element_type
+
+    if element_type == ptypes.uint8 or element_type == ptypes.int8:
+        writer.increment("offset", nelements)
+        return
+
+    with writer.index() as index:
+        with writer.for_loop(index, nelements) as array_scope:
+            if element_type.is_primitive():
+                write_member_primitive(writer, container, member, 
element_type, dest, scope)
+            else:
+                assert(element_type.is_struct())
+                write_struct(writer, member, element_type, index, dest, scope)
+
 def write_pointer(writer, container, member, t, dest, scope):
     assert(t.is_pointer())
 
@@ -245,7 +259,6 @@ def write_struct_func(writer, t, func_name, index):
     writer.statement('return offset')
     writer.end_block()
 
-
 def write_struct(writer, member, t, index, dest, scope):
     assert(t.is_struct())
 
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to