Skip to content

Commit

Permalink
Fix arduino#217 issue with compiling with newer compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
jboynes committed Nov 3, 2023
1 parent c486627 commit 21eb965
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions api/CanMsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
Expand All @@ -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);
}
Expand Down

0 comments on commit 21eb965

Please sign in to comment.