From afce07b47c21838d4664f9a815797a60a40dbda3 Mon Sep 17 00:00:00 2001 From: Jeremy Boynes Date: Thu, 2 Nov 2023 15:09:40 +0000 Subject: [PATCH] Fix #217 issue with compiling with newer compiler --- api/CanMsg.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index eaa3f0ed..b26a48b5 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -51,12 +51,7 @@ class CanMsg : public Printable CanMsg() : CanMsg(0, 0, nullptr) { } - CanMsg(CanMsg const & other) - { - this->id = other.id; - this->data_length = other.data_length; - if (this->data_length && other.data) - memcpy(this->data, other.data, this->data_length); + CanMsg(CanMsg const & other) : CanMsg(other.id, other.data_length, other.data) { } virtual ~CanMsg() { } @@ -65,10 +60,10 @@ class CanMsg : public Printable { if (this != &other) { - this->id = other.id; - this->data_length = other.data_length; - if (this->data_length && other.data) - memcpy(this->data, other.data, this->data_length); + id = other.id; + data_length = other.data_length; + if (data_length > 0) + memcpy(data, other.data, data_length); } return (*this); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy