Skip to content

Commit

Permalink
Uncrustify
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Garrido <[email protected]>
  • Loading branch information
pablogs9 committed Mar 28, 2022
1 parent 70fba23 commit 231fb24
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions rmw_microxrcedds_c/src/rmw_microros_internal/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ typedef struct rmw_uxrce_topic_t
struct rmw_uxrce_node_t * owner_node;

union {
const message_type_support_callbacks_t * msg;
const service_type_support_callbacks_t * srv;
const message_type_support_callbacks_t * msg;
const service_type_support_callbacks_t * srv;
} type_support_callbacks;

char topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
Expand Down
3 changes: 2 additions & 1 deletion rmw_microxrcedds_c/src/rmw_publish.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ rmw_publish(
ret = RMW_RET_ERROR;
} else {
rmw_uxrce_publisher_t * custom_publisher = (rmw_uxrce_publisher_t *)publisher->data;
const message_type_support_callbacks_t * functions = custom_publisher->topic.type_support_callbacks.msg;
const message_type_support_callbacks_t * functions =
custom_publisher->topic.type_support_callbacks.msg;
uint32_t topic_length = functions->get_serialized_size(ros_message);

if (custom_publisher->cs_cb_size) {
Expand Down
17 changes: 12 additions & 5 deletions rmw_microxrcedds_c/src/rmw_publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,38 @@ rmw_create_publisher(

// Create topic
custom_publisher->topic.owner_node = custom_publisher->owner_node;
custom_publisher->topic.topic_id = uxr_object_id(custom_node->context->id_topic++, UXR_TOPIC_ID);
custom_publisher->topic.topic_id =
uxr_object_id(custom_node->context->id_topic++, UXR_TOPIC_ID);

const rosidl_message_type_support_t * type_support_xrce = get_message_typesupport_handle(type_support, ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE);
const rosidl_message_type_support_t * type_support_xrce = get_message_typesupport_handle(
type_support, ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE);

if (NULL == type_support_xrce) {
RMW_UROS_TRACE_MESSAGE("Undefined type support")
custom_publisher = NULL;
goto fail;
}

custom_publisher->topic.type_support_callbacks.msg = (const message_type_support_callbacks_t *)type_support_xrce->data;
custom_publisher->topic.type_support_callbacks.msg =
(const message_type_support_callbacks_t *)type_support_xrce->data;

if ((strlen(topic_name) + 1 ) > sizeof(custom_publisher->topic.topic_name)) {
RMW_UROS_TRACE_MESSAGE("failed to allocate string")
custom_publisher = NULL;
goto fail;
}
snprintf((char *)custom_publisher->topic.topic_name, sizeof(custom_publisher->topic.topic_name), "%s", topic_name);
snprintf(
(char *)custom_publisher->topic.topic_name, sizeof(custom_publisher->topic.topic_name),
"%s", topic_name);
rmw_publisher->topic_name = custom_publisher->topic.topic_name;

static char full_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
static char type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];

generate_topic_name(topic_name, full_topic_name, sizeof(full_topic_name));
generate_type_name(custom_publisher->topic.type_support_callbacks.msg, type_name, sizeof(type_name));
generate_type_name(
custom_publisher->topic.type_support_callbacks.msg, type_name,
sizeof(type_name));

uint16_t topic_req = UXR_INVALID_REQUEST_ID;

Expand Down
18 changes: 13 additions & 5 deletions rmw_microxrcedds_c/src/rmw_subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,39 @@ rmw_create_subscription(

// Create topic
custom_subscription->topic.owner_node = custom_subscription->owner_node;
custom_subscription->topic.topic_id = uxr_object_id(custom_node->context->id_topic++, UXR_TOPIC_ID);
custom_subscription->topic.topic_id = uxr_object_id(
custom_node->context->id_topic++,
UXR_TOPIC_ID);

const rosidl_message_type_support_t * type_support_xrce = get_message_typesupport_handle(type_support, ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE);
const rosidl_message_type_support_t * type_support_xrce = get_message_typesupport_handle(
type_support, ROSIDL_TYPESUPPORT_MICROXRCEDDS_C__IDENTIFIER_VALUE);

if (NULL == type_support_xrce) {
RMW_UROS_TRACE_MESSAGE("Undefined type support")
custom_subscription = NULL;
goto fail;
}

custom_subscription->topic.type_support_callbacks.msg = (const message_type_support_callbacks_t *)type_support_xrce->data;
custom_subscription->topic.type_support_callbacks.msg =
(const message_type_support_callbacks_t *)type_support_xrce->data;

if ((strlen(topic_name) + 1 ) > sizeof(custom_subscription->topic.topic_name)) {
RMW_UROS_TRACE_MESSAGE("failed to allocate string")
custom_subscription = NULL;
goto fail;
}
snprintf((char *)custom_subscription->topic.topic_name, sizeof(custom_subscription->topic.topic_name), "%s", topic_name);
snprintf(
(char *)custom_subscription->topic.topic_name,
sizeof(custom_subscription->topic.topic_name), "%s", topic_name);
rmw_subscription->topic_name = custom_subscription->topic.topic_name;

static char full_topic_name[RMW_UXRCE_TOPIC_NAME_MAX_LENGTH];
static char type_name[RMW_UXRCE_TYPE_NAME_MAX_LENGTH];

generate_topic_name(topic_name, full_topic_name, sizeof(full_topic_name));
generate_type_name(custom_subscription->topic.type_support_callbacks.msg, type_name, sizeof(type_name));
generate_type_name(
custom_subscription->topic.type_support_callbacks.msg, type_name,
sizeof(type_name));

uint16_t topic_req = UXR_INVALID_REQUEST_ID;

Expand Down

0 comments on commit 231fb24

Please sign in to comment.