Skip to content

Commit 7a68ed1

Browse files
committed
fix all types
1 parent e143171 commit 7a68ed1

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/ros2cs/rosidl_generator_cs/resource/msg.cs.em

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,7 @@ public class @(message_class) : @(internals_interface), @(parent_interface)
336336
int arraySize = 0;
337337
IntPtr pArr = native_read_field_@(member.name)(out arraySize, handle);
338338
@(get_field_name(member.type, member.name, message_class)) = new @(get_dotnet_type(member.type.value_type))[arraySize];
339-
@[ if (get_marshal_array_type(member.type)) == 'char']@
340-
byte[] __@(get_field_name(member.type, member.name, message_class)) = new byte[arraySize];
341-
@[ else]@
342339
@(get_marshal_array_type(member.type))[] __@(get_field_name(member.type, member.name, message_class)) = new @(get_marshal_array_type(member.type))[arraySize];
343-
@[ end if]@
344340
if (arraySize != 0)
345341
{
346342
int start = 0;

src/ros2cs/rosidl_generator_cs/rosidl_generator_cs/generate_cs_impl.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ def get_c_type(type_):
8080
BASIC_IDL_TYPES_TO_MARSHAL = {
8181
'float': 'R4',
8282
'double': 'R8',
83-
'long double': 'R8',
84-
'char': 'I1',
85-
'wchar': 'I2',
83+
'char': 'U1',
84+
'wchar': 'U4',
8685
'boolean': 'I1',
8786
'octet': 'U1',
8887
'uint8': 'U1',
@@ -93,6 +92,7 @@ def get_c_type(type_):
9392
'int32': 'I4',
9493
'uint64': 'U8',
9594
'int64': 'I8',
95+
# 'long double' is NotSupported
9696
}
9797

9898

@@ -105,21 +105,21 @@ def get_marshal_type(type_):
105105

106106

107107
BASIC_IDL_TYPES_TO_MARSHAL_ARRAY = {
108+
'uint64': 'ulong',
108109
'float': 'float',
109110
'double': 'double',
110-
'long double': 'double',
111-
'char': 'char',
112-
'wchar': 'short',
113-
'boolean': 'byte',
111+
'char': 'byte',
112+
'wchar': 'uint',
114113
'octet': 'byte',
114+
'boolean': 'bool',
115+
'int8': 'sbyte',
115116
'uint8': 'byte',
116-
'int8': 'char',
117-
'uint16': 'short',
118117
'int16': 'short',
119-
'uint32': 'int',
118+
'uint16': 'ushort',
120119
'int32': 'int',
121-
'uint64': 'long',
120+
'uint32': 'uint',
122121
'int64': 'long',
122+
# 'long double' is NotSupported
123123
}
124124

125125

@@ -130,13 +130,11 @@ def get_marshal_array_type(type_):
130130
return BASIC_IDL_TYPES_TO_MARSHAL_ARRAY[type_.value_type.typename]
131131
assert False, "unsupported marshal array type '%s'" % type_
132132

133-
134133
BASIC_IDL_TYPES_TO_DOTNET = {
135134
'float' : 'float',
136135
'double' : 'double',
137-
'long double': 'double',
138-
'char' : 'char',
139-
'wchar' : 'ushort',
136+
'char' : 'byte',
137+
'wchar' : 'uint',
140138
'boolean' : 'bool',
141139
'octet' : 'byte',
142140
'uint8' : 'byte',
@@ -147,6 +145,7 @@ def get_marshal_array_type(type_):
147145
'int32' : 'int',
148146
'uint64' : 'ulong',
149147
'int64' : 'long',
148+
# 'long double' is NotSupported
150149
}
151150

152151

0 commit comments

Comments
 (0)