Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 21eb965

Browse filesBrowse files
committed
Fix #217 issue with compiling with newer compiler
1 parent c486627 commit 21eb965
Copy full SHA for 21eb965

File tree

1 file changed

+5
-10
lines changed
Filter options

1 file changed

+5
-10
lines changed

‎api/CanMsg.h

Copy file name to clipboardExpand all lines: api/CanMsg.h
+5-10Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.