Skip to content

Commit 21eb965

Browse files
committed
Fix arduino#217 issue with compiling with newer compiler
1 parent c486627 commit 21eb965

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

api/CanMsg.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ class CanMsg : public Printable
5151

5252
CanMsg() : CanMsg(0, 0, nullptr) { }
5353

54-
CanMsg(CanMsg const & other)
55-
{
56-
this->id = other.id;
57-
this->data_length = other.data_length;
58-
if (this->data_length && other.data)
59-
memcpy(this->data, other.data, this->data_length);
54+
CanMsg(CanMsg const & other) : CanMsg(other.id, other.data_length, other.data) {
6055
}
6156

6257
virtual ~CanMsg() { }
@@ -65,10 +60,10 @@ class CanMsg : public Printable
6560
{
6661
if (this != &other)
6762
{
68-
this->id = other.id;
69-
this->data_length = other.data_length;
70-
if (this->data_length && other.data)
71-
memcpy(this->data, other.data, this->data_length);
63+
id = other.id;
64+
data_length = other.data_length;
65+
if (data_length > 0)
66+
memcpy(data, other.data, data_length);
7267
}
7368
return (*this);
7469
}

0 commit comments

Comments
 (0)
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