Skip to content

Commit

Permalink
Fix argument passed to logging macros (ros2#421)
Browse files Browse the repository at this point in the history
This commit fixes two problems with the logging
statements:
- %p requires a void * object to be passed
- %d expects an integer. For size_t objects, %zu should be used

Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
  • Loading branch information
thomas-moulard authored and dirk-thomas committed Apr 30, 2019
1 parent f98d37e commit 23510fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rcl/src/rcl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rcl_init(

RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME,
"Initializing ROS client library, for context at address: %p", context);
"Initializing ROS client library, for context at address: %p", (void *) context);

// test expectation that given context is zero initialized
if (NULL != context->impl) {
Expand Down Expand Up @@ -161,7 +161,7 @@ rcl_shutdown(rcl_context_t * context)
{
RCUTILS_LOG_DEBUG_NAMED(
ROS_PACKAGE_NAME,
"Shutting down ROS client library, for context at address: %p", context);
"Shutting down ROS client library, for context at address: %p", (void *) context);
RCL_CHECK_ARGUMENT_FOR_NULL(context, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_FOR_NULL_WITH_MSG(
context->impl, "context is zero-initialized", return RCL_RET_INVALID_ARGUMENT);
Expand Down
2 changes: 1 addition & 1 deletion rcl/test/rcl/test_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ void expect_topics_types(
if (expect) {
EXPECT_EQ(num_topics, nat.names.size);
} else {
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expected topics %d, actual topics %d", num_topics,
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expected topics %zu, actual topics %zu", num_topics,
nat.names.size);
}
ret = rcl_names_and_types_fini(&nat);
Expand Down

0 comments on commit 23510fe

Please sign in to comment.