Skip to content

Commit 02387a6

Browse files
committed
add new data types
1 parent 8983228 commit 02387a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cstruct/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ def print_info(self):
121121
'signed char': 'b',
122122
'unsigned char': 'B',
123123
'short': 'h',
124+
'short int': 'h',
124125
'ushort': 'H',
125126
'unsigned short': 'H',
127+
'unsigned short int': 'H',
126128
'int': 'i',
127129
'unsigned int': 'I',
128130
'long': 'l',
131+
'long int': 'l',
129132
'unsigned long': 'L',
133+
'unsigned long int': 'L',
130134
'long long': 'q',
131135
'unsigned long long': 'Q',
132136
'float': 'f',
@@ -204,9 +208,9 @@ def parse_struct(st):
204208
vtype = vtype + " " + line[1].strip()
205209
del line[0]
206210
vname = line[1]
207-
# long long
208-
if vname == 'long':
209-
vtype = vtype + ' long'
211+
# short int, long int, or long long
212+
if vname == 'int' or vname == 'long':
213+
vtype = vtype + " " + vname
210214
del line[0]
211215
vname = line[1]
212216
# void *

0 commit comments

Comments
 (0)