qmi-codegen: for strings, use 'size-prefix-format' instead of 'length-prefix-size'
Use the new 'size-prefix-format' property to specify whether the length prefix
variable is a 'guint8' or a 'guint16'.
We therefore consolidate the way how this length prefix variable is specified in
both arrays and strings.
So, instead of:
"length-prefix-size" : "16"
We now just do:
"size-prefix-format" : "guint16"
diff --git a/build-aux/qmi-codegen/VariableString.py b/build-aux/qmi-codegen/VariableString.py
index 5be84e2..7e977c2 100644
--- a/build-aux/qmi-codegen/VariableString.py
+++ b/build-aux/qmi-codegen/VariableString.py
@@ -53,10 +53,13 @@
# length prefix
if 'type' in dictionary and dictionary['type'] == 'TLV':
self.length_prefix_size = 0
- elif 'length-prefix-size' in dictionary:
- self.length_prefix_size = dictionary['length-prefix-size']
- if self.length_prefix_size not in ['8', '16']:
- raise ValueError('Invalid length prefix size %s: not 8 or 16' % self.length_prefix_size)
+ elif 'size-prefix-format' in dictionary:
+ if dictionary['size-prefix-format'] == 'guint8':
+ self.length_prefix_size = 8
+ elif dictionary['size-prefix-format'] == 'guint16':
+ self.length_prefix_size = 16
+ else:
+ raise ValueError('Invalid size prefix format (%s): not guint8 or guint16' % dictionary['size-prefix-format'])
else:
# Default to UINT8
self.length_prefix_size = 8