summaryrefslogtreecommitdiff
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
commit71faf12d810cfebfc066fffa912ccdd173cf8764 (patch)
tree4f2f85fb21bc0d592d64771a2923ff7e24b597d9
parent5d02123499ff68f8584384aac7b7a715a3a76a1b (diff)
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)