Updated error returns on rmw_take (#241)
Signed-off-by: lobotuerk <jtlorente@ekumenlabs.com>
This commit is contained in:
parent
c610402b46
commit
966035ade4
1 changed files with 39 additions and 10 deletions
|
@ -2515,10 +2515,22 @@ static rmw_ret_t rmw_take_int(
|
||||||
const rmw_subscription_t * subscription, void * ros_message,
|
const rmw_subscription_t * subscription, void * ros_message,
|
||||||
bool * taken, rmw_message_info_t * message_info)
|
bool * taken, rmw_message_info_t * message_info)
|
||||||
{
|
{
|
||||||
RET_NULL(taken);
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
RET_NULL(ros_message);
|
taken, RMW_RET_INVALID_ARGUMENT);
|
||||||
RET_NULL(subscription);
|
|
||||||
RET_WRONG_IMPLID(subscription);
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
|
ros_message, RMW_RET_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
|
subscription, RMW_RET_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
|
message_info, RMW_RET_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
|
||||||
|
subscription handle,
|
||||||
|
subscription->implementation_identifier, eclipse_cyclonedds_identifier,
|
||||||
|
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
|
||||||
CddsSubscription * sub = static_cast<CddsSubscription *>(subscription->data);
|
CddsSubscription * sub = static_cast<CddsSubscription *>(subscription->data);
|
||||||
RET_NULL(sub);
|
RET_NULL(sub);
|
||||||
dds_sample_info_t info;
|
dds_sample_info_t info;
|
||||||
|
@ -2557,20 +2569,37 @@ static rmw_ret_t rmw_take_seq(
|
||||||
rmw_message_info_sequence_t * message_info_sequence,
|
rmw_message_info_sequence_t * message_info_sequence,
|
||||||
size_t * taken)
|
size_t * taken)
|
||||||
{
|
{
|
||||||
RET_NULL(taken);
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
RET_NULL(message_sequence);
|
taken, RMW_RET_INVALID_ARGUMENT);
|
||||||
RET_NULL(message_info_sequence);
|
|
||||||
RET_NULL(subscription);
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
|
message_sequence, RMW_RET_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
|
message_info_sequence, RMW_RET_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
RMW_CHECK_ARGUMENT_FOR_NULL(
|
||||||
|
subscription, RMW_RET_INVALID_ARGUMENT);
|
||||||
RET_WRONG_IMPLID(subscription);
|
RET_WRONG_IMPLID(subscription);
|
||||||
|
|
||||||
|
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
|
||||||
|
subscription handle,
|
||||||
|
subscription->implementation_identifier, eclipse_cyclonedds_identifier,
|
||||||
|
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
|
||||||
|
|
||||||
|
if (0u == count) {
|
||||||
|
RMW_SET_ERROR_MSG("count cannot be 0");
|
||||||
|
return RMW_RET_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
if (count > message_sequence->capacity) {
|
if (count > message_sequence->capacity) {
|
||||||
RMW_SET_ERROR_MSG("Insuffient capacity in message_sequence");
|
RMW_SET_ERROR_MSG("Insuffient capacity in message_sequence");
|
||||||
return RMW_RET_ERROR;
|
return RMW_RET_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > message_info_sequence->capacity) {
|
if (count > message_info_sequence->capacity) {
|
||||||
RMW_SET_ERROR_MSG("Insuffient capacity in message_info_sequence");
|
RMW_SET_ERROR_MSG("Insuffient capacity in message_info_sequence");
|
||||||
return RMW_RET_ERROR;
|
return RMW_RET_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > (std::numeric_limits<uint32_t>::max)()) {
|
if (count > (std::numeric_limits<uint32_t>::max)()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue