Skip to content

Commit aa79fdb

Browse files
fix: windows build (uint16_t -> unsigned int)
1 parent e57bb85 commit aa79fdb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

generate_cffi_definitions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,18 @@ def fix_windows_type_compatibility(cdef_content):
628628
# Target simple field declarations in structs
629629
(r"(\s+)uint8_t\s+(\w+);", r"\1char \2;"),
630630
(r"(\s+)int8_t\s+(\w+);", r"\1char \2;"),
631+
# Target uint16_t fields in structs for Windows compatibility (not function parameters)
632+
(r"^(\s+)uint16_t\s+(\w+);", r"\1unsigned int \2;"),
631633
]
632634

633635
for pattern, replacement in replacements:
634-
cdef_content = re.sub(pattern, replacement, cdef_content)
636+
cdef_content = re.sub(
637+
pattern, replacement, cdef_content, flags=re.MULTILINE
638+
)
635639

636640
print(
637-
"Converted specific uint8_t and int8_t fields to "
638-
"char for Windows CFFI compatibility"
641+
"Converted specific uint8_t, int8_t, and uint16_t fields to "
642+
"char and unsigned int for Windows CFFI compatibility"
639643
)
640644
else:
641645
print("Non-Windows platform - keeping original types")

0 commit comments

Comments
 (0)