Skip to content

Commit

Permalink
Fix hardcoded rmw_gid_t length (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnmm authored Mar 29, 2023
1 parent 6939a8a commit 1a22b52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions rclrs/src/rcl_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
#![allow(missing_docs)]

include!(concat!(env!("OUT_DIR"), "/rcl_bindings_generated.rs"));

pub const RMW_GID_STORAGE_SIZE: usize = rmw_gid_storage_size_constant;
2 changes: 2 additions & 0 deletions rclrs/src/rcl_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
#include <rmw/types.h>
#include <rosidl_typesupport_introspection_c/field_types.h>
#include <rosidl_typesupport_introspection_c/message_introspection.h>

const size_t rmw_gid_storage_size_constant = RMW_GID_STORAGE_SIZE;
4 changes: 2 additions & 2 deletions rclrs/src/subscription/message_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::rcl_bindings::*;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PublisherGid {
/// Bytes identifying a publisher in the RMW implementation.
pub data: [u8; 24],
pub data: [u8; RMW_GID_STORAGE_SIZE],
/// A string containing the RMW implementation's name.
///
/// The `data` member only uniquely identifies the publisher within
Expand Down Expand Up @@ -145,7 +145,7 @@ mod tests {
publication_sequence_number: 0,
reception_sequence_number: 0,
publisher_gid: rmw_gid_t {
data: [0; 24],
data: [0; RMW_GID_STORAGE_SIZE],
implementation_identifier: std::ptr::null(),
},
from_intra_process: false,
Expand Down

0 comments on commit 1a22b52

Please sign in to comment.