diff --git a/rosidl_generator_c/msg/PrimitiveValues.msg b/rosidl_generator_c/msg/PrimitiveValues.msg index 7a14ebd0f..b803e7bef 100644 --- a/rosidl_generator_c/msg/PrimitiveValues.msg +++ b/rosidl_generator_c/msg/PrimitiveValues.msg @@ -1,7 +1,7 @@ bool def_bool_1 true bool def_bool_2 false byte def_byte 66 -char def_char 67 +char def_char -66 float32 def_float32 1.125 float64 def_float64 1.125 int8 def_int8 3 diff --git a/rosidl_generator_c/rosidl_generator_c/__init__.py b/rosidl_generator_c/rosidl_generator_c/__init__.py index cba61bc34..848f85307 100644 --- a/rosidl_generator_c/rosidl_generator_c/__init__.py +++ b/rosidl_generator_c/rosidl_generator_c/__init__.py @@ -166,7 +166,7 @@ def primitive_value_to_c(type_, value): if type_ == 'bool': return 'true' if value else 'false' - if type_ in ['byte', 'char', 'signed char', 'int8', 'int16', 'int32', 'int64']: + if type_ in ['byte', 'char', 'int8', 'int16', 'int32', 'int64']: return str(value) if type_ in ['uint8', 'uint16', 'uint32', 'uint64']: diff --git a/rosidl_generator_c/test/test_interfaces.c b/rosidl_generator_c/test/test_interfaces.c index 309661337..07872c8fb 100644 --- a/rosidl_generator_c/test/test_interfaces.c +++ b/rosidl_generator_c/test/test_interfaces.c @@ -255,7 +255,7 @@ int test_primitives_default_value(void) EXPECT_EQ(true, primitive_values->def_bool_1); EXPECT_EQ(false, primitive_values->def_bool_2); EXPECT_EQ(66, primitive_values->def_byte); - EXPECT_EQ(67, primitive_values->def_char); + EXPECT_EQ(-66, primitive_values->def_char); EXPECT_EQ(1.125f, primitive_values->def_float32); EXPECT_EQ(1.125, primitive_values->def_float64); EXPECT_EQ(3, primitive_values->def_int8);