From 834d1a950d38a821284955f2732cdbb5b05ebd2a Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 1 Mar 2017 15:58:42 +0100 Subject: Change data_ member of can_message_t object to a vector of uint8_t instead of an array This is more flexible to allocate dynamically the vector depending if we process classic CAN frame or CAN FD frame which are 64bytes long. Change-Id: I698002139d612e3aaaa33f0f5a895e16ff655f5d Signed-off-by: Romain Forlot --- src/can-message.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/can-message.cpp') diff --git a/src/can-message.cpp b/src/can-message.cpp index 77fce68..a95722e 100644 --- a/src/can-message.cpp +++ b/src/can-message.cpp @@ -55,8 +55,9 @@ uint8_t can_message_t::get_flags() const const uint8_t* can_message_t::get_data() const { - return data_; + return data_.data(); } + uint8_t can_message_t::get_length() const { return length_; @@ -149,15 +150,15 @@ void can_message_t::set_length(const uint8_t new_length) void can_message_t::set_data(const __u8 new_data[], size_t dlen) { - if (sizeof(dlen)/sizeof(__u8) > maxdlen_) + if (dlen > maxdlen_) ERROR(binder_interface, "Can set data, too big ! It is a CAN frame ?"); else { int i; - /* Limiting to 8 bytes message for now on 64 bytes from fd frames*/ + /* Limiting to 8 bytes message for now, even on 64 bytes from fd frames*/ for(i=0;i