summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-02 13:42:10 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-20 15:25:56 +0100
commit36ea49b68619a0d35c2887a1c7a3960dbc4d4fed (patch)
tree02f1081d7eb0768148ef063d150c5fe3ca6c128a
parentce59cc14167979a54f5846a59d58db132f4c6048 (diff)
downloadspice-protocol-36ea49b68619a0d35c2887a1c7a3960dbc4d4fed.tar.gz
spice-protocol-36ea49b68619a0d35c2887a1c7a3960dbc4d4fed.tar.xz
spice-protocol-36ea49b68619a0d35c2887a1c7a3960dbc4d4fed.zip
demarshal: fixed-size array are missing __nelements
A message with a fixed-size array, such as uint8 uuid[16] will generate an invalid code, missing the __nelements variable. Make sure that variable is defined.
-rw-r--r--python_modules/demarshal.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 3a0178e..541735a 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -664,7 +664,7 @@ def read_array_len(writer, prefix, array, dest, scope, is_ptr):
nelements = "%s__array__nelements" % prefix
else:
nelements = "%s__nelements" % prefix
- if dest.is_toplevel():
+ if dest.is_toplevel() and scope.variable_defined(nelements):
return nelements # Already there for toplevel, need not recalculate
element_type = array.element_type
scope.variable_def("uint32_t", nelements)