diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-19 12:02:05 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-19 12:06:28 +0200 |
commit | 201e0cea5fa9747ebd57e7da35c91f131d51bcf8 (patch) | |
tree | e983a4a2b81e29eca8b57a00f0dac5fcb179631d /build-aux | |
parent | 7345ca6aaf57c39eda83650e5d7f87e2d66f5be3 (diff) |
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"
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/qmi-codegen/VariableString.py | 11 |
1 files changed, 7 insertions, 4 deletions
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 @@ class VariableString(Variable): # 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 |