Skip to content

Commit 1a22b52

Browse files
authored
Fix hardcoded rmw_gid_t length (#309)
1 parent 6939a8a commit 1a22b52

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

rclrs/src/rcl_bindings.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
#![allow(missing_docs)]
88

99
include!(concat!(env!("OUT_DIR"), "/rcl_bindings_generated.rs"));
10+
11+
pub const RMW_GID_STORAGE_SIZE: usize = rmw_gid_storage_size_constant;

rclrs/src/rcl_wrapper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
#include <rmw/types.h>
66
#include <rosidl_typesupport_introspection_c/field_types.h>
77
#include <rosidl_typesupport_introspection_c/message_introspection.h>
8+
9+
const size_t rmw_gid_storage_size_constant = RMW_GID_STORAGE_SIZE;

rclrs/src/subscription/message_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::rcl_bindings::*;
2727
#[derive(Clone, Debug, PartialEq, Eq)]
2828
pub struct PublisherGid {
2929
/// Bytes identifying a publisher in the RMW implementation.
30-
pub data: [u8; 24],
30+
pub data: [u8; RMW_GID_STORAGE_SIZE],
3131
/// A string containing the RMW implementation's name.
3232
///
3333
/// The `data` member only uniquely identifies the publisher within
@@ -145,7 +145,7 @@ mod tests {
145145
publication_sequence_number: 0,
146146
reception_sequence_number: 0,
147147
publisher_gid: rmw_gid_t {
148-
data: [0; 24],
148+
data: [0; RMW_GID_STORAGE_SIZE],
149149
implementation_identifier: std::ptr::null(),
150150
},
151151
from_intra_process: false,

0 commit comments

Comments
 (0)