aboutsummaryrefslogtreecommitdiff
path: root/bindgen
diff options
context:
space:
mode:
authorMatheus Catarino <matheus-catarino@hotmail.com>2025-06-03 16:19:27 -0300
committerMatheus Catarino <matheus-catarino@hotmail.com>2025-06-03 16:19:27 -0300
commitcf03048c5a8d766ad3164374894208a9e9156aaf (patch)
tree8843f93aa2417af3155b61a3e6fdc7a23c092906 /bindgen
parent5a16a63e278fd7504f235fc654821ea11fa31e56 (diff)
fix prim_types array
Diffstat (limited to 'bindgen')
-rw-r--r--bindgen/gen_d.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/bindgen/gen_d.py b/bindgen/gen_d.py
index 569ac628..d98d0385 100644
--- a/bindgen/gen_d.py
+++ b/bindgen/gen_d.py
@@ -311,9 +311,10 @@ def gen_struct(decl, type_converter):
elif util.is_array_type(field_type):
array_type = util.extract_array_type(field_type)
array_sizes = util.extract_array_sizes(field_type)
- if array_type in prim_types and array_sizes and len(array_sizes) == 1:
+ if array_type in prim_types and array_sizes:
+ # Handle all primitive arrays with proper defaults
default_value = f" = [{', '.join([prim_defaults[array_type]] * int(array_sizes[0]))}]"
- elif array_type in type_converter.struct_types or array_type in type_converter.enum_types or len(array_sizes) > 1:
+ elif array_type in type_converter.struct_types or array_type in type_converter.enum_types:
default_value = " = []"
else:
default_value = " = null"