File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments