[Spice-devel] [PATCH spice-common 6/7] codegen: Check wrong attribute

Frediano Ziglio fziglio at redhat.com
Mon Feb 18 16:01:28 UTC 2019


@ptr_array is supposed to change the destination to an array
of pointer to items. This for a raw buffer does not make sense
but check if user specifies this combination.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 python_modules/demarshal.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 68532a9..50cf6c4 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -810,6 +810,8 @@ def write_array_parser(writer, member, nelements, array, dest, scope):
         at_end = True
 
     if element_type == ptypes.uint8 or element_type == ptypes.int8:
+        if array.has_attr("ptr_array"):
+            raise Exception("Attribute ptr_array not supported for array or int8/uint8")
         writer.statement("memcpy(%s, in, %s)" % (array_start, nelements))
         writer.increment("in", nelements)
         if at_end:
-- 
2.20.1



More information about the Spice-devel mailing list