Fix the history depth for KEEP_ALL. (#305) (#394)

The comment in the code explains it in a lot more detail, but
essentially this avoids a signed/unsigned mismatch in higher
level code.  Since the depth is meaningless in KEEP_ALL anyway,
this shouldn't have any deleterious effects elsewhere.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
(cherry picked from commit d5980d5a8fb753d2d7074c635426b9a2805928ba)

Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
This commit is contained in:
mergify[bot] 2022-06-02 11:09:30 -03:00 committed by GitHub
parent 517fd655bd
commit 410aa61d81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1739,7 +1739,13 @@ static bool dds_qos_to_rmw_qos(const dds_qos_t * dds_qos, rmw_qos_profile_t * qo
break; break;
case DDS_HISTORY_KEEP_ALL: case DDS_HISTORY_KEEP_ALL:
qos_policies->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL; qos_policies->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL;
qos_policies->depth = (uint32_t) depth; // When using a policy of KEEP_ALL, the depth is meaningless.
// CycloneDDS reports this as -1, but the rmw_qos_profile_t structure
// expects an unsigned number. Casting -1 to unsigned would yield
// a value of 2^32 - 1, but unfortunately our XML-RPC connection
// (used for the command-line tools) doesn't understand anything
// larger than 2^31 - 1. Just set the depth to 0 here instead.
qos_policies->depth = 0;
break; break;
default: default:
rmw_cyclonedds_cpp::unreachable(); rmw_cyclonedds_cpp::unreachable();