diff --git a/src/core/api/ip6_api.cpp b/src/core/api/ip6_api.cpp index 3157b1b67..65e1fca27 100644 --- a/src/core/api/ip6_api.cpp +++ b/src/core/api/ip6_api.cpp @@ -252,7 +252,7 @@ otError otIp6SelectSourceAddress(otInstance *aInstance, otMessageInfo *aMessageI netifAddr = instance.Get().SelectSourceAddress(*static_cast(aMessageInfo)); VerifyOrExit(netifAddr != nullptr, error = OT_ERROR_NOT_FOUND); - memcpy(&aMessageInfo->mSockAddr, &netifAddr->mAddress, sizeof(aMessageInfo->mSockAddr)); + aMessageInfo->mSockAddr = netifAddr->GetAddress(); exit: return error; diff --git a/src/core/coap/coap_message.cpp b/src/core/coap/coap_message.cpp index 5d03b9d9e..ba5fc572a 100644 --- a/src/core/coap/coap_message.cpp +++ b/src/core/coap/coap_message.cpp @@ -306,7 +306,7 @@ Message *Message::Clone(uint16_t aLength) const VerifyOrExit(message != nullptr, OT_NOOP); - memcpy(&message->GetHelpData(), &GetHelpData(), sizeof(GetHelpData())); + message->GetHelpData() = GetHelpData(); exit: return message; diff --git a/src/core/coap/coap_message.hpp b/src/core/coap/coap_message.hpp index 87697c10a..912d0a61a 100644 --- a/src/core/coap/coap_message.hpp +++ b/src/core/coap/coap_message.hpp @@ -284,8 +284,8 @@ public: */ bool IsTokenEqual(const Message &aMessage) const { - return ((this->GetTokenLength() == aMessage.GetTokenLength()) && - (memcmp(this->GetToken(), aMessage.GetToken(), this->GetTokenLength()) == 0)); + return ((GetTokenLength() == aMessage.GetTokenLength()) && + (memcmp(GetToken(), aMessage.GetToken(), GetTokenLength()) == 0)); } /** diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index bf331d651..98de82fd2 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -1522,7 +1522,7 @@ void Mle::HandleNotifierEvents(Events aEvents) Get().Update(); #endif #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE - this->UpdateServiceAlocs(); + UpdateServiceAlocs(); #endif #if OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE