summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-04-15 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2018-04-15 17:01:04 +0200
commitc6646852cd8638d1363ca915bfc2862b4666e067 (patch)
tree7f6931c5b92f9284461b1c0452af8116bf1ddce8 /giscanner/maintransformer.py
parentb010c1241227201581841122912f307d2311455a (diff)
downloadgobject-introspection-c6646852cd8638d1363ca915bfc2862b4666e067.tar.gz
Use uint8 as default element type when constructing ByteArray.
Fixes issue #184.
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r--giscanner/maintransformer.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index e5e77338..4f6db545 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -361,14 +361,11 @@ class MainTransformer(object):
message.warn("invalid (element-type) for a GPtrArray, "
"must be a pointer", annotations.position)
- # GByteArrays have (element-type) guint8 by default
- if array_type == ast.Array.GLIB_BYTEARRAY:
- if element_type == ast.TYPE_ANY:
- array.element_type = ast.TYPE_UINT8
- elif element_type not in [ast.TYPE_UINT8, ast.TYPE_INT8, ast.TYPE_CHAR]:
- message.warn("invalid (element-type) for a GByteArray, "
- "must be one of guint8, gint8 or gchar",
- annotations.position)
+ if (array_type == ast.Array.GLIB_BYTEARRAY
+ and element_type not in [ast.TYPE_UINT8, ast.TYPE_INT8, ast.TYPE_CHAR]):
+ message.warn("invalid (element-type) for a GByteArray, "
+ "must be one of guint8, gint8 or gchar",
+ annotations.position)
def _apply_annotations_array(self, parent, node, annotations):
element_type_options = annotations.get(ANN_ELEMENT_TYPE)