From de0997d3ac6ae23291fbd415fb3155206ae214c0 Mon Sep 17 00:00:00 2001 From: lobotuerk Date: Thu, 17 Sep 2020 16:24:46 -0300 Subject: [PATCH 1/2] update take serialized errors Signed-off-by: lobotuerk --- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 35b7bdfa5..1ab3a9595 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -251,10 +251,10 @@ _take_serialized_message( (void) allocation; *taken = false; - if (subscription->implementation_identifier != identifier) { - RMW_SET_ERROR_MSG("publisher handle not from this implementation"); - return RMW_RET_ERROR; - } + RMW_CHECK_TYPE_IDENTIFIERS_MATCH( + subscription handle, + subscription->implementation_identifier, identifier, + return RMW_RET_INCORRECT_RMW_IMPLEMENTATION) CustomSubscriberInfo * info = static_cast(subscription->data); RCUTILS_CHECK_FOR_NULL_WITH_MSG(info, "custom subscriber info is null", return RMW_RET_ERROR); @@ -298,11 +298,14 @@ __rmw_take_serialized_message( bool * taken, rmw_subscription_allocation_t * allocation) { - RCUTILS_CHECK_FOR_NULL_WITH_MSG( - subscription, "subscription pointer is null", return RMW_RET_ERROR); - RCUTILS_CHECK_FOR_NULL_WITH_MSG( - serialized_message, "ros_message pointer is null", return RMW_RET_ERROR); - RCUTILS_CHECK_FOR_NULL_WITH_MSG(taken, "boolean flag for taken is null", return RMW_RET_ERROR); + RMW_CHECK_ARGUMENT_FOR_NULL( + subscription, RMW_RET_INVALID_ARGUMENT); + + RMW_CHECK_ARGUMENT_FOR_NULL( + serialized_message, RMW_RET_INVALID_ARGUMENT); + + RMW_CHECK_ARGUMENT_FOR_NULL( + taken, RMW_RET_INVALID_ARGUMENT); return _take_serialized_message( identifier, subscription, serialized_message, taken, nullptr, allocation); From 599058a4d2d877321d25e4261eea8d1f3c6d7ceb Mon Sep 17 00:00:00 2001 From: lobotuerk Date: Fri, 18 Sep 2020 11:27:04 -0300 Subject: [PATCH 2/2] updated returns serialized_with_message_info Signed-off-by: lobotuerk --- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 1ab3a9595..6d7ceecd2 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -320,13 +320,17 @@ __rmw_take_serialized_message_with_info( rmw_message_info_t * message_info, rmw_subscription_allocation_t * allocation) { - RCUTILS_CHECK_FOR_NULL_WITH_MSG( - subscription, "subscription pointer is null", return RMW_RET_ERROR); - RCUTILS_CHECK_FOR_NULL_WITH_MSG( - serialized_message, "ros_message pointer is null", return RMW_RET_ERROR); - RCUTILS_CHECK_FOR_NULL_WITH_MSG(taken, "boolean flag for taken is null", return RMW_RET_ERROR); - RCUTILS_CHECK_FOR_NULL_WITH_MSG( - message_info, "message info pointer is null", return RMW_RET_ERROR); + RMW_CHECK_ARGUMENT_FOR_NULL( + subscription, RMW_RET_INVALID_ARGUMENT); + + RMW_CHECK_ARGUMENT_FOR_NULL( + serialized_message, RMW_RET_INVALID_ARGUMENT); + + RMW_CHECK_ARGUMENT_FOR_NULL( + taken, RMW_RET_INVALID_ARGUMENT); + + RMW_CHECK_ARGUMENT_FOR_NULL( + message_info, RMW_RET_INVALID_ARGUMENT); return _take_serialized_message( identifier, subscription, serialized_message, taken, message_info, allocation);