diff options
author | David Cemin <david.cemin@coveloz.com> | 2016-03-29 10:35:29 -0400 |
---|---|---|
committer | David Cemin <david.cemin@coveloz.com> | 2016-03-29 10:35:29 -0400 |
commit | 20d08fae4d5b4145971395fd3203ea207a3db111 (patch) | |
tree | e2cb9cf537f7a40b475862394735fd4fdc472b4d | |
parent | fa7a4823a7e00d19a4262cc79c87d03192362d89 (diff) | |
download | Open-AVB-20d08fae4d5b4145971395fd3203ea207a3db111.tar.gz |
[Codereview] Fixing memcpy size
In two different places the wrong size of memory was being used on a
memcpy / memset. Now it uses the size of the pointer instead of a fixed
number.
-rw-r--r-- | daemons/gptp/common/ieee1588port.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/daemons/gptp/common/ieee1588port.cpp b/daemons/gptp/common/ieee1588port.cpp index de79e145..c66e849f 100644 --- a/daemons/gptp/common/ieee1588port.cpp +++ b/daemons/gptp/common/ieee1588port.cpp @@ -145,7 +145,7 @@ IEEE1588Port::IEEE1588Port pdelay_count = 0; sync_count = 0; - bzero(link_delay, 4); + memset(link_delay, 0, sizeof(link_delay)); } void IEEE1588Port::timestamper_init(void) @@ -171,7 +171,7 @@ bool IEEE1588Port::init_port(int delay[4]) this->net_iface = net_iface; this->net_iface->getLinkLayerAddress(&local_addr); clock->setClockIdentity(&local_addr); - memcpy(this->link_delay, delay, 4); + memcpy(this->link_delay, delay, sizeof(this->link_delay)); this->timestamper_init(); |