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); }
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: