[style] replace NULL with nullptr (#5109)

This commit is contained in:
Jonathan Hui
2020-06-17 22:44:54 -07:00
committed by GitHub
parent 3b362071e5
commit 1326d64a64
209 changed files with 1981 additions and 1906 deletions
+6
View File
@@ -493,6 +493,12 @@ include $(CLEAR_VARS)
LOCAL_MODULE := ot-ctl
LOCAL_MODULE_TAGS := eng
LOCAL_CPPFLAGS := \
-std=c++11 \
-pedantic-errors \
-Wno-non-virtual-dtor \
$(NULL)
LOCAL_CFLAGS := \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
$(NULL)
+6 -1
View File
@@ -64,7 +64,12 @@ add_library(openthread-cc1352
cxx_helpers.c
)
set_property(TARGET openthread-cc1352 PROPERTY C_STANDARD 99)
set_target_properties(
openthread-cc1352
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-cc1352
PUBLIC
+6 -1
View File
@@ -55,7 +55,12 @@ add_library(openthread-cc2538
$<TARGET_OBJECTS:openthread-platform-utils>
)
set_property(TARGET openthread-cc2538 PROPERTY C_STANDARD 99)
set_target_properties(
openthread-cc2538
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-cc2538 PRIVATE openthread-platform-utils ot-config)
target_link_options(openthread-cc2538 PUBLIC -T${PROJECT_SOURCE_DIR}/examples/platforms/cc2538/cc2538.ld)
+6 -1
View File
@@ -64,7 +64,12 @@ add_library(openthread-cc2650
$<TARGET_OBJECTS:openthread-platform-utils>
)
set_property(TARGET openthread-cc2650 PROPERTY C_STANDARD 99)
set_target_properties(
openthread-cc2650
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-cc2650
PUBLIC
+6 -1
View File
@@ -64,7 +64,12 @@ add_library(openthread-cc2652
uart.c
)
set_property(TARGET openthread-cc2652 PROPERTY C_STANDARD 99)
set_target_properties(
openthread-cc2652
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-cc2652
PUBLIC
+7 -1
View File
@@ -52,7 +52,13 @@ add_library(openthread-kw41z
uart.c
)
set_property(TARGET openthread-kw41z PROPERTY C_STANDARD 99)
set_target_properties(
openthread-kw41z
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-kw41z PRIVATE nxp-kw41z-driver ot-config)
target_link_options(openthread-kw41z PRIVATE -T${PROJECT_SOURCE_DIR}/examples/platforms/kw41z/MKW41Z512xxx4.ld)
target_link_options(openthread-kw41z PRIVATE -Wl,--gc-sections -Wl,-Map=$<TARGET_PROPERTY:NAME>.map)
+6 -1
View File
@@ -67,7 +67,12 @@ add_library(openthread-qpg6095
uart.c
)
set_property(TARGET openthread-qpg6095 PROPERTY C_STANDARD 99)
set_target_properties(
openthread-qpg6095
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-qpg6095
PRIVATE
+2 -2
View File
@@ -72,7 +72,7 @@ otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint
if (error == OT_ERROR_NOT_FOUND)
{
if (aValue != NULL)
if (aValue != nullptr)
{
*aValueLength = 0;
}
@@ -110,7 +110,7 @@ otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
otError error = OT_ERROR_NOT_FOUND;
OT_UNUSED_VARIABLE(aInstance);
if (otPlatSettingsGet(aInstance, aKey, 0, NULL, NULL) == OT_ERROR_NONE)
if (otPlatSettingsGet(aInstance, aKey, 0, nullptr, nullptr) == OT_ERROR_NONE)
{
qorvoSettingsDelete(aKey, aIndex);
error = OT_ERROR_NONE;
+6 -1
View File
@@ -60,7 +60,12 @@ add_library(openthread-samr21
uart.c
)
set_property(TARGET openthread-samr21 PROPERTY C_STANDARD 99)
set_target_properties(
openthread-samr21
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
if(OT_CFLAGS MATCHES "-pedantic-errors")
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
+6 -1
View File
@@ -71,7 +71,12 @@ add_library(openthread-simulation
$<TARGET_OBJECTS:openthread-platform-utils>
)
set_property(TARGET openthread-simulation PROPERTY C_STANDARD 99)
set_target_properties(
openthread-simulation
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
find_library(LIBRT rt)
if(LIBRT)
+7
View File
@@ -34,6 +34,13 @@ add_library(openthread-platform-utils OBJECT
soft_source_match_table.c
)
set_target_properties(
openthread-platform-utils
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_include_directories(openthread-platform-utils PRIVATE
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/examples/platforms
+2 -2
View File
@@ -134,7 +134,7 @@ bool otMacFrameIsVersion2015(const otRadioFrame *aFrame)
void otMacFrameGenerateImmAck(const otRadioFrame *aFrame, bool aIsFramePending, otRadioFrame *aAckFrame)
{
assert(aFrame != NULL && aAckFrame != NULL);
assert(aFrame != nullptr && aAckFrame != nullptr);
static_cast<Mac::TxFrame *>(aAckFrame)->GenerateImmAck(*static_cast<const Mac::RxFrame *>(aFrame), aIsFramePending);
}
@@ -146,7 +146,7 @@ otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame,
uint8_t aIeLength,
otRadioFrame * aAckFrame)
{
assert(aFrame != NULL && aAckFrame != NULL);
assert(aFrame != nullptr && aAckFrame != nullptr);
return static_cast<Mac::TxFrame *>(aAckFrame)->GenerateEnhAck(*static_cast<const Mac::RxFrame *>(aFrame),
aIsFramePending, aIeData, aIeLength);
+25 -25
View File
@@ -250,9 +250,9 @@ const struct Command Interpreter::sCommands[] = {
};
Interpreter::Interpreter(Instance *aInstance)
: mUserCommands(NULL)
: mUserCommands(nullptr)
, mUserCommandsLength(0)
, mServer(NULL)
, mServer(nullptr)
, mPingLength(kDefaultPingLength)
, mPingCount(kDefaultPingCount)
, mPingInterval(kDefaultPingInterval)
@@ -625,7 +625,7 @@ void Interpreter::ProcessDua(uint8_t aArgsLength, char *aArgs[])
{
const otIp6InterfaceIdentifier *iid = otThreadGetFixedDuaInterfaceIdentifier(mInstance);
if (iid != NULL)
if (iid != nullptr)
{
OutputBytes(iid->m8, sizeof(otIp6InterfaceIdentifier));
mServer->OutputFormat("\r\n");
@@ -635,7 +635,7 @@ void Interpreter::ProcessDua(uint8_t aArgsLength, char *aArgs[])
case 2:
if (strcmp(aArgs[1], "clear") == 0)
{
SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, NULL));
SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, nullptr));
}
else
{
@@ -1353,7 +1353,7 @@ void Interpreter::HandleDnsResponse(const char *aHostname, const Ip6::Address *a
if (aResult == OT_ERROR_NONE)
{
if (aAddress != NULL)
if (aAddress != nullptr)
{
OutputIp6Address(*aAddress);
}
@@ -2050,12 +2050,12 @@ void Interpreter::ProcessNetif(uint8_t aArgsLength, char *aArgs[])
OT_UNUSED_VARIABLE(aArgs);
otError error = OT_ERROR_NONE;
const char * netif = NULL;
const char * netif = nullptr;
unsigned int netifidx = 0;
SuccessOrExit(error = otPlatGetNetif(mInstance, &netif, &netifidx));
mServer->OutputFormat("%s:%u\r\n", netif ? netif : "<NULL>", netifidx);
mServer->OutputFormat("%s:%u\r\n", netif ? netif : "(null)", netifidx);
exit:
AppendResult(error);
@@ -2415,7 +2415,7 @@ void Interpreter::HandlePingTimer(Timer &aTimer)
void Interpreter::SendPing(void)
{
uint32_t timestamp = HostSwap32(TimerMilli::GetNow().GetValue());
otMessage * message = NULL;
otMessage * message = nullptr;
otMessageInfo messageInfo;
memset(&messageInfo, 0, sizeof(messageInfo));
@@ -2423,8 +2423,8 @@ void Interpreter::SendPing(void)
messageInfo.mHopLimit = mPingHopLimit;
messageInfo.mAllowZeroHopLimit = mPingAllowZeroHopLimit;
message = otIp6NewMessage(mInstance, NULL);
VerifyOrExit(message != NULL, OT_NOOP);
message = otIp6NewMessage(mInstance, nullptr);
VerifyOrExit(message != nullptr, OT_NOOP);
SuccessOrExit(otMessageAppend(message, &timestamp, sizeof(timestamp)));
SuccessOrExit(otMessageSetLength(message, mPingLength));
@@ -2433,10 +2433,10 @@ void Interpreter::SendPing(void)
SignalPingRequest(static_cast<Ip6::MessageInfo *>(&messageInfo)->GetPeerAddr(), mPingLength, HostSwap32(timestamp),
messageInfo.mHopLimit);
message = NULL;
message = nullptr;
exit:
if (message != NULL)
if (message != nullptr)
{
otMessageFree(message);
}
@@ -2490,7 +2490,7 @@ void Interpreter::ProcessPromiscuous(uint8_t aArgsLength, char *aArgs[])
}
else if (strcmp(aArgs[0], "disable") == 0)
{
otLinkSetPcapCallback(mInstance, NULL, NULL);
otLinkSetPcapCallback(mInstance, nullptr, nullptr);
SuccessOrExit(error = otLinkSetPromiscuous(mInstance, false));
}
else
@@ -2588,7 +2588,7 @@ otError Interpreter::ProcessPrefixAdd(uint8_t aArgsLength, char *aArgs[])
memset(&config, 0, sizeof(otBorderRouterConfig));
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == NULL)
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == nullptr)
{
ExitNow();
}
@@ -2689,7 +2689,7 @@ otError Interpreter::ProcessPrefixRemove(uint8_t aArgsLength, char *aArgs[])
memset(&prefix, 0, sizeof(otIp6Prefix));
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == NULL)
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == nullptr)
{
ExitNow();
}
@@ -2912,7 +2912,7 @@ otError Interpreter::ProcessRouteAdd(uint8_t aArgsLength, char *aArgs[])
VerifyOrExit(aArgsLength > 0, error = OT_ERROR_INVALID_ARGS);
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == NULL)
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == nullptr)
{
ExitNow();
}
@@ -2971,7 +2971,7 @@ otError Interpreter::ProcessRouteRemove(uint8_t aArgsLength, char *aArgs[])
VerifyOrExit(aArgsLength > 0, error = OT_ERROR_INVALID_ARGS);
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == NULL)
if ((prefixLengthStr = strchr(aArgs[argcur], '/')) == nullptr)
{
ExitNow();
}
@@ -3300,7 +3300,7 @@ void Interpreter::HandleActiveScanResult(otActiveScanResult *aResult, void *aCon
void Interpreter::HandleActiveScanResult(otActiveScanResult *aResult)
{
if (aResult == NULL)
if (aResult == nullptr)
{
AppendResult(OT_ERROR_NONE);
ExitNow();
@@ -3331,7 +3331,7 @@ void Interpreter::HandleEnergyScanResult(otEnergyScanResult *aResult, void *aCon
void Interpreter::HandleEnergyScanResult(otEnergyScanResult *aResult)
{
if (aResult == NULL)
if (aResult == nullptr)
{
AppendResult(OT_ERROR_NONE);
ExitNow();
@@ -3857,7 +3857,7 @@ otError Interpreter::ProcessMacFilterRss(uint8_t aArgsLength, char *aArgs[])
if (strcmp(aArgs[1], "*") == 0)
{
SuccessOrExit(error = otLinkFilterAddRssIn(mInstance, NULL, rss));
SuccessOrExit(error = otLinkFilterAddRssIn(mInstance, nullptr, rss));
}
else
{
@@ -3875,7 +3875,7 @@ otError Interpreter::ProcessMacFilterRss(uint8_t aArgsLength, char *aArgs[])
if (strcmp(aArgs[1], "*") == 0)
{
SuccessOrExit(error = otLinkFilterAddRssIn(mInstance, NULL, rss));
SuccessOrExit(error = otLinkFilterAddRssIn(mInstance, nullptr, rss));
}
else
{
@@ -3891,7 +3891,7 @@ otError Interpreter::ProcessMacFilterRss(uint8_t aArgsLength, char *aArgs[])
if (strcmp(aArgs[1], "*") == 0)
{
SuccessOrExit(error = otLinkFilterRemoveRssIn(mInstance, NULL));
SuccessOrExit(error = otLinkFilterRemoveRssIn(mInstance, nullptr));
}
else
{
@@ -4003,14 +4003,14 @@ void Interpreter::ProcessDiag(uint8_t aArgsLength, char *aArgs[])
void Interpreter::ProcessLine(char *aBuf, uint16_t aBufLength, Server &aServer)
{
char * aArgs[kMaxArgs] = {NULL};
char * aArgs[kMaxArgs] = {nullptr};
char * cmd;
uint8_t aArgsLength = 0;
size_t i = 0;
mServer = &aServer;
VerifyOrExit(aBuf != NULL && StringLength(aBuf, aBufLength + 1) <= aBufLength, OT_NOOP);
VerifyOrExit(aBuf != nullptr && StringLength(aBuf, aBufLength + 1) <= aBufLength, OT_NOOP);
VerifyOrExit(Utils::CmdLineParser::ParseCmd(aBuf, aArgsLength, aArgs, kMaxArgs) == OT_ERROR_NONE,
mServer->OutputFormat("Error: too many args (max %d)\r\n", kMaxArgs));
@@ -4448,7 +4448,7 @@ extern "C" void otCliPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, cons
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
VerifyOrExit(Server::sServer != NULL, OT_NOOP);
VerifyOrExit(Server::sServer != nullptr, OT_NOOP);
Server::sServer->OutputFormatV(aFormat, aArgs);
Server::sServer->OutputFormat("\r\n");
+22 -22
View File
@@ -90,7 +90,7 @@ Coap::Coap(Interpreter &aInterpreter)
otError Coap::CancelResourceSubscription(void)
{
otError error = OT_ERROR_NONE;
otMessage * message = NULL;
otMessage * message = nullptr;
otMessageInfo messageInfo;
memset(&messageInfo, 0, sizeof(messageInfo));
@@ -99,8 +99,8 @@ otError Coap::CancelResourceSubscription(void)
VerifyOrExit(mRequestTokenLength != 0, error = OT_ERROR_INVALID_STATE);
message = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS);
message = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
otCoapMessageInit(message, OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_GET);
@@ -116,7 +116,7 @@ otError Coap::CancelResourceSubscription(void)
exit:
if ((error != OT_ERROR_NONE) && (message != NULL))
if ((error != OT_ERROR_NONE) && (message != nullptr))
{
otMessageFree(message);
}
@@ -207,7 +207,7 @@ exit:
otError Coap::ProcessSet(uint8_t aArgsLength, char *aArgs[])
{
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
otMessage * notificationMessage = NULL;
otMessage * notificationMessage = nullptr;
otMessageInfo messageInfo;
#endif
otError error = OT_ERROR_NONE;
@@ -229,8 +229,8 @@ otError Coap::ProcessSet(uint8_t aArgsLength, char *aArgs[])
mInterpreter.OutputIp6Address(mSubscriberSock.mAddress);
mInterpreter.mServer->OutputFormat("\r\n");
notificationMessage = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(notificationMessage != NULL, error = OT_ERROR_NO_BUFS);
notificationMessage = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(notificationMessage != nullptr, error = OT_ERROR_NO_BUFS);
otCoapMessageInit(
notificationMessage,
@@ -256,7 +256,7 @@ otError Coap::ProcessSet(uint8_t aArgsLength, char *aArgs[])
exit:
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
if ((error != OT_ERROR_NONE) && (notificationMessage != NULL))
if ((error != OT_ERROR_NONE) && (notificationMessage != nullptr))
{
otMessageFree(notificationMessage);
}
@@ -359,7 +359,7 @@ exit:
otError Coap::ProcessRequest(uint8_t aArgsLength, char *aArgs[])
{
otError error = OT_ERROR_NONE;
otMessage * message = NULL;
otMessage * message = nullptr;
otMessageInfo messageInfo;
uint16_t payloadLength = 0;
@@ -442,8 +442,8 @@ otError Coap::ProcessRequest(uint8_t aArgsLength, char *aArgs[])
}
#endif
message = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS);
message = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
otCoapMessageInit(message, coapType, coapCode);
otCoapMessageGenerateToken(message, ot::Coap::Message::kDefaultTokenLength);
@@ -496,13 +496,13 @@ otError Coap::ProcessRequest(uint8_t aArgsLength, char *aArgs[])
}
else
{
error = otCoapSendRequestWithParameters(mInterpreter.mInstance, message, &messageInfo, NULL, NULL,
error = otCoapSendRequestWithParameters(mInterpreter.mInstance, message, &messageInfo, nullptr, nullptr,
GetResponseTxParameters());
}
exit:
if ((error != OT_ERROR_NONE) && (message != NULL))
if ((error != OT_ERROR_NONE) && (message != nullptr))
{
otMessageFree(message);
}
@@ -516,7 +516,7 @@ otError Coap::Process(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength < 1)
{
IgnoreError(ProcessHelp(0, NULL));
IgnoreError(ProcessHelp(0, nullptr));
error = OT_ERROR_INVALID_ARGS;
}
else
@@ -542,7 +542,7 @@ void Coap::HandleRequest(void *aContext, otMessage *aMessage, const otMessageInf
void Coap::HandleRequest(otMessage *aMessage, const otMessageInfo *aMessageInfo)
{
otError error = OT_ERROR_NONE;
otMessage *responseMessage = NULL;
otMessage *responseMessage = nullptr;
otCoapCode responseCode = OT_COAP_CODE_EMPTY;
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
uint64_t observe = 0;
@@ -560,7 +560,7 @@ void Coap::HandleRequest(otMessage *aMessage, const otMessageInfo *aMessageInfo)
mInterpreter.mServer->OutputFormat("GET");
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
SuccessOrExit(error = otCoapOptionIteratorInit(&iterator, aMessage));
if (otCoapOptionIteratorGetFirstOptionMatching(&iterator, OT_COAP_OPTION_OBSERVE) != NULL)
if (otCoapOptionIteratorGetFirstOptionMatching(&iterator, OT_COAP_OPTION_OBSERVE) != nullptr)
{
SuccessOrExit(error = otCoapOptionIteratorGetOptionUintValue(&iterator, &observe));
observePresent = true;
@@ -643,8 +643,8 @@ void Coap::HandleRequest(otMessage *aMessage, const otMessageInfo *aMessageInfo)
responseCode = OT_COAP_CODE_VALID;
}
responseMessage = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(responseMessage != NULL, error = OT_ERROR_NO_BUFS);
responseMessage = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(responseMessage != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(
error = otCoapMessageInitResponse(responseMessage, aMessage, OT_COAP_TYPE_ACKNOWLEDGMENT, responseCode));
@@ -670,7 +670,7 @@ exit:
if (error != OT_ERROR_NONE)
{
if (responseMessage != NULL)
if (responseMessage != nullptr)
{
mInterpreter.mServer->OutputFormat("coap send response error %d: %s\r\n", error,
otThreadErrorToString(error));
@@ -699,7 +699,7 @@ void Coap::HandleNotificationResponse(otMessage *aMessage, const otMessageInfo *
switch (aError)
{
case OT_ERROR_NONE:
if (aMessageInfo != NULL)
if (aMessageInfo != nullptr)
{
mInterpreter.mServer->OutputFormat("Received ACK in reply to notification from ");
mInterpreter.OutputIp6Address(aMessageInfo->mPeerAddr);
@@ -728,7 +728,7 @@ void Coap::HandleResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo
mInterpreter.mServer->OutputFormat("coap receive response error %d: %s\r\n", aError,
otThreadErrorToString(aError));
}
else if ((aMessageInfo != NULL) && (aMessage != NULL))
else if ((aMessageInfo != nullptr) && (aMessage != nullptr))
{
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
otCoapOptionIterator iterator;
@@ -743,7 +743,7 @@ void Coap::HandleResponse(otMessage *aMessage, const otMessageInfo *aMessageInfo
const otCoapOption *observeOpt =
otCoapOptionIteratorGetFirstOptionMatching(&iterator, OT_COAP_OPTION_OBSERVE);
if (observeOpt != NULL)
if (observeOpt != nullptr)
{
uint64_t observeVal = 0;
otError error = otCoapOptionIteratorGetOptionUintValue(&iterator, &observeVal);
+2 -2
View File
@@ -116,12 +116,12 @@ private:
const otCoapTxParameters *GetRequestTxParameters(void) const
{
return mUseDefaultRequestTxParameters ? NULL : &mRequestTxParameters;
return mUseDefaultRequestTxParameters ? nullptr : &mRequestTxParameters;
}
const otCoapTxParameters *GetResponseTxParameters(void) const
{
return mUseDefaultResponseTxParameters ? NULL : &mResponseTxParameters;
return mUseDefaultResponseTxParameters ? nullptr : &mResponseTxParameters;
}
static const Command sCommands[];
+14 -14
View File
@@ -188,7 +188,7 @@ otError CoapSecure::ProcessStop(uint8_t aArgsLength, char *aArgs[])
otError CoapSecure::ProcessRequest(uint8_t aArgsLength, char *aArgs[])
{
otError error = OT_ERROR_NONE;
otMessage * message = NULL;
otMessage * message = nullptr;
otMessageInfo messageInfo;
uint16_t payloadLength = 0;
uint8_t indexShifter = 0;
@@ -259,8 +259,8 @@ otError CoapSecure::ProcessRequest(uint8_t aArgsLength, char *aArgs[])
}
}
message = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS);
message = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
otCoapMessageInit(message, coapType, coapCode);
otCoapMessageGenerateToken(message, ot::Coap::Message::kDefaultTokenLength);
@@ -292,12 +292,12 @@ otError CoapSecure::ProcessRequest(uint8_t aArgsLength, char *aArgs[])
}
else
{
error = otCoapSecureSendRequest(mInterpreter.mInstance, message, NULL, NULL);
error = otCoapSecureSendRequest(mInterpreter.mInstance, message, nullptr, nullptr);
}
exit:
if ((error != OT_ERROR_NONE) && (message != NULL))
if ((error != OT_ERROR_NONE) && (message != nullptr))
{
otMessageFree(message);
}
@@ -393,7 +393,7 @@ otError CoapSecure::Process(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength < 1)
{
IgnoreError(ProcessHelp(0, NULL));
IgnoreError(ProcessHelp(0, nullptr));
error = OT_ERROR_INVALID_ARGS;
}
else
@@ -448,7 +448,7 @@ void CoapSecure::HandleRequest(void *aContext, otMessage *aMessage, const otMess
void CoapSecure::HandleRequest(otMessage *aMessage, const otMessageInfo *aMessageInfo)
{
otError error = OT_ERROR_NONE;
otMessage *responseMessage = NULL;
otMessage *responseMessage = nullptr;
otCoapCode responseCode = OT_COAP_CODE_EMPTY;
char responseContent[] = "helloWorld";
@@ -493,8 +493,8 @@ void CoapSecure::HandleRequest(otMessage *aMessage, const otMessageInfo *aMessag
responseCode = OT_COAP_CODE_VALID;
}
responseMessage = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(responseMessage != NULL, error = OT_ERROR_NO_BUFS);
responseMessage = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(responseMessage != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(
error = otCoapMessageInitResponse(responseMessage, aMessage, OT_COAP_TYPE_ACKNOWLEDGMENT, responseCode));
@@ -516,7 +516,7 @@ exit:
if (error != OT_ERROR_NONE)
{
if (responseMessage != NULL)
if (responseMessage != nullptr)
{
mInterpreter.mServer->OutputFormat("coaps send response error %d: %s\r\n", error,
otThreadErrorToString(error));
@@ -561,13 +561,13 @@ void CoapSecure::DefaultHandler(void *aContext, otMessage *aMessage, const otMes
void CoapSecure::DefaultHandler(otMessage *aMessage, const otMessageInfo *aMessageInfo)
{
otError error = OT_ERROR_NONE;
otMessage *responseMessage = NULL;
otMessage *responseMessage = nullptr;
if ((otCoapMessageGetType(aMessage) == OT_COAP_TYPE_CONFIRMABLE) ||
(otCoapMessageGetCode(aMessage) == OT_COAP_CODE_GET))
{
responseMessage = otCoapNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(responseMessage != NULL, error = OT_ERROR_NO_BUFS);
responseMessage = otCoapNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(responseMessage != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = otCoapMessageInitResponse(responseMessage, aMessage, OT_COAP_TYPE_NON_CONFIRMABLE,
OT_COAP_CODE_NOT_FOUND));
@@ -576,7 +576,7 @@ void CoapSecure::DefaultHandler(otMessage *aMessage, const otMessageInfo *aMessa
}
exit:
if (error != OT_ERROR_NONE && responseMessage != NULL)
if (error != OT_ERROR_NONE && responseMessage != nullptr)
{
otMessageFree(responseMessage);
}
+3 -3
View File
@@ -122,7 +122,7 @@ otError Commissioner::ProcessJoiner(uint8_t aArgsLength, char *aArgs[])
if (strcmp(aArgs[2], "*") == 0)
{
addrPtr = NULL;
addrPtr = nullptr;
}
else
{
@@ -300,7 +300,7 @@ exit:
otError Commissioner::ProcessProvisioningUrl(uint8_t aArgsLength, char *aArgs[])
{
return otCommissionerSetProvisioningUrl(mInterpreter.mInstance, (aArgsLength > 1) ? aArgs[1] : NULL);
return otCommissionerSetProvisioningUrl(mInterpreter.mInstance, (aArgsLength > 1) ? aArgs[1] : nullptr);
}
otError Commissioner::ProcessSessionId(uint8_t aArgsLength, char *aArgs[])
@@ -392,7 +392,7 @@ otError Commissioner::Process(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength < 1)
{
IgnoreError(ProcessHelp(0, NULL));
IgnoreError(ProcessHelp(0, nullptr));
}
else
{
+2 -2
View File
@@ -62,8 +62,8 @@ extern "C" void otCliConsoleInputLine(char *aBuf, uint16_t aBufLength)
Console::Console(Instance *aInstance)
: Server(aInstance)
, mCallback(NULL)
, mContext(NULL)
, mCallback(nullptr)
, mContext(nullptr)
{
}
+2 -2
View File
@@ -690,13 +690,13 @@ otError Dataset::ProcessMgmtGetCommand(uint8_t aArgsLength, char *aArgs[])
{
SuccessOrExit(error = otDatasetSendMgmtActiveGet(mInterpreter.mInstance, &datasetComponents, tlvs,
static_cast<uint8_t>(length),
destAddrSpecified ? &address : NULL));
destAddrSpecified ? &address : nullptr));
}
else if (strcmp(aArgs[0], "pending") == 0)
{
SuccessOrExit(error = otDatasetSendMgmtPendingGet(mInterpreter.mInstance, &datasetComponents, tlvs,
static_cast<uint8_t>(length),
destAddrSpecified ? &address : NULL));
destAddrSpecified ? &address : nullptr));
}
else
{
+3 -3
View File
@@ -79,7 +79,7 @@ otError Joiner::ProcessId(uint8_t aArgsLength, char *aArgs[])
otError Joiner::ProcessStart(uint8_t aArgsLength, char *aArgs[])
{
otError error;
const char *provisioningUrl = NULL;
const char *provisioningUrl = nullptr;
VerifyOrExit(aArgsLength > 1, error = OT_ERROR_INVALID_ARGS);
@@ -89,7 +89,7 @@ otError Joiner::ProcessStart(uint8_t aArgsLength, char *aArgs[])
}
error = otJoinerStart(mInterpreter.mInstance, aArgs[1], provisioningUrl, PACKAGE_NAME,
OPENTHREAD_CONFIG_PLATFORM_INFO, PACKAGE_VERSION, NULL, &Joiner::HandleCallback, this);
OPENTHREAD_CONFIG_PLATFORM_INFO, PACKAGE_VERSION, nullptr, &Joiner::HandleCallback, this);
exit:
return error;
@@ -111,7 +111,7 @@ otError Joiner::Process(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength < 1)
{
IgnoreError(ProcessHelp(0, NULL));
IgnoreError(ProcessHelp(0, nullptr));
}
else
{
+1 -1
View File
@@ -36,7 +36,7 @@
namespace ot {
namespace Cli {
Server *Server::sServer = NULL;
Server *Server::sServer = nullptr;
int Server::OutputFormat(const char *aFormat, ...)
{
+5 -5
View File
@@ -136,7 +136,7 @@ otError UdpExample::ProcessSend(uint8_t aArgsLength, char *aArgs[])
{
otError error = OT_ERROR_NONE;
otMessageInfo messageInfo;
otMessage * message = NULL;
otMessage * message = nullptr;
uint8_t curArg = 0;
uint16_t payloadLength = 0;
PayloadType payloadType = kTypeText;
@@ -179,8 +179,8 @@ otError UdpExample::ProcessSend(uint8_t aArgsLength, char *aArgs[])
}
}
message = otUdpNewMessage(mInterpreter.mInstance, NULL);
VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS);
message = otUdpNewMessage(mInterpreter.mInstance, nullptr);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
switch (payloadType)
{
@@ -222,7 +222,7 @@ otError UdpExample::ProcessSend(uint8_t aArgsLength, char *aArgs[])
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
otMessageFree(message);
}
@@ -264,7 +264,7 @@ otError UdpExample::Process(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength < 1)
{
IgnoreError(ProcessHelp(0, NULL));
IgnoreError(ProcessHelp(0, nullptr));
error = OT_ERROR_INVALID_ARGS;
}
else
+1 -1
View File
@@ -43,7 +43,7 @@ otError otBackboneRouterGetPrimary(otInstance *aInstance, otBackboneRouterConfig
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aConfig != NULL);
OT_ASSERT(aConfig != nullptr);
return instance.Get<BackboneRouter::Leader>().GetConfig(*aConfig);
}
+3 -3
View File
@@ -59,7 +59,7 @@ void otBackboneRouterGetConfig(otInstance *aInstance, otBackboneRouterConfig *aC
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aConfig != NULL);
OT_ASSERT(aConfig != nullptr);
instance.Get<BackboneRouter::Local>().GetConfig(*aConfig);
}
@@ -68,7 +68,7 @@ void otBackboneRouterSetConfig(otInstance *aInstance, const otBackboneRouterConf
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aConfig != NULL);
OT_ASSERT(aConfig != nullptr);
instance.Get<BackboneRouter::Local>().SetConfig(*aConfig);
}
@@ -105,7 +105,7 @@ otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterCon
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aConfig != NULL);
OT_ASSERT(aConfig != nullptr);
return instance.Get<BackboneRouter::Local>().GetDomainPrefix(*aConfig);
}
+7 -7
View File
@@ -47,7 +47,7 @@ otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *a
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aData != NULL && aDataLength != NULL);
OT_ASSERT(aData != nullptr && aDataLength != nullptr);
return instance.Get<NetworkData::Local>().GetNetworkData(aStable, aData, *aDataLength);
}
@@ -57,7 +57,7 @@ otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRoute
otError error = OT_ERROR_NONE;
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aConfig != NULL);
OT_ASSERT(aConfig != nullptr);
// Add Prefix validation check:
// Thread 1.1 Specification 5.13.2 says
// "A valid prefix MUST NOT allow both DHCPv6 and SLAAC for address configuration"
@@ -85,7 +85,7 @@ otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefi
otError error = OT_ERROR_NONE;
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aPrefix != NULL);
OT_ASSERT(aPrefix != nullptr);
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
error = instance.Get<BackboneRouter::Local>().RemoveDomainPrefix(*aPrefix);
@@ -105,7 +105,7 @@ otError otBorderRouterGetNextOnMeshPrefix(otInstance * aInstance,
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aIterator != NULL && aConfig != NULL);
OT_ASSERT(aIterator != nullptr && aConfig != nullptr);
return instance.Get<NetworkData::Local>().GetNextOnMeshPrefix(*aIterator, *aConfig);
}
@@ -114,7 +114,7 @@ otError otBorderRouterAddRoute(otInstance *aInstance, const otExternalRouteConfi
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aConfig != NULL);
OT_ASSERT(aConfig != nullptr);
return instance.Get<NetworkData::Local>().AddHasRoutePrefix(
aConfig->mPrefix.mPrefix.mFields.m8, aConfig->mPrefix.mLength, aConfig->mPreference, aConfig->mStable);
@@ -124,7 +124,7 @@ otError otBorderRouterRemoveRoute(otInstance *aInstance, const otIp6Prefix *aPre
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aPrefix != NULL);
OT_ASSERT(aPrefix != nullptr);
return instance.Get<NetworkData::Local>().RemoveHasRoutePrefix(aPrefix->mPrefix.mFields.m8, aPrefix->mLength);
}
@@ -135,7 +135,7 @@ otError otBorderRouterGetNextRoute(otInstance * aInstance,
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aIterator != NULL && aConfig != NULL);
OT_ASSERT(aIterator != nullptr && aConfig != nullptr);
return instance.Get<NetworkData::Local>().GetNextExternalRoute(*aIterator, *aConfig);
}
+2 -2
View File
@@ -213,7 +213,7 @@ otError otCoapSendRequestWithParameters(otInstance * aInstance,
Instance & instance = *static_cast<Instance *>(aInstance);
const Coap::TxParameters &txParameters = Coap::TxParameters::From(aTxParameters);
if (aTxParameters != NULL)
if (aTxParameters != nullptr)
{
VerifyOrExit(txParameters.IsValid(), error = OT_ERROR_INVALID_ARGS);
}
@@ -270,7 +270,7 @@ otError otCoapSendResponseWithParameters(otInstance * aInstance,
return instance.GetApplicationCoap().SendMessage(*static_cast<Coap::Message *>(aMessage),
*static_cast<const Ip6::MessageInfo *>(aMessageInfo),
Coap::TxParameters::From(aTxParameters), NULL, NULL);
Coap::TxParameters::From(aTxParameters), nullptr, nullptr);
}
#endif // OPENTHREAD_CONFIG_COAP_API_ENABLE
+3 -3
View File
@@ -61,7 +61,7 @@ void otCoapSecureSetCertificate(otInstance * aInstance,
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aX509Cert != NULL && aX509Length != 0 && aPrivateKey != NULL && aPrivateKeyLength != 0);
OT_ASSERT(aX509Cert != nullptr && aX509Length != 0 && aPrivateKey != nullptr && aPrivateKeyLength != 0);
instance.GetApplicationCoapSecure().SetCertificate(aX509Cert, aX509Length, aPrivateKey, aPrivateKeyLength);
}
@@ -72,7 +72,7 @@ void otCoapSecureSetCaCertificateChain(otInstance * aInstance,
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aX509CaCertificateChain != NULL && aX509CaCertChainLength != 0);
OT_ASSERT(aX509CaCertificateChain != nullptr && aX509CaCertChainLength != 0);
instance.GetApplicationCoapSecure().SetCaCertificateChain(aX509CaCertificateChain, aX509CaCertChainLength);
}
@@ -87,7 +87,7 @@ void otCoapSecureSetPsk(otInstance * aInstance,
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aPsk != NULL && aPskLength != 0 && aPskIdentity != NULL && aPskIdLength != 0);
OT_ASSERT(aPsk != nullptr && aPskLength != 0 && aPskIdentity != nullptr && aPskIdLength != 0);
instance.GetApplicationCoapSecure().SetPreSharedKey(aPsk, aPskLength, aPskIdentity, aPskIdLength);
}
+4 -3
View File
@@ -52,7 +52,7 @@ void otCryptoHmacSha256(const uint8_t *aKey,
{
HmacSha256 hmac;
OT_ASSERT((aKey != NULL) && (aBuf != NULL) && (aHash != NULL));
OT_ASSERT((aKey != nullptr) && (aBuf != nullptr) && (aHash != nullptr));
hmac.Start(aKey, aKeyLength);
hmac.Update(aBuf, aBufLength);
@@ -74,14 +74,15 @@ void otCryptoAesCcm(const uint8_t *aKey,
{
AesCcm aesCcm;
OT_ASSERT((aKey != NULL) && (aNonce != NULL) && (aPlainText != NULL) && (aCipherText != NULL) && (aTag != NULL));
OT_ASSERT((aKey != nullptr) && (aNonce != nullptr) && (aPlainText != nullptr) && (aCipherText != nullptr) &&
(aTag != nullptr));
aesCcm.SetKey(aKey, aKeyLength);
aesCcm.Init(aHeaderLength, aLength, aTagLength, aNonce, aNonceLength);
if (aHeaderLength != 0)
{
OT_ASSERT(aHeader != NULL);
OT_ASSERT(aHeader != nullptr);
aesCcm.Header(aHeader, aHeaderLength);
}
+8 -8
View File
@@ -61,7 +61,7 @@ otError otDatasetGetActive(otInstance *aInstance, otOperationalDataset *aDataset
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::ActiveDataset>().Read(*aDataset);
}
@@ -70,7 +70,7 @@ otError otDatasetGetActiveTlvs(otInstance *aInstance, otOperationalDatasetTlvs *
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::ActiveDataset>().Read(*aDataset);
}
@@ -79,7 +79,7 @@ otError otDatasetSetActive(otInstance *aInstance, const otOperationalDataset *aD
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::ActiveDataset>().Save(*aDataset);
}
@@ -88,7 +88,7 @@ otError otDatasetSetActiveTlvs(otInstance *aInstance, const otOperationalDataset
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::ActiveDataset>().Save(*aDataset);
}
@@ -97,7 +97,7 @@ otError otDatasetGetPending(otInstance *aInstance, otOperationalDataset *aDatase
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::PendingDataset>().Read(*aDataset);
}
@@ -106,7 +106,7 @@ otError otDatasetGetPendingTlvs(otInstance *aInstance, otOperationalDatasetTlvs
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::PendingDataset>().Read(*aDataset);
}
@@ -115,7 +115,7 @@ otError otDatasetSetPending(otInstance *aInstance, const otOperationalDataset *a
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::PendingDataset>().Save(*aDataset);
}
@@ -124,7 +124,7 @@ otError otDatasetSetPendingTlvs(otInstance *aInstance, const otOperationalDatase
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aDataset != NULL);
OT_ASSERT(aDataset != nullptr);
return instance.Get<MeshCoP::PendingDataset>().Save(*aDataset);
}
+1 -1
View File
@@ -50,7 +50,7 @@ void *otHeapCAlloc(size_t aCount, size_t aSize)
OT_ASSERT(false);
// This function is reachable when asserts are disabled
OT_UNREACHABLE_CODE(return NULL;)
OT_UNREACHABLE_CODE(return nullptr;)
}
void otHeapFree(void *aPointer)
+3 -3
View File
@@ -182,7 +182,7 @@ otMessage *otIp6NewMessageFromBuffer(otInstance * aInstance,
Instance &instance = *static_cast<Instance *>(aInstance);
Message * message;
if (aSettings != NULL)
if (aSettings != nullptr)
{
message = instance.Get<Ip6::Ip6>().NewMessage(aData, aDataLength, Message::Settings(aSettings));
}
@@ -234,7 +234,7 @@ otError otIp6AddressFromString(const char *aString, otIp6Address *aAddress)
uint8_t otIp6PrefixMatch(const otIp6Address *aFirst, const otIp6Address *aSecond)
{
OT_ASSERT(aFirst != NULL && aSecond != NULL);
OT_ASSERT(aFirst != nullptr && aSecond != nullptr);
return static_cast<const Ip6::Address *>(aFirst)->PrefixMatch(*static_cast<const Ip6::Address *>(aSecond));
}
@@ -251,7 +251,7 @@ otError otIp6SelectSourceAddress(otInstance *aInstance, otMessageInfo *aMessageI
const Ip6::NetifUnicastAddress *netifAddr;
netifAddr = instance.Get<Ip6::Ip6>().SelectSourceAddress(*static_cast<Ip6::MessageInfo *>(aMessageInfo));
VerifyOrExit(netifAddr != NULL, error = OT_ERROR_NOT_FOUND);
VerifyOrExit(netifAddr != nullptr, error = OT_ERROR_NOT_FOUND);
memcpy(&aMessageInfo->mSockAddr, &netifAddr->mAddress, sizeof(aMessageInfo->mSockAddr));
exit:
+6 -6
View File
@@ -116,7 +116,7 @@ otError otLinkSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExt
otError error = OT_ERROR_NONE;
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aExtAddress != NULL);
OT_ASSERT(aExtAddress != nullptr);
VerifyOrExit(instance.Get<Mle::MleRouter>().IsDisabled(), error = OT_ERROR_INVALID_STATE);
instance.Get<Mac::Mac>().SetExtAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
@@ -236,7 +236,7 @@ otError otLinkFilterAddAddress(otInstance *aInstance, const otExtAddress *aExtAd
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aExtAddress != NULL);
OT_ASSERT(aExtAddress != nullptr);
return instance.Get<Mac::Filter>().AddAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
}
@@ -245,7 +245,7 @@ otError otLinkFilterRemoveAddress(otInstance *aInstance, const otExtAddress *aEx
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aExtAddress != NULL);
OT_ASSERT(aExtAddress != nullptr);
return instance.Get<Mac::Filter>().RemoveAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
}
@@ -261,7 +261,7 @@ otError otLinkFilterGetNextAddress(otInstance *aInstance, otMacFilterIterator *a
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aIterator != NULL && aEntry != NULL);
OT_ASSERT(aIterator != nullptr && aEntry != nullptr);
return instance.Get<Mac::Filter>().GetNextAddress(*aIterator, *aEntry);
}
@@ -291,7 +291,7 @@ otError otLinkFilterGetNextRssIn(otInstance *aInstance, otMacFilterIterator *aIt
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aIterator != NULL && aEntry != NULL);
OT_ASSERT(aIterator != nullptr && aEntry != nullptr);
return instance.Get<Mac::Filter>().GetNextRssIn(*aIterator, *aEntry);
}
@@ -322,7 +322,7 @@ const uint32_t *otLinkGetTxDirectRetrySuccessHistogram(otInstance *aInstance, ui
const uint32_t *otLinkGetTxIndirectRetrySuccessHistogram(otInstance *aInstance, uint8_t *aNumberOfEntries)
{
const uint32_t *histogram = NULL;
const uint32_t *histogram = nullptr;
#if OPENTHREAD_FTD
Instance &instance = *static_cast<Instance *>(aInstance);
+3 -3
View File
@@ -115,7 +115,7 @@ int otMessageWrite(otMessage *aMessage, uint16_t aOffset, const void *aBuf, uint
void otMessageQueueInit(otMessageQueue *aQueue)
{
aQueue->mData = NULL;
aQueue->mData = nullptr;
}
void otMessageQueueEnqueue(otMessageQueue *aQueue, otMessage *aMessage)
@@ -152,13 +152,13 @@ otMessage *otMessageQueueGetNext(otMessageQueue *aQueue, const otMessage *aMessa
{
Message *next;
VerifyOrExit(aMessage != NULL, next = NULL);
VerifyOrExit(aMessage != nullptr, next = nullptr);
{
const Message &message = *static_cast<const Message *>(aMessage);
MessageQueue & queue = *static_cast<MessageQueue *>(aQueue);
VerifyOrExit(message.GetMessageQueue() == &queue, next = NULL);
VerifyOrExit(message.GetMessageQueue() == &queue, next = nullptr);
next = message.GetNext();
}
+1 -1
View File
@@ -44,7 +44,7 @@ otError otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aData != NULL && aDataLength != NULL);
OT_ASSERT(aData != nullptr && aDataLength != nullptr);
return instance.Get<NetworkData::Leader>().GetNetworkData(aStable, aData, *aDataLength);
}
+1 -1
View File
@@ -46,7 +46,7 @@ otError otServerGetNetDataLocal(otInstance *aInstance, bool aStable, uint8_t *aD
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aData != NULL && aDataLength != NULL);
OT_ASSERT(aData != nullptr && aDataLength != nullptr);
return instance.Get<NetworkData::Local>().GetNetworkData(aStable, aData, *aDataLength);
}
+9 -9
View File
@@ -89,7 +89,7 @@ otError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aLeaderRloc)
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aLeaderRloc != NULL);
OT_ASSERT(aLeaderRloc != nullptr);
return instance.Get<Mle::MleRouter>().GetLeaderAddress(*static_cast<Ip6::Address *>(aLeaderRloc));
}
@@ -123,7 +123,7 @@ otError otThreadSetMasterKey(otInstance *aInstance, const otMasterKey *aKey)
otError error = OT_ERROR_NONE;
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aKey != NULL);
OT_ASSERT(aKey != nullptr);
VerifyOrExit(instance.Get<Mle::MleRouter>().IsDisabled(), error = OT_ERROR_INVALID_STATE);
@@ -243,7 +243,7 @@ otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance)
{
Instance & instance = *static_cast<Instance *>(aInstance);
const otIp6InterfaceIdentifier *iid = NULL;
const otIp6InterfaceIdentifier *iid = nullptr;
if (instance.Get<DuaManager>().IsFixedDuaInterfaceIdentifierSet())
{
@@ -302,7 +302,7 @@ otError otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterato
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT((aInfo != NULL) && (aIterator != NULL));
OT_ASSERT((aInfo != nullptr) && (aIterator != nullptr));
return instance.Get<Mle::MleRouter>().GetNextNeighborInfo(*aIterator, *aInfo);
}
@@ -319,7 +319,7 @@ otError otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
Instance &instance = *static_cast<Instance *>(aInstance);
otError error = OT_ERROR_NONE;
OT_ASSERT(aLeaderData != NULL);
OT_ASSERT(aLeaderData != nullptr);
VerifyOrExit(instance.Get<Mle::MleRouter>().IsAttached(), error = OT_ERROR_DETACHED);
*aLeaderData = instance.Get<Mle::MleRouter>().GetLeaderData();
@@ -362,7 +362,7 @@ otError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
otError error = OT_ERROR_NONE;
Router * parent;
OT_ASSERT(aParentInfo != NULL);
OT_ASSERT(aParentInfo != nullptr);
// Reference device needs get the original parent's info even after the node state changed.
#if !OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
@@ -393,7 +393,7 @@ otError otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
otError error = OT_ERROR_NONE;
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aParentRssi != NULL);
OT_ASSERT(aParentRssi != nullptr);
*aParentRssi = instance.Get<Mle::MleRouter>().GetParent().GetLinkInfo().GetAverageRss();
@@ -408,7 +408,7 @@ otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi)
otError error = OT_ERROR_NONE;
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aLastRssi != NULL);
OT_ASSERT(aLastRssi != nullptr);
*aLastRssi = instance.Get<Mle::MleRouter>().GetParent().GetLinkInfo().GetLastRss();
@@ -459,7 +459,7 @@ otError otThreadDiscover(otInstance * aInstance,
return instance.Get<Mle::DiscoverScanner>().Discover(
static_cast<Mac::ChannelMask>(aScanChannels), aPanId, aJoiner, aEnableEui64Filtering,
/* aFilterIndexes (use hash of factory EUI64) */ NULL, aCallback, aCallbackContext);
/* aFilterIndexes (use hash of factory EUI64) */ nullptr, aCallback, aCallbackContext);
}
bool otThreadIsDiscoverInProgress(otInstance *aInstance)
+5 -5
View File
@@ -257,7 +257,7 @@ otError otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChi
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aChildInfo != NULL);
OT_ASSERT(aChildInfo != nullptr);
return instance.Get<Mle::MleRouter>().GetChildInfoById(aChildId, *aChildInfo);
}
@@ -266,7 +266,7 @@ otError otThreadGetChildInfoByIndex(otInstance *aInstance, uint16_t aChildIndex,
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aChildInfo != NULL);
OT_ASSERT(aChildInfo != nullptr);
return instance.Get<Mle::MleRouter>().GetChildInfoByIndex(aChildIndex, *aChildInfo);
}
@@ -281,7 +281,7 @@ otError otThreadGetChildNextIp6Address(otInstance * aInstance,
Child::Ip6AddressIterator iterator;
Ip6::Address * address;
OT_ASSERT(aIterator != NULL && aAddress != NULL);
OT_ASSERT(aIterator != nullptr && aAddress != nullptr);
address = static_cast<Ip6::Address *>(aAddress);
iterator.Set(*aIterator);
@@ -311,7 +311,7 @@ otError otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRoute
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aRouterInfo != NULL);
OT_ASSERT(aRouterInfo != nullptr);
return instance.Get<RouterTable>().GetRouterInfo(aRouterId, *aRouterInfo);
}
@@ -320,7 +320,7 @@ otError otThreadGetNextCacheEntry(otInstance *aInstance, otCacheEntryInfo *aEntr
{
Instance &instance = *static_cast<Instance *>(aInstance);
OT_ASSERT((aIterator != NULL) && (aEntryInfo != NULL));
OT_ASSERT((aIterator != nullptr) && (aEntryInfo != nullptr));
return instance.Get<AddressResolver>().GetNextCacheEntry(*aEntryInfo, *aIterator);
}
+1 -1
View File
@@ -105,7 +105,7 @@ void otUdpForwardReceive(otInstance * aInstance,
Ip6::MessageInfo messageInfo;
Instance & instance = *static_cast<Instance *>(aInstance);
OT_ASSERT(aMessage != NULL && aPeerAddr != NULL);
OT_ASSERT(aMessage != nullptr && aPeerAddr != nullptr);
messageInfo.SetSockAddr(instance.Get<Mle::MleRouter>().GetMeshLocal16());
messageInfo.SetSockPort(aSockPort);
+2 -2
View File
@@ -139,10 +139,10 @@ public:
/**
* This method gets the Domain Prefix in the Thread Network.
*
* @retval A pointer to the Domain Prefix or NULL if there is no Domain Prefix.
* @retval A pointer to the Domain Prefix or nullptr if there is no Domain Prefix.
*
*/
const otIp6Prefix *GetDomainPrefix(void) const { return (mDomainPrefix.mLength == 0) ? NULL : &mDomainPrefix; }
const otIp6Prefix *GetDomainPrefix(void) const { return (mDomainPrefix.mLength == 0) ? nullptr : &mDomainPrefix; }
/**
* This method indicates whether or not the Domain Prefix is available in the Thread Network.
+62 -62
View File
@@ -52,18 +52,18 @@ CoapBase::CoapBase(Instance &aInstance, Sender aSender)
, mMessageId(Random::NonCrypto::GetUint16())
, mRetransmissionTimer(aInstance, Coap::HandleRetransmissionTimer, this)
, mResources()
, mContext(NULL)
, mInterceptor(NULL)
, mContext(nullptr)
, mInterceptor(nullptr)
, mResponsesQueue(aInstance)
, mDefaultHandler(NULL)
, mDefaultHandlerContext(NULL)
, mDefaultHandler(nullptr)
, mDefaultHandlerContext(nullptr)
, mSender(aSender)
{
}
void CoapBase::ClearRequestsAndResponses(void)
{
ClearRequests(NULL); // Clear requests matching any address.
ClearRequests(nullptr); // Clear requests matching any address.
mResponsesQueue.DequeueAllResponses();
}
@@ -76,16 +76,16 @@ void CoapBase::ClearRequests(const Ip6::Address *aAddress)
{
Message *nextMessage;
for (Message *message = mPendingRequests.GetHead(); message != NULL; message = nextMessage)
for (Message *message = mPendingRequests.GetHead(); message != nullptr; message = nextMessage)
{
Metadata metadata;
nextMessage = message->GetNextCoapMessage();
metadata.ReadFrom(*message);
if ((aAddress == NULL) || (metadata.mSourceAddress == *aAddress))
if ((aAddress == nullptr) || (metadata.mSourceAddress == *aAddress))
{
FinalizeCoapTransaction(*message, metadata, NULL, NULL, OT_ERROR_ABORT);
FinalizeCoapTransaction(*message, metadata, nullptr, nullptr, OT_ERROR_ABORT);
}
}
}
@@ -98,7 +98,7 @@ void CoapBase::AddResource(Resource &aResource)
void CoapBase::RemoveResource(Resource &aResource)
{
IgnoreError(mResources.Remove(aResource));
aResource.SetNext(NULL);
aResource.SetNext(nullptr);
}
void CoapBase::SetDefaultHandler(RequestHandler aHandler, void *aContext)
@@ -115,9 +115,9 @@ void CoapBase::SetInterceptor(Interceptor aInterceptor, void *aContext)
Message *CoapBase::NewMessage(const Message::Settings &aSettings)
{
Message *message = NULL;
Message *message = nullptr;
VerifyOrExit((message = static_cast<Message *>(Get<Ip6::Udp>().NewMessage(0, aSettings))) != NULL, OT_NOOP);
VerifyOrExit((message = static_cast<Message *>(Get<Ip6::Udp>().NewMessage(0, aSettings))) != nullptr, OT_NOOP);
message->SetOffset(0);
exit:
@@ -136,7 +136,7 @@ otError CoapBase::SendMessage(Message & aMessage,
void * aContext)
{
otError error;
Message *storedCopy = NULL;
Message *storedCopy = nullptr;
uint16_t copyLength = 0;
switch (aMessage.GetType())
@@ -158,7 +158,7 @@ otError CoapBase::SendMessage(Message & aMessage,
{
copyLength = aMessage.GetLength();
}
else if (aMessage.IsNonConfirmable() && (aHandler != NULL))
else if (aMessage.IsNonConfirmable() && (aHandler != nullptr))
{
// As we do not retransmit non confirmable messages, create a
// copy of header only, for token information.
@@ -175,7 +175,7 @@ otError CoapBase::SendMessage(Message & aMessage,
bool observe;
SuccessOrExit(error = iterator.Init(&aMessage));
observe = (iterator.GetFirstOptionMatching(OT_COAP_OPTION_OBSERVE) != NULL);
observe = (iterator.GetFirstOptionMatching(OT_COAP_OPTION_OBSERVE) != nullptr);
// Special case, if we're sending a GET with Observe=1, that is a cancellation.
if (observe && (aMessage.GetCode() == OT_COAP_CODE_GET))
@@ -194,9 +194,9 @@ otError CoapBase::SendMessage(Message & aMessage,
// If we can find the previous handler context, cancel that too. Peer address
// and tokens, etc should all match.
Message *origRequest = FindRelatedRequest(aMessage, aMessageInfo, handlerMetadata);
if (origRequest != NULL)
if (origRequest != nullptr)
{
FinalizeCoapTransaction(*origRequest, handlerMetadata, NULL, NULL, OT_ERROR_NONE);
FinalizeCoapTransaction(*origRequest, handlerMetadata, nullptr, nullptr, OT_ERROR_NONE);
}
}
}
@@ -219,14 +219,14 @@ otError CoapBase::SendMessage(Message & aMessage,
(metadata.mConfirmable ? metadata.mRetransmissionTimeout : aTxParameters.CalculateMaxTransmitWait());
storedCopy = CopyAndEnqueueMessage(aMessage, copyLength, metadata);
VerifyOrExit(storedCopy != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(storedCopy != nullptr, error = OT_ERROR_NO_BUFS);
}
SuccessOrExit(error = Send(aMessage, aMessageInfo));
exit:
if (error != OT_ERROR_NONE && storedCopy != NULL)
if (error != OT_ERROR_NONE && storedCopy != nullptr)
{
DequeueMessage(*storedCopy);
}
@@ -266,11 +266,11 @@ otError CoapBase::SendNotFound(const Message &aRequest, const Ip6::MessageInfo &
otError CoapBase::SendEmptyMessage(Message::Type aType, const Message &aRequest, const Ip6::MessageInfo &aMessageInfo)
{
otError error = OT_ERROR_NONE;
Message *message = NULL;
Message *message = nullptr;
VerifyOrExit(aRequest.IsConfirmable(), error = OT_ERROR_INVALID_ARGS);
VerifyOrExit((message = NewMessage()) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMessage()) != nullptr, error = OT_ERROR_NO_BUFS);
message->Init(aType, OT_COAP_CODE_EMPTY);
message->SetMessageId(aRequest.GetMessageId());
@@ -280,7 +280,7 @@ otError CoapBase::SendEmptyMessage(Message::Type aType, const Message &aRequest,
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -291,10 +291,10 @@ exit:
otError CoapBase::SendHeaderResponse(Message::Code aCode, const Message &aRequest, const Ip6::MessageInfo &aMessageInfo)
{
otError error = OT_ERROR_NONE;
Message *message = NULL;
Message *message = nullptr;
VerifyOrExit(aRequest.IsRequest(), error = OT_ERROR_INVALID_ARGS);
VerifyOrExit((message = NewMessage()) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMessage()) != nullptr, error = OT_ERROR_NO_BUFS);
switch (aRequest.GetType())
{
@@ -318,7 +318,7 @@ otError CoapBase::SendHeaderResponse(Message::Code aCode, const Message &aReques
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -339,7 +339,7 @@ void CoapBase::HandleRetransmissionTimer(void)
Message * nextMessage;
Ip6::MessageInfo messageInfo;
for (Message *message = mPendingRequests.GetHead(); message != NULL; message = nextMessage)
for (Message *message = mPendingRequests.GetHead(); message != nullptr; message = nextMessage)
{
nextMessage = message->GetNextCoapMessage();
@@ -358,7 +358,7 @@ void CoapBase::HandleRetransmissionTimer(void)
if (!metadata.mConfirmable || (metadata.mRetransmissionsRemaining == 0))
{
// No expected response or acknowledgment.
FinalizeCoapTransaction(*message, metadata, NULL, NULL, OT_ERROR_RESPONSE_TIMEOUT);
FinalizeCoapTransaction(*message, metadata, nullptr, nullptr, OT_ERROR_RESPONSE_TIMEOUT);
continue;
}
@@ -399,7 +399,7 @@ void CoapBase::FinalizeCoapTransaction(Message & aRequest,
{
DequeueMessage(aRequest);
if (aMetadata.mResponseHandler != NULL)
if (aMetadata.mResponseHandler != nullptr)
{
aMetadata.mResponseHandler(aMetadata.mResponseContext, aResponse, aMessageInfo, aResult);
}
@@ -411,14 +411,14 @@ otError CoapBase::AbortTransaction(ResponseHandler aHandler, void *aContext)
Message *nextMessage;
Metadata metadata;
for (Message *message = mPendingRequests.GetHead(); message != NULL; message = nextMessage)
for (Message *message = mPendingRequests.GetHead(); message != nullptr; message = nextMessage)
{
nextMessage = message->GetNextCoapMessage();
metadata.ReadFrom(*message);
if (metadata.mResponseHandler == aHandler && metadata.mResponseContext == aContext)
{
FinalizeCoapTransaction(*message, metadata, NULL, NULL, OT_ERROR_ABORT);
FinalizeCoapTransaction(*message, metadata, nullptr, nullptr, OT_ERROR_ABORT);
error = OT_ERROR_NONE;
}
}
@@ -429,9 +429,9 @@ otError CoapBase::AbortTransaction(ResponseHandler aHandler, void *aContext)
Message *CoapBase::CopyAndEnqueueMessage(const Message &aMessage, uint16_t aCopyLength, const Metadata &aMetadata)
{
otError error = OT_ERROR_NONE;
Message *messageCopy = NULL;
Message *messageCopy = nullptr;
VerifyOrExit((messageCopy = aMessage.Clone(aCopyLength)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((messageCopy = aMessage.Clone(aCopyLength)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = aMetadata.AppendTo(*messageCopy));
@@ -441,10 +441,10 @@ Message *CoapBase::CopyAndEnqueueMessage(const Message &aMessage, uint16_t aCopy
exit:
if (error != OT_ERROR_NONE && messageCopy != NULL)
if (error != OT_ERROR_NONE && messageCopy != nullptr)
{
messageCopy->Free();
messageCopy = NULL;
messageCopy = nullptr;
}
return messageCopy;
@@ -454,7 +454,7 @@ void CoapBase::DequeueMessage(Message &aMessage)
{
mPendingRequests.Dequeue(aMessage);
if (mRetransmissionTimer.IsRunning() && (mPendingRequests.GetHead() == NULL))
if (mRetransmissionTimer.IsRunning() && (mPendingRequests.GetHead() == nullptr))
{
mRetransmissionTimer.Stop();
}
@@ -468,11 +468,11 @@ void CoapBase::DequeueMessage(Message &aMessage)
void CoapBase::SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error;
Message *messageCopy = NULL;
Message *messageCopy = nullptr;
// Create a message copy for lower layers.
messageCopy = aMessage.Clone(aMessage.GetLength() - sizeof(Metadata));
VerifyOrExit(messageCopy != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(messageCopy != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = Send(*messageCopy, aMessageInfo));
@@ -482,7 +482,7 @@ exit:
{
otLogWarnCoap("Failed to send copy: %s", otThreadErrorToString(error));
if (messageCopy != NULL)
if (messageCopy != nullptr)
{
messageCopy->Free();
}
@@ -495,7 +495,7 @@ Message *CoapBase::FindRelatedRequest(const Message & aResponse,
{
Message *message;
for (message = mPendingRequests.GetHead(); message != NULL; message = message->GetNextCoapMessage())
for (message = mPendingRequests.GetHead(); message != nullptr; message = message->GetNextCoapMessage())
{
aMetadata.ReadFrom(*message);
@@ -556,14 +556,14 @@ void CoapBase::Receive(ot::Message &aMessage, const Ip6::MessageInfo &aMessageIn
void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
Metadata metadata;
Message *request = NULL;
Message *request = nullptr;
otError error = OT_ERROR_NONE;
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
bool responseObserve = false;
#endif
request = FindRelatedRequest(aMessage, aMessageInfo, metadata);
VerifyOrExit(request != NULL, OT_NOOP);
VerifyOrExit(request != nullptr, OT_NOOP);
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
if (metadata.mObserve && request->IsRequest())
@@ -572,7 +572,7 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo
OptionIterator iterator;
SuccessOrExit(error = iterator.Init(&aMessage));
responseObserve = (iterator.GetFirstOptionMatching(OT_COAP_OPTION_OBSERVE) != NULL);
responseObserve = (iterator.GetFirstOptionMatching(OT_COAP_OPTION_OBSERVE) != nullptr);
}
#endif
@@ -581,7 +581,7 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo
case OT_COAP_TYPE_RESET:
if (aMessage.IsEmpty())
{
FinalizeCoapTransaction(*request, metadata, NULL, NULL, OT_ERROR_ABORT);
FinalizeCoapTransaction(*request, metadata, nullptr, nullptr, OT_ERROR_ABORT);
}
// Silently ignore non-empty reset messages (RFC 7252, p. 4.2).
@@ -612,7 +612,7 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo
// Remove the message if response is not expected, otherwise await
// response.
if (metadata.mResponseHandler == NULL)
if (metadata.mResponseHandler == nullptr)
{
DequeueMessage(*request);
}
@@ -625,7 +625,7 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo
// dealing with RFC7641 rules here.
// (If there is no response handler, then we're wasting our time!)
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
if (metadata.mObserve && responseObserve && (metadata.mResponseHandler != NULL))
if (metadata.mObserve && responseObserve && (metadata.mResponseHandler != nullptr))
{
// This is a RFC7641 notification. The request is *not* done!
metadata.mResponseHandler(metadata.mResponseContext, &aMessage, &aMessageInfo, OT_ERROR_NONE);
@@ -654,11 +654,11 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo
// Separate response or observation notification. If the request was to a multicast
// address, OR both the request and response carry Observe options, then this is NOT
// the final message, we may see multiples.
if ((metadata.mResponseHandler != NULL) && (metadata.mDestinationAddress.IsMulticast()
if ((metadata.mResponseHandler != nullptr) && (metadata.mDestinationAddress.IsMulticast()
#if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
|| (metadata.mObserve && responseObserve)
|| (metadata.mObserve && responseObserve)
#endif
))
))
{
// If multicast non-confirmable request, allow multiple responses
metadata.mResponseHandler(metadata.mResponseContext, &aMessage, &aMessageInfo, OT_ERROR_NONE);
@@ -673,7 +673,7 @@ void CoapBase::ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo
exit:
if (error == OT_ERROR_NONE && request == NULL)
if (error == OT_ERROR_NONE && request == nullptr)
{
if (aMessage.IsConfirmable() || aMessage.IsNonConfirmable())
{
@@ -688,11 +688,11 @@ void CoapBase::ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo
{
char uriPath[Resource::kMaxReceivedUriPath];
char * curUriPath = uriPath;
Message * cachedResponse = NULL;
Message * cachedResponse = nullptr;
otError error = OT_ERROR_NOT_FOUND;
OptionIterator iterator;
if (mInterceptor != NULL)
if (mInterceptor != nullptr)
{
SuccessOrExit(error = mInterceptor(aMessage, aMessageInfo, mContext));
}
@@ -714,7 +714,7 @@ void CoapBase::ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo
}
SuccessOrExit(error = iterator.Init(&aMessage));
for (const otCoapOption *option = iterator.GetFirstOption(); option != NULL; option = iterator.GetNextOption())
for (const otCoapOption *option = iterator.GetFirstOption(); option != nullptr; option = iterator.GetNextOption())
{
switch (option->mNumber)
{
@@ -764,7 +764,7 @@ exit:
IgnoreError(SendNotFound(aMessage, aMessageInfo));
}
if (cachedResponse != NULL)
if (cachedResponse != nullptr)
{
cachedResponse->Free();
}
@@ -798,10 +798,10 @@ otError ResponsesQueue::GetMatchedResponseCopy(const Message & aRequest,
const Message *cacheResponse;
cacheResponse = FindMatchedResponse(aRequest, aMessageInfo);
VerifyOrExit(cacheResponse != NULL, error = OT_ERROR_NOT_FOUND);
VerifyOrExit(cacheResponse != nullptr, error = OT_ERROR_NOT_FOUND);
*aResponse = cacheResponse->Clone(cacheResponse->GetLength() - sizeof(ResponseMetadata));
VerifyOrExit(*aResponse != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(*aResponse != nullptr, error = OT_ERROR_NO_BUFS);
exit:
return error;
@@ -811,7 +811,7 @@ const Message *ResponsesQueue::FindMatchedResponse(const Message &aRequest, cons
{
Message *message;
for (message = mQueue.GetHead(); message != NULL; message = message->GetNextCoapMessage())
for (message = mQueue.GetHead(); message != nullptr; message = message->GetNextCoapMessage())
{
if (message->GetMessageId() == aRequest.GetMessageId())
{
@@ -840,11 +840,11 @@ void ResponsesQueue::EnqueueResponse(Message & aMessage,
metadata.mDequeueTime = TimerMilli::GetNow() + aTxParameters.CalculateExchangeLifetime();
metadata.mMessageInfo = aMessageInfo;
VerifyOrExit(FindMatchedResponse(aMessage, aMessageInfo) == NULL, OT_NOOP);
VerifyOrExit(FindMatchedResponse(aMessage, aMessageInfo) == nullptr, OT_NOOP);
UpdateQueue();
VerifyOrExit((responseCopy = aMessage.Clone()) != NULL, OT_NOOP);
VerifyOrExit((responseCopy = aMessage.Clone()) != nullptr, OT_NOOP);
VerifyOrExit(metadata.AppendTo(*responseCopy) == OT_ERROR_NONE, responseCopy->Free());
@@ -859,20 +859,20 @@ exit:
void ResponsesQueue::UpdateQueue(void)
{
uint16_t msgCount = 0;
Message * earliestMsg = NULL;
Message * earliestMsg = nullptr;
TimeMilli earliestDequeueTime(0);
// Check the number of messages in the queue and if number is at
// `kMaxCachedResponses` remove the one with earliest dequeue
// time.
for (Message *message = mQueue.GetHead(); message != NULL; message = message->GetNextCoapMessage())
for (Message *message = mQueue.GetHead(); message != nullptr; message = message->GetNextCoapMessage())
{
ResponseMetadata metadata;
metadata.ReadFrom(*message);
if ((earliestMsg == NULL) || (metadata.mDequeueTime < earliestDequeueTime))
if ((earliestMsg == nullptr) || (metadata.mDequeueTime < earliestDequeueTime))
{
earliestMsg = message;
earliestDequeueTime = metadata.mDequeueTime;
@@ -897,7 +897,7 @@ void ResponsesQueue::DequeueAllResponses(void)
{
Message *message;
while ((message = mQueue.GetHead()) != NULL)
while ((message = mQueue.GetHead()) != nullptr)
{
DequeueResponse(*message);
}
@@ -914,7 +914,7 @@ void ResponsesQueue::HandleTimer(void)
TimeMilli nextDequeueTime = now.GetDistantFuture();
Message * nextMessage;
for (Message *message = mQueue.GetHead(); message != NULL; message = nextMessage)
for (Message *message = mQueue.GetHead(); message != nullptr; message = nextMessage)
{
ResponseMetadata metadata;
+13 -13
View File
@@ -90,11 +90,11 @@ public:
/**
* This static method coverts a pointer to `otCoapTxParameters` to `Coap::TxParamters`
*
* If the pointer is NULL, the default parameters are used instead.
* If the pointer is nullptr, the default parameters are used instead.
*
* @param[in] aTxParameters A pointer to tx parameter.
*
* @returns A reference to corresponding `TxParamters` if @p aTxParameters is not NULL, otherwise the default tx
* @returns A reference to corresponding `TxParamters` if @p aTxParameters is not nullptr, otherwise the default tx
* parameters.
*
*/
@@ -154,7 +154,7 @@ public:
/**
* This constructor initializes the resource.
*
* @param[in] aUriPath A pointer to a NULL-terminated string for the URI path.
* @param[in] aUriPath A pointer to a null-terminated string for the URI path.
* @param[in] aHandler A function pointer that is called when receiving a CoAP message for @p aUriPath.
* @param[in] aContext A pointer to arbitrary context information.
*/
@@ -163,7 +163,7 @@ public:
mUriPath = aUriPath;
mHandler = aHandler;
mContext = aContext;
mNext = NULL;
mNext = nullptr;
}
/**
@@ -322,7 +322,7 @@ public:
/* This method sets the default handler for unhandled CoAP requests.
*
* @param[in] aHandler A function pointer that shall be called when an unhandled request arrives.
* @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.
* @param[in] aContext A pointer to arbitrary context information. May be nullptr if not used.
*
*/
void SetDefaultHandler(RequestHandler aHandler, void *aContext);
@@ -332,7 +332,7 @@ public:
*
* @param[in] aSettings The message settings.
*
* @returns A pointer to the message or NULL if failed to allocate message.
* @returns A pointer to the message or nullptr if failed to allocate message.
*
*/
Message *NewMessage(const Message::Settings &aSettings = Message::Settings::GetDefault());
@@ -340,7 +340,7 @@ public:
/**
* This method creates a new message with a CoAP header that has Network Control priority level.
*
* @returns A pointer to the message or NULL if failed to allocate message.
* @returns A pointer to the message or nullptr if failed to allocate message.
*
*/
Message *NewPriorityMessage(void)
@@ -352,7 +352,7 @@ public:
* This method sends a CoAP message with custom transmission parameters.
*
* If a response for a request is expected, respective function and context information should be provided.
* If no response is expected, these arguments should be NULL pointers.
* If no response is expected, these arguments should be nullptr pointers.
* If Message Id was not set in the header (equal to 0), this function will assign unique Message Id to the message.
*
* @param[in] aMessage A reference to the message to send.
@@ -368,14 +368,14 @@ public:
otError SendMessage(Message & aMessage,
const Ip6::MessageInfo &aMessageInfo,
const TxParameters & aTxParameters,
ResponseHandler aHandler = NULL,
void * aContext = NULL);
ResponseHandler aHandler = nullptr,
void * aContext = nullptr);
/**
* This method sends a CoAP message with default transmission parameters.
*
* If a response for a request is expected, respective function and context information should be provided.
* If no response is expected, these arguments should be NULL pointers.
* If no response is expected, these arguments should be nullptr pointers.
* If Message Id was not set in the header (equal to 0), this function will assign unique Message Id to the message.
*
* @param[in] aMessage A reference to the message to send.
@@ -389,8 +389,8 @@ public:
*/
otError SendMessage(Message & aMessage,
const Ip6::MessageInfo &aMessageInfo,
ResponseHandler aHandler = NULL,
void * aContext = NULL);
ResponseHandler aHandler = nullptr,
void * aContext = nullptr);
/**
* This method sends a CoAP reset message.
+9 -9
View File
@@ -175,7 +175,7 @@ otError Message::AppendUriPathOptions(const char *aUriPath)
const char *cur = aUriPath;
const char *end;
while ((end = strchr(cur, '/')) != NULL)
while ((end = strchr(cur, '/')) != nullptr)
{
SuccessOrExit(error = AppendOption(OT_COAP_OPTION_URI_PATH, static_cast<uint16_t>(end - cur), cur));
cur = end + 1;
@@ -258,7 +258,7 @@ otError Message::ParseHeader(void)
VerifyOrExit(GetTokenLength() <= kMaxTokenLength, error = OT_ERROR_PARSE);
SuccessOrExit(error = iterator.Init(this));
for (const otCoapOption *option = iterator.GetFirstOption(); option != NULL; option = iterator.GetNextOption())
for (const otCoapOption *option = iterator.GetFirstOption(); option != nullptr; option = iterator.GetNextOption())
{
}
@@ -304,7 +304,7 @@ Message *Message::Clone(uint16_t aLength) const
{
Message *message = static_cast<Message *>(ot::Message::Clone(aLength));
VerifyOrExit(message != NULL, OT_NOOP);
VerifyOrExit(message != nullptr, OT_NOOP);
memcpy(&message->GetHelpData(), &GetHelpData(), sizeof(GetHelpData()));
@@ -434,9 +434,9 @@ exit:
const otCoapOption *OptionIterator::GetFirstOptionMatching(uint16_t aOption)
{
const otCoapOption *rval = NULL;
const otCoapOption *rval = nullptr;
for (const otCoapOption *option = GetFirstOption(); option != NULL; option = GetNextOption())
for (const otCoapOption *option = GetFirstOption(); option != nullptr; option = GetNextOption())
{
if (option->mNumber == aOption)
{
@@ -451,7 +451,7 @@ const otCoapOption *OptionIterator::GetFirstOptionMatching(uint16_t aOption)
const otCoapOption *OptionIterator::GetFirstOption(void)
{
const otCoapOption *option = NULL;
const otCoapOption *option = nullptr;
const Message & message = GetMessage();
ClearOption();
@@ -468,9 +468,9 @@ const otCoapOption *OptionIterator::GetFirstOption(void)
const otCoapOption *OptionIterator::GetNextOptionMatching(uint16_t aOption)
{
const otCoapOption *rval = NULL;
const otCoapOption *rval = nullptr;
for (const otCoapOption *option = GetNextOption(); option != NULL; option = GetNextOption())
for (const otCoapOption *option = GetNextOption(); option != nullptr; option = GetNextOption())
{
if (option->mNumber == aOption)
{
@@ -490,7 +490,7 @@ const otCoapOption *OptionIterator::GetNextOption(void)
uint16_t optionLength;
uint8_t buf[Message::kMaxOptionHeaderSize];
uint8_t * cur = buf + 1;
otCoapOption * rval = NULL;
otCoapOption * rval = nullptr;
const Message &message = GetMessage();
VerifyOrExit(mNextOptionOffset < message.GetLength(), error = OT_ERROR_NOT_FOUND);
+12 -12
View File
@@ -133,7 +133,7 @@ public:
*
* @param[in] aType The Type value.
* @param[in] aCode The Code value.
* @param[in] aUriPath A pointer to a NULL-terminated string.
* @param[in] aUriPath A pointer to a null-terminated string.
*
* @retval OT_ERROR_NONE Successfully appended the option.
* @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size.
@@ -342,7 +342,7 @@ public:
/**
* This method appends a Uri-Path option.
*
* @param[in] aUriPath A pointer to a NULL-terminated string.
* @param[in] aUriPath A pointer to a null-terminated string.
*
* @retval OT_ERROR_NONE Successfully appended the option.
* @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.
@@ -369,7 +369,7 @@ public:
/**
* This method appends a Proxy-Uri option.
*
* @param[in] aProxyUri A pointer to a NULL-terminated string.
* @param[in] aProxyUri A pointer to a null-terminated string.
*
* @retval OT_ERROR_NONE Successfully appended the option.
* @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.
@@ -404,7 +404,7 @@ public:
/**
* This method appends a single Uri-Query option.
*
* @param[in] aUriQuery A pointer to NULL-terminated string, which should contain a single key=value pair.
* @param[in] aUriQuery A pointer to null-terminated string, which should contain a single key=value pair.
*
* @retval OT_ERROR_NONE Successfully appended the option.
* @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.
@@ -523,7 +523,7 @@ public:
*
* @param[in] aLength Number of payload bytes to copy.
*
* @returns A pointer to the message or NULL if insufficient message buffers are available.
* @returns A pointer to the message or nullptr if insufficient message buffers are available.
*
*/
Message *Clone(uint16_t aLength) const;
@@ -535,7 +535,7 @@ public:
* `Type`, `SubType`, `LinkSecurity`, `Offset`, `InterfaceId`, and `Priority` fields on the cloned message are also
* copied from the original one.
*
* @returns A pointer to the message or NULL if insufficient message buffers are available.
* @returns A pointer to the message or nullptr if insufficient message buffers are available.
*
*/
Message *Clone(void) const { return Clone(GetLength()); }
@@ -552,7 +552,7 @@ public:
* This method should be used when the message is in a `Coap::MessageQueue` (i.e., a queue containing only CoAP
* messages).
*
* @returns A pointer to the next message in the queue or NULL if at the end of the queue.
* @returns A pointer to the next message in the queue or nullptr if at the end of the queue.
*
*/
Message *GetNextCoapMessage(void) { return static_cast<Message *>(GetNext()); }
@@ -563,7 +563,7 @@ public:
* This method should be used when the message is in a `Coap::MessageQueue` (i.e., a queue containing only CoAP
* messages).
*
* @returns A pointer to the next message in the queue or NULL if at the end of the queue.
* @returns A pointer to the next message in the queue or nullptr if at the end of the queue.
*
*/
const Message *GetNextCoapMessage(void) const { return static_cast<const Message *>(GetNext()); }
@@ -722,7 +722,7 @@ public:
*
* @param[in] aOption Option number to look for.
*
* @returns A pointer to the first matching option. If no option matching @p aOption is seen, NULL pointer is
* @returns A pointer to the first matching option. If no option matching @p aOption is seen, nullptr pointer is
* returned.
*/
const otCoapOption *GetFirstOptionMatching(uint16_t aOption);
@@ -730,7 +730,7 @@ public:
/**
* This method returns a pointer to the first option.
*
* @returns A pointer to the first option. If no option is present NULL pointer is returned.
* @returns A pointer to the first option. If no option is present nullptr pointer is returned.
*/
const otCoapOption *GetFirstOption(void);
@@ -743,14 +743,14 @@ public:
* @param[in] aOption Option number to look for.
*
* @returns A pointer to the next matching option (relative to current iterator position). If no option matching @p
* aOption is seen, NULL pointer is returned.
* aOption is seen, nullptr pointer is returned.
*/
const otCoapOption *GetNextOptionMatching(uint16_t aOption);
/**
* This method returns a pointer to the next option.
*
* @returns A pointer to the next option. If no more options are present NULL pointer is returned.
* @returns A pointer to the next option. If no more options are present nullptr pointer is returned.
*/
const otCoapOption *GetNextOption(void);
+13 -13
View File
@@ -48,8 +48,8 @@ namespace Coap {
CoapSecure::CoapSecure(Instance &aInstance, bool aLayerTwoSecurity)
: CoapBase(aInstance, &CoapSecure::Send)
, mDtls(aInstance, aLayerTwoSecurity)
, mConnectedCallback(NULL)
, mConnectedContext(NULL)
, mConnectedCallback(nullptr)
, mConnectedContext(nullptr)
, mTransmitQueue()
, mTransmitTask(aInstance, &CoapSecure::HandleTransmit, this)
{
@@ -59,8 +59,8 @@ otError CoapSecure::Start(uint16_t aPort)
{
otError error = OT_ERROR_NONE;
mConnectedCallback = NULL;
mConnectedContext = NULL;
mConnectedCallback = nullptr;
mConnectedContext = nullptr;
SuccessOrExit(error = mDtls.Open(&CoapSecure::HandleDtlsReceive, &CoapSecure::HandleDtlsConnected, this));
SuccessOrExit(error = mDtls.Bind(aPort));
@@ -73,8 +73,8 @@ otError CoapSecure::Start(MeshCoP::Dtls::TransportCallback aCallback, void *aCon
{
otError error = OT_ERROR_NONE;
mConnectedCallback = NULL;
mConnectedContext = NULL;
mConnectedCallback = nullptr;
mConnectedContext = nullptr;
SuccessOrExit(error = mDtls.Open(&CoapSecure::HandleDtlsReceive, &CoapSecure::HandleDtlsConnected, this));
SuccessOrExit(error = mDtls.Bind(aCallback, aContext));
@@ -93,7 +93,7 @@ void CoapSecure::Stop(void)
{
mDtls.Close();
for (ot::Message *message = mTransmitQueue.GetHead(); message != NULL; message = message->GetNext())
for (ot::Message *message = mTransmitQueue.GetHead(); message != nullptr; message = message->GetNext())
{
mTransmitQueue.Dequeue(*message);
message->Free();
@@ -189,7 +189,7 @@ void CoapSecure::HandleDtlsConnected(void *aContext, bool aConnected)
void CoapSecure::HandleDtlsConnected(bool aConnected)
{
if (mConnectedCallback != NULL)
if (mConnectedCallback != nullptr)
{
mConnectedCallback(aConnected, mConnectedContext);
}
@@ -202,9 +202,9 @@ void CoapSecure::HandleDtlsReceive(void *aContext, uint8_t *aBuf, uint16_t aLeng
void CoapSecure::HandleDtlsReceive(uint8_t *aBuf, uint16_t aLength)
{
ot::Message *message = NULL;
ot::Message *message = nullptr;
VerifyOrExit((message = Get<MessagePool>().New(Message::kTypeIp6, Message::GetHelpDataReserved())) != NULL,
VerifyOrExit((message = Get<MessagePool>().New(Message::kTypeIp6, Message::GetHelpDataReserved())) != nullptr,
OT_NOOP);
SuccessOrExit(message->Append(aBuf, aLength));
@@ -212,7 +212,7 @@ void CoapSecure::HandleDtlsReceive(uint8_t *aBuf, uint16_t aLength)
exit:
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -228,10 +228,10 @@ void CoapSecure::HandleTransmit(void)
otError error = OT_ERROR_NONE;
ot::Message *message = mTransmitQueue.GetHead();
VerifyOrExit(message != NULL, OT_NOOP);
VerifyOrExit(message != nullptr, OT_NOOP);
mTransmitQueue.Dequeue(*message);
if (mTransmitQueue.GetHead() != NULL)
if (mTransmitQueue.GetHead() != nullptr)
{
mTransmitTask.Post();
}
+5 -5
View File
@@ -250,7 +250,7 @@ public:
* This method sends a CoAP message over secure DTLS connection.
*
* If a response for a request is expected, respective function and context information should be provided.
* If no response is expected, these arguments should be NULL pointers.
* If no response is expected, these arguments should be nullptr pointers.
* If Message Id was not set in the header (equal to 0), this function will assign unique Message Id to the message.
*
* @param[in] aMessage A reference to the message to send.
@@ -262,13 +262,13 @@ public:
* @retval OT_ERROR_INVALID_STATE DTLS connection was not initialized.
*
*/
otError SendMessage(Message &aMessage, ResponseHandler aHandler = NULL, void *aContext = NULL);
otError SendMessage(Message &aMessage, ResponseHandler aHandler = nullptr, void *aContext = nullptr);
/**
* This method sends a CoAP message over secure DTLS connection.
*
* If a response for a request is expected, respective function and context information should be provided.
* If no response is expected, these arguments should be NULL pointers.
* If no response is expected, these arguments should be nullptr pointers.
* If Message Id was not set in the header (equal to 0), this function will assign unique Message Id to the message.
*
* @param[in] aMessage A reference to the message to send.
@@ -283,8 +283,8 @@ public:
*/
otError SendMessage(Message & aMessage,
const Ip6::MessageInfo &aMessageInfo,
ResponseHandler aHandler = NULL,
void * aContext = NULL);
ResponseHandler aHandler = nullptr,
void * aContext = nullptr);
/**
* This method is used to pass UDP messages to the secure CoAP server.
+5 -5
View File
@@ -51,8 +51,8 @@ OT_DEFINE_ALIGNED_VAR(gInstanceRaw, sizeof(Instance), uint64_t);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
otHeapFreeFn ot::Instance::mFree = NULL;
otHeapCAllocFn ot::Instance::mCAlloc = NULL;
otHeapFreeFn ot::Instance::mFree = nullptr;
otHeapCAllocFn ot::Instance::mCAlloc = nullptr;
#endif // OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
@@ -141,14 +141,14 @@ Instance &Instance::Get(void)
Instance *Instance::Init(void *aBuffer, size_t *aBufferSize)
{
Instance *instance = NULL;
Instance *instance = nullptr;
VerifyOrExit(aBufferSize != NULL, OT_NOOP);
VerifyOrExit(aBufferSize != nullptr, OT_NOOP);
// Make sure the input buffer is big enough
VerifyOrExit(sizeof(Instance) <= *aBufferSize, *aBufferSize = sizeof(Instance));
VerifyOrExit(aBuffer != NULL, OT_NOOP);
VerifyOrExit(aBuffer != nullptr, OT_NOOP);
instance = new (aBuffer) Instance();
+2 -2
View File
@@ -237,14 +237,14 @@ public:
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void HeapFree(void *aPointer)
{
OT_ASSERT(mFree != NULL);
OT_ASSERT(mFree != nullptr);
mFree(aPointer);
}
void *HeapCAlloc(size_t aCount, size_t aSize)
{
OT_ASSERT(mCAlloc != NULL);
OT_ASSERT(mCAlloc != nullptr);
return mCAlloc(aCount, aSize);
}
+24 -24
View File
@@ -69,7 +69,7 @@ public:
/**
* This method gets the next entry in the linked list.
*
* @returns A pointer to the next entry in the linked list or NULL if at the end of the list.
* @returns A pointer to the next entry in the linked list or nullptr if at the end of the list.
*
*/
const Type *GetNext(void) const { return static_cast<const Type *>(static_cast<const Type *>(this)->mNext); }
@@ -77,7 +77,7 @@ public:
/**
* This method gets the next entry in the linked list.
*
* @returns A pointer to the next entry in the linked list or NULL if at the end of the list.
* @returns A pointer to the next entry in the linked list or nullptr if at the end of the list.
*
*/
Type *GetNext(void) { return static_cast<Type *>(static_cast<Type *>(this)->mNext); }
@@ -106,14 +106,14 @@ public:
*
*/
LinkedList(void)
: mHead(NULL)
: mHead(nullptr)
{
}
/**
* This method returns the entry at the head of the linked list
*
* @returns Pointer to the entry at the head of the linked list, or NULL if list is empty.
* @returns Pointer to the entry at the head of the linked list, or nullptr if list is empty.
*
*/
Type *GetHead(void) { return mHead; }
@@ -121,7 +121,7 @@ public:
/**
* This method returns the entry at the head of the linked list.
*
* @returns Pointer to the entry at the head of the linked list, or NULL if list is empty.
* @returns Pointer to the entry at the head of the linked list, or nullptr if list is empty.
*
*/
const Type *GetHead(void) const { return mHead; }
@@ -138,7 +138,7 @@ public:
* This method clears the linked list.
*
*/
void Clear(void) { mHead = NULL; }
void Clear(void) { mHead = nullptr; }
/**
* This method indicates whether the linked list is empty or not.
@@ -147,7 +147,7 @@ public:
* @retval FALSE If the linked list is not empty.
*
*/
bool IsEmpty(void) const { return (mHead == NULL); }
bool IsEmpty(void) const { return (mHead == nullptr); }
/**
* This method pushes an entry at the head of the linked list.
@@ -179,14 +179,14 @@ public:
*
* @note This method does not change the popped entry itself, i.e., the popped entry next pointer stays as before.
*
* @returns The entry that was popped if list is not empty, or NULL if list is empty.
* @returns The entry that was popped if list is not empty, or nullptr if list is empty.
*
*/
Type *Pop(void)
{
Type *entry = mHead;
if (mHead != NULL)
if (mHead != nullptr)
{
mHead = mHead->GetNext();
}
@@ -199,17 +199,17 @@ public:
*
* @note This method does not change the popped entry itself, i.e., the popped entry next pointer stays as before.
*
* @param[in] aPrevEntry A pointer to a previous entry. If it is not NULL the entry after this will be popped,
* otherwise (if it is NULL) the entry at head of the list is popped.
* @param[in] aPrevEntry A pointer to a previous entry. If it is not nullptr the entry after this will be popped,
* otherwise (if it is nullptr) the entry at head of the list is popped.
*
* @returns Pointer to the entry that was popped, or NULL if there is no entry to pop.
* @returns Pointer to the entry that was popped, or nullptr if there is no entry to pop.
*
*/
Type *PopAfter(Type *aPrevEntry)
{
Type *entry;
if (aPrevEntry == NULL)
if (aPrevEntry == nullptr)
{
entry = Pop();
}
@@ -217,7 +217,7 @@ public:
{
entry = aPrevEntry->GetNext();
if (entry != NULL)
if (entry != nullptr)
{
aPrevEntry->SetNext(entry->GetNext());
}
@@ -239,7 +239,7 @@ public:
{
bool contains = false;
for (Type *cur = mHead; cur != NULL; cur = cur->GetNext())
for (Type *cur = mHead; cur != nullptr; cur = cur->GetNext())
{
if (cur == &aEntry)
{
@@ -297,9 +297,9 @@ public:
Pop();
error = OT_ERROR_NONE;
}
else if (mHead != NULL)
else if (mHead != nullptr)
{
for (Type *cur = mHead; cur->GetNext() != NULL; cur = cur->GetNext())
for (Type *cur = mHead; cur->GetNext() != nullptr; cur = cur->GetNext())
{
if (cur->GetNext() == &aEntry)
{
@@ -318,7 +318,7 @@ public:
*
* @param[in] aEntry A reference to an entry to find.
* @param[out] aPrevEntry A pointer to output previous entry on success (when @p aEntry is found is the list).
* @p aPrevEntry is set to NULL if the @p aEntry is head of the list. Otherwise it
* @p aPrevEntry is set to nullptr if the @p aEntry is head of the list. Otherwise it
* is updated to point to previous entry before @p aEntry in the list.
*
* @retval OT_ERROR_NONE The entry was found in the list and @p aPrevEntry was updated successfully.
@@ -331,12 +331,12 @@ public:
if (mHead == &aEntry)
{
aPrevEntry = NULL;
aPrevEntry = nullptr;
error = OT_ERROR_NONE;
}
else
{
for (Type *cur = mHead; cur->GetNext() != NULL; cur = cur->GetNext())
for (Type *cur = mHead; cur->GetNext() != nullptr; cur = cur->GetNext())
{
if (cur->GetNext() == &aEntry)
{
@@ -353,16 +353,16 @@ public:
/**
* This method returns the tail of the linked list (i.e., the last entry in the list).
*
* @returns A pointer to tail entry in the linked list or NULL if list is empty.
* @returns A pointer to tail entry in the linked list or nullptr if list is empty.
*
*/
const Type *GetTail(void) const
{
const Type *tail = mHead;
if (tail != NULL)
if (tail != nullptr)
{
while (tail->GetNext() != NULL)
while (tail->GetNext() != nullptr)
{
tail = tail->GetNext();
}
@@ -374,7 +374,7 @@ public:
/**
* This method returns the tail of the linked list (i.e., the last entry in the list).
*
* @returns A pointer to tail entry in the linked list or NULL if list is empty.
* @returns A pointer to tail entry in the linked list or nullptr if list is empty.
*
*/
Type *GetTail(void) { return const_cast<Type *>(const_cast<const LinkedList<Type> *>(this)->GetTail()); }
+53 -53
View File
@@ -66,7 +66,7 @@ Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, Message:
otError error = OT_ERROR_NONE;
Message *message;
VerifyOrExit((message = static_cast<Message *>(NewBuffer(aPriority))) != NULL, OT_NOOP);
VerifyOrExit((message = static_cast<Message *>(NewBuffer(aPriority))) != nullptr, OT_NOOP);
memset(message, 0, sizeof(*message));
message->SetMessagePool(this);
@@ -81,7 +81,7 @@ exit:
if (error != OT_ERROR_NONE)
{
Free(message);
message = NULL;
message = nullptr;
}
return message;
@@ -101,14 +101,14 @@ Message *MessagePool::New(Message::Type aType, uint16_t aReserveHeader, const Me
void MessagePool::Free(Message *aMessage)
{
OT_ASSERT(aMessage->Next() == NULL && aMessage->Prev() == NULL);
OT_ASSERT(aMessage->Next() == nullptr && aMessage->Prev() == nullptr);
FreeBuffers(static_cast<Buffer *>(aMessage));
}
Buffer *MessagePool::NewBuffer(Message::Priority aPriority)
{
Buffer *buffer = NULL;
Buffer *buffer = nullptr;
SuccessOrExit(ReclaimBuffers(1, aPriority));
@@ -120,15 +120,15 @@ Buffer *MessagePool::NewBuffer(Message::Priority aPriority)
buffer = mFreeBuffers.Pop();
if (buffer != NULL)
if (buffer != nullptr)
{
buffer->SetNextBuffer(NULL);
buffer->SetNextBuffer(nullptr);
mNumFreeBuffers--;
}
#endif
if (buffer == NULL)
if (buffer == nullptr)
{
otLogInfoMem("No available message buffer");
}
@@ -139,7 +139,7 @@ exit:
void MessagePool::FreeBuffers(Buffer *aBuffer)
{
while (aBuffer != NULL)
while (aBuffer != nullptr)
{
Buffer *next = aBuffer->GetNextBuffer();
#if OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
@@ -193,8 +193,8 @@ Message::Settings::Settings(LinkSecurityMode aSecurityMode, Priority aPriority)
}
Message::Settings::Settings(const otMessageSettings *aSettings)
: mLinkSecurityEnabled((aSettings != NULL) ? aSettings->mLinkSecurityEnabled : true)
, mPriority((aSettings != NULL) ? static_cast<Priority>(aSettings->mPriority) : kPriorityNormal)
: mLinkSecurityEnabled((aSettings != nullptr) ? aSettings->mLinkSecurityEnabled : true)
, mPriority((aSettings != nullptr) ? static_cast<Priority>(aSettings->mPriority) : kPriorityNormal)
{
}
@@ -209,10 +209,10 @@ otError Message::ResizeMessage(uint16_t aLength)
while (curLength < aLength)
{
if (curBuffer->GetNextBuffer() == NULL)
if (curBuffer->GetNextBuffer() == nullptr)
{
curBuffer->SetNextBuffer(GetMessagePool()->NewBuffer(GetPriority()));
VerifyOrExit(curBuffer->GetNextBuffer() != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(curBuffer->GetNextBuffer() != nullptr, error = OT_ERROR_NO_BUFS);
}
curBuffer = curBuffer->GetNextBuffer();
@@ -222,7 +222,7 @@ otError Message::ResizeMessage(uint16_t aLength)
// remove buffers
lastBuffer = curBuffer;
curBuffer = curBuffer->GetNextBuffer();
lastBuffer->SetNextBuffer(NULL);
lastBuffer->SetNextBuffer(nullptr);
GetMessagePool()->FreeBuffers(curBuffer);
@@ -243,17 +243,17 @@ Message *Message::GetNext(void) const
if (GetMetadata().mInPriorityQ)
{
PriorityQueue *priorityQueue = GetPriorityQueue();
VerifyOrExit(priorityQueue != NULL, next = NULL);
VerifyOrExit(priorityQueue != nullptr, next = nullptr);
tail = priorityQueue->GetTail();
}
else
{
MessageQueue *messageQueue = GetMessageQueue();
VerifyOrExit(messageQueue != NULL, next = NULL);
VerifyOrExit(messageQueue != nullptr, next = nullptr);
tail = messageQueue->GetTail();
}
next = (this == tail) ? NULL : Next();
next = (this == tail) ? nullptr : Next();
exit:
return next;
@@ -346,7 +346,7 @@ otError Message::SetPriority(Priority aPriority)
{
otError error = OT_ERROR_NONE;
uint8_t priority = static_cast<uint8_t>(aPriority);
PriorityQueue *priorityQueue = NULL;
PriorityQueue *priorityQueue = nullptr;
VerifyOrExit(priority < kNumPriorities, error = OT_ERROR_INVALID_ARGS);
@@ -361,7 +361,7 @@ otError Message::SetPriority(Priority aPriority)
GetMetadata().mPriority = priority;
if (priorityQueue != NULL)
if (priorityQueue != nullptr)
{
priorityQueue->Enqueue(*this);
}
@@ -389,11 +389,11 @@ exit:
otError Message::Prepend(const void *aBuf, uint16_t aLength)
{
otError error = OT_ERROR_NONE;
Buffer *newBuffer = NULL;
Buffer *newBuffer = nullptr;
while (aLength > GetReserved())
{
VerifyOrExit((newBuffer = GetMessagePool()->NewBuffer(GetPriority())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((newBuffer = GetMessagePool()->NewBuffer(GetPriority())) != nullptr, error = OT_ERROR_NO_BUFS);
newBuffer->SetNextBuffer(GetNextBuffer());
SetNextBuffer(newBuffer);
@@ -412,7 +412,7 @@ otError Message::Prepend(const void *aBuf, uint16_t aLength)
GetMetadata().mLength += aLength;
SetOffset(GetOffset() + aLength);
if (aBuf != NULL)
if (aBuf != nullptr)
{
Write(0, aLength, aBuf);
}
@@ -484,7 +484,7 @@ uint16_t Message::Read(uint16_t aOffset, uint16_t aLength, void *aBuf) const
while (aOffset >= kBufferDataSize)
{
OT_ASSERT(curBuffer != NULL);
OT_ASSERT(curBuffer != nullptr);
curBuffer = curBuffer->GetNextBuffer();
aOffset -= kBufferDataSize;
@@ -493,7 +493,7 @@ uint16_t Message::Read(uint16_t aOffset, uint16_t aLength, void *aBuf) const
// begin copy
while (aLength > 0)
{
OT_ASSERT(curBuffer != NULL);
OT_ASSERT(curBuffer != nullptr);
bytesToCopy = kBufferDataSize - aOffset;
@@ -559,7 +559,7 @@ int Message::Write(uint16_t aOffset, uint16_t aLength, const void *aBuf)
while (aOffset >= kBufferDataSize)
{
OT_ASSERT(curBuffer != NULL);
OT_ASSERT(curBuffer != nullptr);
curBuffer = curBuffer->GetNextBuffer();
aOffset -= kBufferDataSize;
@@ -568,7 +568,7 @@ int Message::Write(uint16_t aOffset, uint16_t aLength, const void *aBuf)
// begin copy
while (aLength > 0)
{
OT_ASSERT(curBuffer != NULL);
OT_ASSERT(curBuffer != nullptr);
bytesToCopy = kBufferDataSize - aOffset;
@@ -618,7 +618,7 @@ Message *Message::Clone(uint16_t aLength) const
Message *messageCopy;
uint16_t offset;
VerifyOrExit((messageCopy = GetMessagePool()->New(GetType(), GetReserved(), GetPriority())) != NULL,
VerifyOrExit((messageCopy = GetMessagePool()->New(GetType(), GetReserved(), GetPriority())) != nullptr,
error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = messageCopy->SetLength(aLength));
CopyTo(0, 0, aLength, *messageCopy);
@@ -635,10 +635,10 @@ Message *Message::Clone(uint16_t aLength) const
exit:
if (error != OT_ERROR_NONE && messageCopy != NULL)
if (error != OT_ERROR_NONE && messageCopy != nullptr)
{
messageCopy->Free();
messageCopy = NULL;
messageCopy = nullptr;
}
return messageCopy;
@@ -733,7 +733,7 @@ uint16_t Message::UpdateChecksum(uint16_t aChecksum, uint16_t aOffset, uint16_t
while (aOffset >= kBufferDataSize)
{
OT_ASSERT(curBuffer != NULL);
OT_ASSERT(curBuffer != nullptr);
curBuffer = curBuffer->GetNextBuffer();
aOffset -= kBufferDataSize;
@@ -742,7 +742,7 @@ uint16_t Message::UpdateChecksum(uint16_t aChecksum, uint16_t aOffset, uint16_t
// begin copy
while (aLength > 0)
{
OT_ASSERT(curBuffer != NULL);
OT_ASSERT(curBuffer != nullptr);
bytesToCover = kBufferDataSize - aOffset;
@@ -786,22 +786,22 @@ void Message::SetPriorityQueue(PriorityQueue *aPriorityQueue)
MessageQueue::MessageQueue(void)
{
SetTail(NULL);
SetTail(nullptr);
}
Message *MessageQueue::GetHead(void) const
{
return (GetTail() == NULL) ? NULL : GetTail()->Next();
return (GetTail() == nullptr) ? nullptr : GetTail()->Next();
}
void MessageQueue::Enqueue(Message &aMessage, QueuePosition aPosition)
{
OT_ASSERT(!aMessage.IsInAQueue());
OT_ASSERT((aMessage.Next() == NULL) && (aMessage.Prev() == NULL));
OT_ASSERT((aMessage.Next() == nullptr) && (aMessage.Prev() == nullptr));
aMessage.SetMessageQueue(this);
if (GetTail() == NULL)
if (GetTail() == nullptr)
{
aMessage.Next() = &aMessage;
aMessage.Prev() = &aMessage;
@@ -828,7 +828,7 @@ void MessageQueue::Enqueue(Message &aMessage, QueuePosition aPosition)
void MessageQueue::Dequeue(Message &aMessage)
{
OT_ASSERT(aMessage.GetMessageQueue() == this);
OT_ASSERT((aMessage.Next() != NULL) && (aMessage.Prev() != NULL));
OT_ASSERT((aMessage.Next() != nullptr) && (aMessage.Prev() != nullptr));
if (&aMessage == GetTail())
{
@@ -836,17 +836,17 @@ void MessageQueue::Dequeue(Message &aMessage)
if (&aMessage == GetTail())
{
SetTail(NULL);
SetTail(nullptr);
}
}
aMessage.Prev()->Next() = aMessage.Next();
aMessage.Next()->Prev() = aMessage.Prev();
aMessage.Prev() = NULL;
aMessage.Next() = NULL;
aMessage.Prev() = nullptr;
aMessage.Next() = nullptr;
aMessage.SetMessageQueue(NULL);
aMessage.SetMessageQueue(nullptr);
}
void MessageQueue::GetInfo(uint16_t &aMessageCount, uint16_t &aBufferCount) const
@@ -854,7 +854,7 @@ void MessageQueue::GetInfo(uint16_t &aMessageCount, uint16_t &aBufferCount) cons
aMessageCount = 0;
aBufferCount = 0;
for (const Message *message = GetHead(); message != NULL; message = message->GetNext())
for (const Message *message = GetHead(); message != nullptr; message = message->GetNext())
{
aMessageCount++;
aBufferCount += message->GetBufferCount();
@@ -865,20 +865,20 @@ PriorityQueue::PriorityQueue(void)
{
for (int priority = 0; priority < Message::kNumPriorities; priority++)
{
mTails[priority] = NULL;
mTails[priority] = nullptr;
}
}
Message *PriorityQueue::FindFirstNonNullTail(Message::Priority aStartPriorityLevel) const
{
Message *tail = NULL;
Message *tail = nullptr;
uint8_t priority;
priority = static_cast<uint8_t>(aStartPriorityLevel);
do
{
if (mTails[priority] != NULL)
if (mTails[priority] != nullptr)
{
tail = mTails[priority];
break;
@@ -896,7 +896,7 @@ Message *PriorityQueue::GetHead(void) const
tail = FindFirstNonNullTail(Message::kPriorityLow);
return (tail == NULL) ? NULL : tail->Next();
return (tail == nullptr) ? nullptr : tail->Next();
}
Message *PriorityQueue::GetHeadForPriority(Message::Priority aPriority) const
@@ -904,17 +904,17 @@ Message *PriorityQueue::GetHeadForPriority(Message::Priority aPriority) const
Message *head;
Message *previousTail;
if (mTails[aPriority] != NULL)
if (mTails[aPriority] != nullptr)
{
previousTail = FindFirstNonNullTail(static_cast<Message::Priority>(PrevPriority(aPriority)));
OT_ASSERT(previousTail != NULL);
OT_ASSERT(previousTail != nullptr);
head = previousTail->Next();
}
else
{
head = NULL;
head = nullptr;
}
return head;
@@ -939,7 +939,7 @@ void PriorityQueue::Enqueue(Message &aMessage)
tail = FindFirstNonNullTail(priority);
if (tail != NULL)
if (tail != nullptr)
{
next = tail->Next();
@@ -974,7 +974,7 @@ void PriorityQueue::Dequeue(Message &aMessage)
if ((&aMessage == tail) || (tail->GetPriority() != priority))
{
tail = NULL;
tail = nullptr;
}
mTails[priority] = tail;
@@ -982,10 +982,10 @@ void PriorityQueue::Dequeue(Message &aMessage)
aMessage.Next()->Prev() = aMessage.Prev();
aMessage.Prev()->Next() = aMessage.Next();
aMessage.Next() = NULL;
aMessage.Prev() = NULL;
aMessage.Next() = nullptr;
aMessage.Prev() = nullptr;
aMessage.SetMessageQueue(NULL);
aMessage.SetMessageQueue(nullptr);
}
void PriorityQueue::GetInfo(uint16_t &aMessageCount, uint16_t &aBufferCount) const
@@ -993,7 +993,7 @@ void PriorityQueue::GetInfo(uint16_t &aMessageCount, uint16_t &aBufferCount) con
aMessageCount = 0;
aBufferCount = 0;
for (const Message *message = GetHead(); message != NULL; message = message->GetNext())
for (const Message *message = GetHead(); message != nullptr; message = message->GetNext())
{
aMessageCount++;
aBufferCount += message->GetBufferCount();
+14 -14
View File
@@ -303,7 +303,7 @@ public:
/**
* This constructor initializes the `Settings` object from a given `otMessageSettings`.
*
* @param[in] aSettings A pointer to `otMessageSettings` to covert from. If NULL default settings (link
* @param[in] aSettings A pointer to `otMessageSettings` to covert from. If nullptr default settings (link
* security enabled with `kPriorityNormal` priority) would be used.
*
*/
@@ -349,7 +349,7 @@ public:
/**
* This method returns a pointer to the next message.
*
* @returns A pointer to the next message in the list or NULL if at the end of the list.
* @returns A pointer to the next message in the list or nullptr if at the end of the list.
*
*/
Message *GetNext(void) const;
@@ -546,7 +546,7 @@ public:
*
* @param[in] aLength Number of payload bytes to copy.
*
* @returns A pointer to the message or NULL if insufficient message buffers are available.
* @returns A pointer to the message or nullptr if insufficient message buffers are available.
*
*/
Message *Clone(uint16_t aLength) const;
@@ -558,7 +558,7 @@ public:
* `Type`, `SubType`, `LinkSecurity`, `Offset`, `InterfaceId`, and `Priority` fields on the cloned message are also
* copied from the original one.
*
* @returns A pointer to the message or NULL if insufficient message buffers are available.
* @returns A pointer to the message or nullptr if insufficient message buffers are available.
*
*/
Message *Clone(void) const { return Clone(GetLength()); }
@@ -835,23 +835,23 @@ public:
/**
* This method returns a pointer to the message queue (if any) where this message is queued.
*
* @returns A pointer to the message queue or NULL if not in any message queue.
* @returns A pointer to the message queue or nullptr if not in any message queue.
*
*/
MessageQueue *GetMessageQueue(void) const
{
return (!GetMetadata().mInPriorityQ) ? GetMetadata().mQueue.mMessage : NULL;
return (!GetMetadata().mInPriorityQ) ? GetMetadata().mQueue.mMessage : nullptr;
}
/**
* This method returns a pointer to the priority message queue (if any) where this message is queued.
*
* @returns A pointer to the priority queue or NULL if not in any priority queue.
* @returns A pointer to the priority queue or nullptr if not in any priority queue.
*
*/
PriorityQueue *GetPriorityQueue(void) const
{
return (GetMetadata().mInPriorityQ) ? GetMetadata().mQueue.mPriority : NULL;
return (GetMetadata().mInPriorityQ) ? GetMetadata().mQueue.mPriority : nullptr;
}
/**
@@ -930,7 +930,7 @@ private:
* @returns `true` if the message is in any queue, `false` otherwise.
*
*/
bool IsInAQueue(void) const { return (GetMetadata().mQueue.mMessage != NULL); }
bool IsInAQueue(void) const { return (GetMetadata().mQueue.mMessage != nullptr); }
/**
* This method sets the message queue information for the message.
@@ -1118,7 +1118,7 @@ public:
*
* @param[in] aPriority Priority level.
*
* @returns A pointer to the first message with given priority level or NULL if there is no messages with
* @returns A pointer to the first message with given priority level or nullptr if there is no messages with
* this priority level.
*
*/
@@ -1172,12 +1172,12 @@ private:
}
/**
* This private method finds the first non-NULL tail starting from the given priority level and moving forward.
* This private method finds the first non-nullptr tail starting from the given priority level and moving forward.
* It wraps from priority value `kNumPriorities` -1 back to 0.
*
* aStartPriorityLevel Starting priority level.
*
* @returns The first non-NULL tail pointer, or NULL if all the
* @returns The first non-nullptr tail pointer, or nullptr if all the
*
*/
Message *FindFirstNonNullTail(Message::Priority aStartPriorityLevel) const;
@@ -1212,7 +1212,7 @@ public:
* @param[in] aReserveHeader The number of header bytes to reserve.
* @param[in] aPriority The priority level of the message.
*
* @returns A pointer to the message or NULL if no message buffers are available.
* @returns A pointer to the message or nullptr if no message buffers are available.
*
*/
Message *New(Message::Type aType, uint16_t aReserveHeader, Message::Priority aPriority);
@@ -1225,7 +1225,7 @@ public:
* @param[in] aReserveHeader The number of header bytes to reserve.
* @param[in] aSettings The message settings.
*
* @returns A pointer to the message or NULL if no message buffers are available.
* @returns A pointer to the message or nullptr if no message buffers are available.
*
*/
Message *New(Message::Type aType,
+13 -13
View File
@@ -42,7 +42,7 @@ namespace ot {
Notifier::Receiver::Receiver(Instance &aInstance, Handler aHandler)
: mHandler(aHandler)
, mNext(NULL)
, mNext(nullptr)
{
aInstance.Get<Notifier>().RegisterReceiver(*this);
}
@@ -56,8 +56,8 @@ Notifier::Notifier(Instance &aInstance)
{
for (unsigned int i = 0; i < kMaxExternalHandlers; i++)
{
mExternalCallbacks[i].mHandler = NULL;
mExternalCallbacks[i].mContext = NULL;
mExternalCallbacks[i].mHandler = nullptr;
mExternalCallbacks[i].mContext = nullptr;
}
}
@@ -69,17 +69,17 @@ void Notifier::RegisterReceiver(Receiver &aReceiver)
otError Notifier::RegisterCallback(otStateChangedCallback aCallback, void *aContext)
{
otError error = OT_ERROR_NONE;
ExternalCallback *unusedCallback = NULL;
ExternalCallback *unusedCallback = nullptr;
VerifyOrExit(aCallback != NULL, OT_NOOP);
VerifyOrExit(aCallback != nullptr, OT_NOOP);
for (unsigned int i = 0; i < kMaxExternalHandlers; i++)
{
ExternalCallback &callback = mExternalCallbacks[i];
if (callback.mHandler == NULL)
if (callback.mHandler == nullptr)
{
if (unusedCallback == NULL)
if (unusedCallback == nullptr)
{
unusedCallback = &callback;
}
@@ -90,7 +90,7 @@ otError Notifier::RegisterCallback(otStateChangedCallback aCallback, void *aCont
VerifyOrExit((callback.mHandler != aCallback) || (callback.mContext != aContext), error = OT_ERROR_ALREADY);
}
VerifyOrExit(unusedCallback != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(unusedCallback != nullptr, error = OT_ERROR_NO_BUFS);
unusedCallback->mHandler = aCallback;
unusedCallback->mContext = aContext;
@@ -101,7 +101,7 @@ exit:
void Notifier::RemoveCallback(otStateChangedCallback aCallback, void *aContext)
{
VerifyOrExit(aCallback != NULL, OT_NOOP);
VerifyOrExit(aCallback != nullptr, OT_NOOP);
for (unsigned int i = 0; i < kMaxExternalHandlers; i++)
{
@@ -109,8 +109,8 @@ void Notifier::RemoveCallback(otStateChangedCallback aCallback, void *aContext)
if ((callback.mHandler == aCallback) && (callback.mContext == aContext))
{
callback.mHandler = NULL;
callback.mContext = NULL;
callback.mHandler = nullptr;
callback.mContext = nullptr;
}
}
@@ -152,7 +152,7 @@ void Notifier::EmitEvents(void)
LogEvents(events);
for (Receiver *receiver = mReceivers.GetHead(); receiver != NULL; receiver = receiver->GetNext())
for (Receiver *receiver = mReceivers.GetHead(); receiver != nullptr; receiver = receiver->GetNext())
{
receiver->Emit(events);
}
@@ -161,7 +161,7 @@ void Notifier::EmitEvents(void)
{
ExternalCallback &callback = mExternalCallbacks[i];
if (callback.mHandler != NULL)
if (callback.mHandler != nullptr)
{
callback.mHandler(events.GetAsFlags(), callback.mContext);
}
+3 -3
View File
@@ -153,7 +153,7 @@ void RandomManager::Entropy::Init(void)
mbedtls_entropy_init(&mEntropyContext);
#ifndef OT_MBEDTLS_STRONG_DEFAULT_ENTROPY_PRESENT
mbedtls_entropy_add_source(&mEntropyContext, &RandomManager::Entropy::HandleMbedtlsEntropyPoll, NULL,
mbedtls_entropy_add_source(&mEntropyContext, &RandomManager::Entropy::HandleMbedtlsEntropyPoll, nullptr,
MBEDTLS_ENTROPY_MIN_HARDWARE, MBEDTLS_ENTROPY_SOURCE_STRONG);
#endif // OT_MBEDTLS_STRONG_DEFAULT_ENTROPY_PRESENT
}
@@ -175,7 +175,7 @@ int RandomManager::Entropy::HandleMbedtlsEntropyPoll(void * aData,
SuccessOrExit(otPlatEntropyGet(reinterpret_cast<uint8_t *>(aOutput), static_cast<uint16_t>(aInLen)));
rval = 0;
VerifyOrExit(aOutLen != NULL, OT_NOOP);
VerifyOrExit(aOutLen != nullptr, OT_NOOP);
*aOutLen = aInLen;
exit:
@@ -191,7 +191,7 @@ exit:
void RandomManager::CryptoCtrDrbg::Init(void)
{
mbedtls_ctr_drbg_init(&mCtrDrbg);
mbedtls_ctr_drbg_seed(&mCtrDrbg, mbedtls_entropy_func, RandomManager::GetMbedTlsEntropyContext(), NULL, 0);
mbedtls_ctr_drbg_seed(&mCtrDrbg, mbedtls_entropy_func, RandomManager::GetMbedTlsEntropyContext(), nullptr, 0);
}
void RandomManager::CryptoCtrDrbg::Deinit(void)
+4 -4
View File
@@ -76,7 +76,7 @@ public:
*
* @param[in] aKey The key associated with the value.
* @param[in] aValue A pointer to where the new value of the setting should be read from.
* MUST NOT be NULL if @p aValueLength is non-zero.
* MUST NOT be nullptr if @p aValueLength is non-zero.
* @param[in] aValueLength The length of the data pointed to by @p aValue. May be zero.
*
* @retval OT_ERROR_NONE The value was added.
@@ -104,12 +104,12 @@ public:
* @param[in] aKey The key associated with the requested value.
* @param[in] aIndex The index of the specific item to get.
* @param[out] aValue A pointer to where the value of the setting should be written.
* May be NULL if just testing for the presence or length of a key.
* May be nullptr if just testing for the presence or length of a key.
* @param[inout] aValueLength A pointer to the length of the value.
* When called, this should point to an integer containing the maximum bytes that
* can be written to @p aValue.
* At return, the actual length of the setting is written.
* May be NULL if performing a presence check.
* May be nullptr if performing a presence check.
*
* @retval OT_ERROR_NONE The value was fetched successfully.
* @retval OT_ERROR_NOT_FOUND The key was not found.
@@ -125,7 +125,7 @@ public:
*
* @param[in] aKey The key associated with the value.
* @param[in] aValue A pointer to where the new value of the setting should be read from.
* MUST NOT be NULL if @p aValueLength is non-zero.
* MUST NOT be nullptr if @p aValueLength is non-zero.
* @param[in] aValueLength The length of the data pointed to by @p aValue. May be zero.
*
* @retval OT_ERROR_NONE The value was changed.
+3 -2
View File
@@ -57,12 +57,13 @@ namespace ot {
*/
/**
* This function returns the number of characters that precede the terminating NULL character.
* This function returns the number of characters that precede the terminating nullptr character.
*
* @param[in] aString A pointer to the string.
* @param[in] aMaxLength The maximum length in bytes.
*
* @returns The number of characters that precede the terminating NULL character or @p aMaxLength, whichever is smaller.
* @returns The number of characters that precede the terminating nullptr character or @p aMaxLength, whichever is
* smaller.
*
*/
uint16_t StringLength(const char *aString, uint16_t aMaxLength);
+8 -8
View File
@@ -45,7 +45,7 @@ Tasklet::Tasklet(Instance &aInstance, Handler aHandler, void *aOwner)
: InstanceLocator(aInstance)
, OwnerLocator(aOwner)
, mHandler(aHandler)
, mNext(NULL)
, mNext(nullptr)
{
}
@@ -58,7 +58,7 @@ void Tasklet::Post(void)
}
TaskletScheduler::TaskletScheduler(void)
: mTail(NULL)
: mTail(nullptr)
{
}
@@ -66,7 +66,7 @@ void TaskletScheduler::PostTasklet(Tasklet &aTasklet)
{
// Tasklets are saved in a circular singly linked list.
if (mTail == NULL)
if (mTail == nullptr)
{
mTail = &aTasklet;
mTail->mNext = mTail;
@@ -86,26 +86,26 @@ void TaskletScheduler::ProcessQueuedTasklets(void)
// This method processes all tasklets queued when this is called. We
// keep a copy the current list and then clear the main list by
// setting `mTail` to NULL. A newly posted tasklet while processing
// setting `mTail` to nullptr. A newly posted tasklet while processing
// the currently queued tasklets will then trigger a call to
// `otTaskletsSignalPending()`.
mTail = NULL;
mTail = nullptr;
while (tail != NULL)
while (tail != nullptr)
{
Tasklet *tasklet = tail->mNext;
if (tasklet == tail)
{
tail = NULL;
tail = nullptr;
}
else
{
tail->mNext = tasklet->mNext;
}
tasklet->mNext = NULL;
tasklet->mNext = nullptr;
tasklet->RunTask();
}
}
+2 -2
View File
@@ -99,7 +99,7 @@ public:
* @retval FALSE The tasklet is not posted.
*
*/
bool IsPosted(void) const { return (mNext != NULL); }
bool IsPosted(void) const { return (mNext != nullptr); }
private:
void RunTask(void) { mHandler(*this); }
@@ -168,7 +168,7 @@ public:
* @retval FALSE If there are no tasklets pending.
*
*/
bool AreTaskletsPending(void) const { return mTail != NULL; }
bool AreTaskletsPending(void) const { return mTail != nullptr; }
/**
* This method processes all tasklets queued when this is called.
+2 -2
View File
@@ -100,7 +100,7 @@ void TimerMilli::Stop(void)
void TimerScheduler::Add(Timer &aTimer, const AlarmApi &aAlarmApi)
{
Timer *prev = NULL;
Timer *prev = nullptr;
Time now(aAlarmApi.AlarmGetNow());
Remove(aTimer, aAlarmApi);
@@ -113,7 +113,7 @@ void TimerScheduler::Add(Timer &aTimer, const AlarmApi &aAlarmApi)
}
}
if (prev == NULL)
if (prev == nullptr)
{
mTimerList.Push(aTimer);
SetAlarm(aAlarmApi);
+5 -5
View File
@@ -73,7 +73,7 @@ otError Tlv::FindTlv(const Message &aMessage, uint8_t aType, uint16_t aMaxSize,
uint16_t offset;
uint16_t size;
SuccessOrExit(error = Find(aMessage, aType, &offset, &size, NULL));
SuccessOrExit(error = Find(aMessage, aType, &offset, &size, nullptr));
if (aMaxSize > size)
{
@@ -88,7 +88,7 @@ exit:
otError Tlv::FindTlvOffset(const Message &aMessage, uint8_t aType, uint16_t &aOffset)
{
return Find(aMessage, aType, &aOffset, NULL, NULL);
return Find(aMessage, aType, &aOffset, nullptr, nullptr);
}
otError Tlv::FindTlvValueOffset(const Message &aMessage, uint8_t aType, uint16_t &aValueOffset, uint16_t &aLength)
@@ -150,17 +150,17 @@ otError Tlv::Find(const Message &aMessage, uint8_t aType, uint16_t *aOffset, uin
if (tlv.GetType() == aType)
{
if (aOffset != NULL)
if (aOffset != nullptr)
{
*aOffset = offset;
}
if (aSize != NULL)
if (aSize != nullptr)
{
*aSize = static_cast<uint16_t>(size);
}
if (aIsExtendedTlv != NULL)
if (aIsExtendedTlv != nullptr)
{
*aIsExtendedTlv = (tlv.mLength == kExtendedLength);
}
+1 -1
View File
@@ -412,7 +412,7 @@ private:
* This private static method searches within a given message for TLV type and outputs the TLV offset, size and
* whether it is an Extended TLV.
*
* A NULL pointer can be used for output parameters @p aOffset, @p aSize, or @p aIsExtendedTlv if the parameter
* A nullptr pointer can be used for output parameters @p aOffset, @p aSize, or @p aIsExtendedTlv if the parameter
* is not required.
*
* @param[in] aMessage A reference to the message to search within.
+1 -1
View File
@@ -61,7 +61,7 @@ TrickleTimer::TrickleTimer(Instance &aInstance,
, mIsRunning(false)
, mInTransmitPhase(false)
{
OT_ASSERT(aTransmitHandler != NULL);
OT_ASSERT(aTransmitHandler != nullptr);
}
void TrickleTimer::Start(uint32_t aIntervalMin, uint32_t aIntervalMax, Mode aMode)
+2 -2
View File
@@ -66,12 +66,12 @@ otError Ecdsa::Sign(uint8_t * aOutput,
mbedtls_mpi_init(&sMpi);
// Parse a private key in PEM format.
VerifyOrExit(mbedtls_pk_parse_key(&pkCtx, aPrivateKey, aPrivateKeyLength, NULL, 0) == 0,
VerifyOrExit(mbedtls_pk_parse_key(&pkCtx, aPrivateKey, aPrivateKeyLength, nullptr, 0) == 0,
error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(mbedtls_pk_get_type(&pkCtx) == MBEDTLS_PK_ECKEY, error = OT_ERROR_INVALID_ARGS);
keypair = mbedtls_pk_ec(pkCtx);
OT_ASSERT(keypair != NULL);
OT_ASSERT(keypair != nullptr);
VerifyOrExit(mbedtls_ecdsa_from_keypair(&ctx, keypair) == 0, error = OT_ERROR_FAILED);
+1 -1
View File
@@ -38,7 +38,7 @@ namespace Crypto {
HmacSha256::HmacSha256(void)
{
const mbedtls_md_info_t *mdInfo = NULL;
const mbedtls_md_info_t *mdInfo = nullptr;
mbedtls_md_init(&mContext);
mdInfo = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
mbedtls_md_setup(&mContext, mdInfo, 1);
+1 -1
View File
@@ -581,7 +581,7 @@ otError Diags::ProcessCmd(uint8_t aArgsLength, char *aArgs[], char *aOutput, siz
{
if (strcmp(aArgs[0], sCommands[i].mName) == 0)
{
error = (this->*sCommands[i].mCommand)(aArgsLength - 1, (aArgsLength > 1) ? &aArgs[1] : NULL, aOutput,
error = (this->*sCommands[i].mCommand)(aArgsLength - 1, (aArgsLength > 1) ? &aArgs[1] : nullptr, aOutput,
aOutputMaxLen);
ExitNow();
}
+2 -2
View File
@@ -62,7 +62,7 @@ public:
/**
* This method processes a factory diagnostics command line.
*
* @param[in] aString A NULL-terminated input string.
* @param[in] aString A null-terminated input string.
* @param[out] aOutput The diagnostics execution result.
* @param[in] aOutputMaxLen The output buffer size.
*
@@ -102,7 +102,7 @@ public:
/**
* The radio driver calls this method to notify OpenThread diagnostics module of a received frame.
*
* @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.
* @param[in] aFrame A pointer to the received frame or nullptr if the receive operation failed.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received,
* OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
+9 -9
View File
@@ -71,7 +71,7 @@ inline void DataPollHandler::Callbacks::HandleFrameChangeDone(Child &aChild)
DataPollHandler::DataPollHandler(Instance &aInstance)
: InstanceLocator(aInstance)
, mIndirectTxChild(NULL)
, mIndirectTxChild(nullptr)
, mFrameContext()
, mCallbacks(aInstance)
{
@@ -88,7 +88,7 @@ void DataPollHandler::Clear(void)
child.ResetIndirectTxAttempts();
}
mIndirectTxChild = NULL;
mIndirectTxChild = nullptr;
}
void DataPollHandler::HandleNewFrame(Child &aChild)
@@ -135,7 +135,7 @@ void DataPollHandler::HandleDataPoll(Mac::RxFrame &aFrame)
SuccessOrExit(aFrame.GetSrcAddr(macSource));
child = Get<ChildTable>().FindChild(macSource, Child::kInStateValidOrRestoring);
VerifyOrExit(child != NULL, OT_NOOP);
VerifyOrExit(child != nullptr, OT_NOOP);
child->SetLastHeard(TimerMilli::GetNow());
child->ResetLinkFailures();
@@ -154,7 +154,7 @@ void DataPollHandler::HandleDataPoll(Mac::RxFrame &aFrame)
ExitNow();
}
if (mIndirectTxChild == NULL)
if (mIndirectTxChild == nullptr)
{
mIndirectTxChild = child;
Get<Mac::Mac>().RequestIndirectFrameTransmission();
@@ -172,7 +172,7 @@ otError DataPollHandler::HandleFrameRequest(Mac::TxFrame &aFrame)
{
otError error = OT_ERROR_NONE;
VerifyOrExit(mIndirectTxChild != NULL, error = OT_ERROR_ABORT);
VerifyOrExit(mIndirectTxChild != nullptr, error = OT_ERROR_ABORT);
SuccessOrExit(error = mCallbacks.PrepareFrameForChild(aFrame, mFrameContext, *mIndirectTxChild));
@@ -204,9 +204,9 @@ void DataPollHandler::HandleSentFrame(const Mac::TxFrame &aFrame, otError aError
{
Child *child = mIndirectTxChild;
VerifyOrExit(child != NULL, OT_NOOP);
VerifyOrExit(child != nullptr, OT_NOOP);
mIndirectTxChild = NULL;
mIndirectTxChild = nullptr;
HandleSentFrame(aFrame, aError, *child);
exit:
@@ -300,13 +300,13 @@ void DataPollHandler::ProcessPendingPolls(void)
// Find the child with earliest poll receive time.
if ((mIndirectTxChild == NULL) || (child->GetLastHeard() < mIndirectTxChild->GetLastHeard()))
if ((mIndirectTxChild == nullptr) || (child->GetLastHeard() < mIndirectTxChild->GetLastHeard()))
{
mIndirectTxChild = child;
}
}
if (mIndirectTxChild != NULL)
if (mIndirectTxChild != nullptr)
{
mIndirectTxChild->SetDataPollPending(false);
Get<Mac::Mac>().RequestIndirectFrameTransmission();
+1 -1
View File
@@ -268,7 +268,7 @@ private:
// In the current implementation of `DataPollHandler`, we can have a
// single indirect tx operation active at MAC layer at each point of
// time. `mIndirectTxChild` indicates the child being handled (NULL
// time. `mIndirectTxChild` indicates the child being handled (nullptr
// indicates no active indirect tx). `mFrameContext` tracks the
// context for the prepared frame for the current indirect tx.
+7 -7
View File
@@ -53,9 +53,9 @@ LinkRaw::LinkRaw(Instance &aInstance)
: InstanceLocator(aInstance)
, mReceiveChannel(OPENTHREAD_CONFIG_DEFAULT_CHANNEL)
, mPanId(kPanIdBroadcast)
, mReceiveDoneCallback(NULL)
, mTransmitDoneCallback(NULL)
, mEnergyScanDoneCallback(NULL)
, mReceiveDoneCallback(nullptr)
, mTransmitDoneCallback(nullptr)
, mEnergyScanDoneCallback(nullptr)
#if OPENTHREAD_RADIO
, mSubMac(aInstance)
#elif OPENTHREAD_CONFIG_LINK_RAW_ENABLE
@@ -148,7 +148,7 @@ exit:
void LinkRaw::InvokeReceiveDone(RxFrame *aFrame, otError aError)
{
otLogDebgMac("LinkRaw::ReceiveDone(%d bytes), error:%s", (aFrame != NULL) ? aFrame->mLength : 0,
otLogDebgMac("LinkRaw::ReceiveDone(%d bytes), error:%s", (aFrame != nullptr) ? aFrame->mLength : 0,
otThreadErrorToString(aError));
if (mReceiveDoneCallback && (aError == OT_ERROR_NONE))
@@ -177,7 +177,7 @@ void LinkRaw::InvokeTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, otError aE
if (mTransmitDoneCallback)
{
mTransmitDoneCallback(&GetInstance(), &aFrame, aAckFrame, aError);
mTransmitDoneCallback = NULL;
mTransmitDoneCallback = nullptr;
}
}
@@ -196,10 +196,10 @@ exit:
void LinkRaw::InvokeEnergyScanDone(int8_t aEnergyScanMaxRssi)
{
if (IsEnabled() && mEnergyScanDoneCallback != NULL)
if (IsEnabled() && mEnergyScanDoneCallback != nullptr)
{
mEnergyScanDoneCallback(&GetInstance(), aEnergyScanMaxRssi);
mEnergyScanDoneCallback = NULL;
mEnergyScanDoneCallback = nullptr;
}
}
+3 -3
View File
@@ -107,7 +107,7 @@ public:
/**
* This method invokes the mReceiveDoneCallback, if set.
*
* @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.
* @param[in] aFrame A pointer to the received frame or nullptr if the receive operation failed.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received,
* OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
@@ -140,7 +140,7 @@ public:
* This method invokes the mTransmitDoneCallback, if set.
*
* @param[in] aFrame The transmitted frame.
* @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received.
* @param[in] aAckFrame A pointer to the ACK frame, nullptr if no ACK was received.
* @param[in] aError OT_ERROR_NONE when the frame was transmitted,
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE tx failed due to activity on the channel,
@@ -281,7 +281,7 @@ public:
* of a frame transmission request, this method is invoked on all frame transmission attempts.
*
* @param[in] aFrame The transmitted frame.
* @param[in] aAckFrame A pointer to the ACK frame, or NULL if no ACK was received.
* @param[in] aAckFrame A pointer to the ACK frame, or nullptr if no ACK was received.
* @param[in] aError OT_ERROR_NONE when the frame was transmitted successfully,
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE tx failed due to activity on the channel,
+31 -31
View File
@@ -112,12 +112,12 @@ Mac::Mac(Instance &aInstance)
#if OPENTHREAD_FTD
, mMaxFrameRetriesIndirect(kDefaultMaxFrameRetriesIndirect)
#endif
, mActiveScanHandler(NULL) // Initialize `mActiveScanHandler` and `mEnergyScanHandler` union
, mScanHandlerContext(NULL)
, mActiveScanHandler(nullptr) // Initialize `mActiveScanHandler` and `mEnergyScanHandler` union
, mScanHandlerContext(nullptr)
, mSubMac(aInstance)
, mOperationTask(aInstance, &Mac::HandleOperationTask, this)
, mTimer(aInstance, Mac::HandleTimer, this)
, mOobFrame(NULL)
, mOobFrame(nullptr)
, mKeyIdMode2FrameCounter(0)
, mCcaSampleCount(0)
#if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE
@@ -229,13 +229,13 @@ otError Mac::ConvertBeaconToActiveScanResult(const RxFrame *aBeaconFrame, Active
{
otError error = OT_ERROR_NONE;
Address address;
const Beacon * beacon = NULL;
const BeaconPayload *beaconPayload = NULL;
const Beacon * beacon = nullptr;
const BeaconPayload *beaconPayload = nullptr;
uint16_t payloadLength;
memset(&aResult, 0, sizeof(ActiveScanResult));
VerifyOrExit(aBeaconFrame != NULL, error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(aBeaconFrame != nullptr, error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(aBeaconFrame->GetType() == Frame::kFcfFrameBeacon, error = OT_ERROR_PARSE);
SuccessOrExit(error = aBeaconFrame->GetSrcAddr(address));
@@ -290,18 +290,18 @@ void Mac::PerformActiveScan(void)
{
mSubMac.SetPanId(mPanId);
FinishOperation();
ReportActiveScanResult(NULL);
ReportActiveScanResult(nullptr);
PerformNextOperation();
}
}
void Mac::ReportActiveScanResult(const RxFrame *aBeaconFrame)
{
VerifyOrExit(mActiveScanHandler != NULL, OT_NOOP);
VerifyOrExit(mActiveScanHandler != nullptr, OT_NOOP);
if (aBeaconFrame == NULL)
if (aBeaconFrame == nullptr)
{
mActiveScanHandler(NULL, mScanHandlerContext);
mActiveScanHandler(nullptr, mScanHandlerContext);
}
else
{
@@ -341,9 +341,9 @@ exit:
{
FinishOperation();
if (mEnergyScanHandler != NULL)
if (mEnergyScanHandler != nullptr)
{
mEnergyScanHandler(NULL, mScanHandlerContext);
mEnergyScanHandler(nullptr, mScanHandlerContext);
}
PerformNextOperation();
@@ -354,7 +354,7 @@ void Mac::ReportEnergyScanResult(int8_t aRssi)
{
EnergyScanResult result;
VerifyOrExit((mEnergyScanHandler != NULL) && (aRssi != kInvalidRssiValue), OT_NOOP);
VerifyOrExit((mEnergyScanHandler != nullptr) && (aRssi != kInvalidRssiValue), OT_NOOP);
result.mChannel = mScanChannel;
result.mMaxRssi = aRssi;
@@ -566,7 +566,7 @@ otError Mac::RequestOutOfBandFrameTransmission(otRadioFrame *aOobFrame)
{
otError error = OT_ERROR_NONE;
VerifyOrExit(aOobFrame != NULL, error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(aOobFrame != nullptr, error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(IsEnabled(), error = OT_ERROR_INVALID_STATE);
VerifyOrExit(!mPendingTransmitOobFrame && (mOperation != kOperationTransmitOutOfBandFrame),
error = OT_ERROR_ALREADY);
@@ -872,8 +872,8 @@ void Mac::PrepareBeacon(TxFrame &aFrame)
{
uint8_t beaconLength;
uint16_t fcf;
Beacon * beacon = NULL;
BeaconPayload *beaconPayload = NULL;
Beacon * beacon = nullptr;
BeaconPayload *beaconPayload = nullptr;
fcf = Frame::kFcfFrameBeacon | Frame::kFcfDstAddrNone | Frame::kFcfSrcAddrExt;
aFrame.InitMacHeader(fcf, Frame::kSecNone);
@@ -949,7 +949,7 @@ void Mac::ProcessTransmitSecurity(TxFrame &aFrame)
{
KeyManager & keyManager = Get<KeyManager>();
uint8_t keyIdMode;
const ExtAddress *extAddress = NULL;
const ExtAddress *extAddress = nullptr;
VerifyOrExit(aFrame.GetSecurityEnabled(), OT_NOOP);
@@ -1114,7 +1114,7 @@ exit:
// the radio platform aborting the tx operation.
sendFrame.SetLength(0);
HandleTransmitDone(sendFrame, NULL, OT_ERROR_ABORT);
HandleTransmitDone(sendFrame, nullptr, OT_ERROR_ABORT);
}
}
@@ -1156,7 +1156,7 @@ void Mac::RecordFrameTransmitStatus(const TxFrame &aFrame,
// Record frame transmission success/failure state (for a neighbor).
if ((neighbor != NULL) && ackRequested)
if ((neighbor != nullptr) && ackRequested)
{
bool frameTxSuccess = true;
@@ -1201,7 +1201,7 @@ void Mac::RecordFrameTransmitStatus(const TxFrame &aFrame,
// Update neighbor's RSSI link info from the received Ack.
if ((aError == OT_ERROR_NONE) && ackRequested && (aAckFrame != NULL) && (neighbor != NULL))
if ((aError == OT_ERROR_NONE) && ackRequested && (aAckFrame != nullptr) && (neighbor != nullptr))
{
neighbor->GetLinkInfo().AddRss(aAckFrame->GetRssi());
}
@@ -1289,7 +1289,7 @@ void Mac::HandleTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, otError aError
case kOperationTransmitPoll:
OT_ASSERT(aFrame.IsEmpty() || aFrame.GetAckRequest());
if ((aError == OT_ERROR_NONE) && (aAckFrame != NULL))
if ((aError == OT_ERROR_NONE) && (aAckFrame != nullptr))
{
bool framePending = aAckFrame->GetFramePending();
@@ -1327,7 +1327,7 @@ void Mac::HandleTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, otError aError
Get<MeshForwarder>().HandleSentFrame(aFrame, aError);
#if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2
if (aError == OT_ERROR_NONE && Get<Mle::Mle>().GetParent().IsEnhancedKeepAliveSupported() &&
aFrame.GetSecurityEnabled() && aAckFrame != NULL)
aFrame.GetSecurityEnabled() && aAckFrame != nullptr)
{
Get<DataPollSender>().ProcessFrame(*aAckFrame);
}
@@ -1445,7 +1445,7 @@ otError Mac::ProcessReceiveSecurity(RxFrame &aFrame, const Address &aSrcAddr, Ne
break;
case Frame::kKeyIdMode1:
VerifyOrExit(aNeighbor != NULL, OT_NOOP);
VerifyOrExit(aNeighbor != nullptr, OT_NOOP);
IgnoreError(aFrame.GetKeyId(keyid));
keyid--;
@@ -1556,7 +1556,7 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, otError aError)
mCounters.mRxTotal++;
SuccessOrExit(error);
VerifyOrExit(aFrame != NULL, error = OT_ERROR_NO_FRAME_RECEIVED);
VerifyOrExit(aFrame != nullptr, error = OT_ERROR_NO_FRAME_RECEIVED);
VerifyOrExit(IsEnabled(), error = OT_ERROR_INVALID_STATE);
// Ensure we have a valid frame before attempting to read any contents of
@@ -1581,7 +1581,7 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, otError aError)
#if OPENTHREAD_FTD
// Allow multicasts from neighbor routers if FTD
if (neighbor == NULL && dstaddr.IsBroadcast() && Get<Mle::MleRouter>().IsFullThreadDevice())
if (neighbor == nullptr && dstaddr.IsBroadcast() && Get<Mle::MleRouter>().IsFullThreadDevice())
{
neighbor = Get<Mle::MleRouter>().GetRxOnlyNeighborRouter(srcaddr);
}
@@ -1605,7 +1605,7 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, otError aError)
case Address::kTypeShort:
otLogDebgMac("Received frame from short address 0x%04x", srcaddr.GetShort());
VerifyOrExit(neighbor != NULL, error = OT_ERROR_UNKNOWN_NEIGHBOR);
VerifyOrExit(neighbor != nullptr, error = OT_ERROR_UNKNOWN_NEIGHBOR);
srcaddr.SetExtended(neighbor->GetExtAddress());
@@ -1628,7 +1628,7 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, otError aError)
// Clear any previous link info to ensure the fixed RSSI
// value takes effect quickly.
if (neighbor != NULL)
if (neighbor != nullptr)
{
neighbor->GetLinkInfo().Clear();
}
@@ -1680,7 +1680,7 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, otError aError)
Get<DataPollSender>().ProcessFrame(*aFrame);
if (neighbor != NULL)
if (neighbor != nullptr)
{
neighbor->GetLinkInfo().AddRss(aFrame->GetRssi());
@@ -1989,7 +1989,7 @@ void Mac::LogFrameRxFailure(const RxFrame *aFrame, otError aError) const
break;
}
if (aFrame == NULL)
if (aFrame == nullptr)
{
otLogMac(logLevel, "Frame rx failed, error:%s", otThreadErrorToString(aError));
}
@@ -2037,10 +2037,10 @@ uint8_t Mac::GetTimeIeOffset(const Frame &aFrame)
{
uint8_t offset = 0;
const uint8_t *base = aFrame.GetPsdu();
const uint8_t *cur = NULL;
const uint8_t *cur = nullptr;
cur = reinterpret_cast<const uint8_t *>(aFrame.GetTimeIe());
VerifyOrExit(cur != NULL, OT_NOOP);
VerifyOrExit(cur != nullptr, OT_NOOP);
cur += sizeof(VendorIeHeader);
offset = static_cast<uint8_t>(cur - base);
+5 -5
View File
@@ -227,7 +227,7 @@ public:
* @retval OT_ERROR_NONE Successfully scheduled the frame transmission.
* @retval OT_ERROR_ALREADY MAC layer is busy sending a previously requested frame.
* @retval OT_ERROR_INVALID_STATE The MAC layer is not enabled.
* @retval OT_ERROR_INVALID_ARGS The argument @p aOobFrame is NULL.
* @retval OT_ERROR_INVALID_ARGS The argument @p aOobFrame is nullptr.
*
*/
otError RequestOutOfBandFrameTransmission(otRadioFrame *aOobFrame);
@@ -465,7 +465,7 @@ public:
/**
* This method is called to handle a received frame.
*
* @param[in] aFrame A pointer to the received frame, or NULL if the receive operation was aborted.
* @param[in] aFrame A pointer to the received frame, or nullptr if the receive operation was aborted.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received.
*
@@ -488,7 +488,7 @@ public:
* of a frame transmission request, this method is invoked on all frame transmission attempts.
*
* @param[in] aFrame The transmitted frame.
* @param[in] aAckFrame A pointer to the ACK frame, or NULL if no ACK was received.
* @param[in] aAckFrame A pointer to the ACK frame, or nullptr if no ACK was received.
* @param[in] aError OT_ERROR_NONE when the frame was transmitted successfully,
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE tx failed due to activity on the channel,
@@ -508,7 +508,7 @@ public:
* This method is called to handle transmit events.
*
* @param[in] aFrame The frame that was transmitted.
* @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received.
* @param[in] aAckFrame A pointer to the ACK frame, nullptr if no ACK was received.
* @param[in] aError OT_ERROR_NONE when the frame was transmitted successfully,
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE when the tx failed due to activity on the channel,
@@ -553,7 +553,7 @@ public:
* This method registers a callback to provide received raw IEEE 802.15.4 frames.
*
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame
* or NULL to disable the callback.
* or nullptr to disable the callback.
* @param[in] aCallbackContext A pointer to application-specific context.
*
*/
+14 -14
View File
@@ -63,7 +63,7 @@ Filter::FilterEntry *Filter::FindEntry(const ExtAddress &aExtAddress)
}
}
entry = NULL;
entry = nullptr;
exit:
return entry;
@@ -78,7 +78,7 @@ Filter::FilterEntry *Filter::FindAvailableEntry(void)
VerifyOrExit(entry->IsInUse(), OT_NOOP);
}
entry = NULL;
entry = nullptr;
exit:
return entry;
@@ -103,9 +103,9 @@ otError Filter::AddAddress(const ExtAddress &aExtAddress)
otError error = OT_ERROR_NONE;
FilterEntry *entry = FindEntry(aExtAddress);
if (entry == NULL)
if (entry == nullptr)
{
VerifyOrExit((entry = FindAvailableEntry()) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((entry = FindAvailableEntry()) != nullptr, error = OT_ERROR_NO_BUFS);
entry->mExtAddress = aExtAddress;
}
@@ -121,7 +121,7 @@ otError Filter::RemoveAddress(const ExtAddress &aExtAddress)
otError error = OT_ERROR_NONE;
FilterEntry *entry = FindEntry(aExtAddress);
if (entry == NULL || !entry->mFiltered)
if (entry == nullptr || !entry->mFiltered)
{
ExitNow(error = OT_ERROR_NOT_FOUND);
}
@@ -166,15 +166,15 @@ otError Filter::AddRssIn(const ExtAddress *aExtAddress, int8_t aRss)
otError error = OT_ERROR_NONE;
FilterEntry *entry;
// Set the default RssIn when aExtAddress is not given (NULL)
VerifyOrExit(aExtAddress != NULL, mDefaultRssIn = aRss);
// Set the default RssIn when aExtAddress is not given (nullptr)
VerifyOrExit(aExtAddress != nullptr, mDefaultRssIn = aRss);
entry = FindEntry(*aExtAddress);
if (entry == NULL)
if (entry == nullptr)
{
entry = FindAvailableEntry();
VerifyOrExit(entry != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(entry != nullptr, error = OT_ERROR_NO_BUFS);
entry->mExtAddress = *aExtAddress;
}
@@ -191,10 +191,10 @@ otError Filter::RemoveRssIn(const ExtAddress *aExtAddress)
FilterEntry *entry;
// If no aExtAddress is given, remove default RssIn
VerifyOrExit(aExtAddress != NULL, mDefaultRssIn = kFixedRssDisabled);
VerifyOrExit(aExtAddress != nullptr, mDefaultRssIn = kFixedRssDisabled);
entry = FindEntry(*aExtAddress);
VerifyOrExit(entry != NULL, error = OT_ERROR_NOT_FOUND);
VerifyOrExit(entry != nullptr, error = OT_ERROR_NOT_FOUND);
entry->mRssIn = kFixedRssDisabled;
exit:
@@ -252,14 +252,14 @@ otError Filter::Apply(const ExtAddress &aExtAddress, int8_t &aRss)
if (mAddressMode == OT_MAC_FILTER_ADDRESS_MODE_WHITELIST)
{
VerifyOrExit(entry != NULL && entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED);
VerifyOrExit(entry != nullptr && entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED);
}
else if (mAddressMode == OT_MAC_FILTER_ADDRESS_MODE_BLACKLIST)
{
VerifyOrExit(entry == NULL || !entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED);
VerifyOrExit(entry == nullptr || !entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED);
}
if ((entry != NULL) && (entry->mRssIn != kFixedRssDisabled))
if ((entry != nullptr) && (entry->mRssIn != kFixedRssDisabled))
{
aRss = entry->mRssIn;
}
+5 -4
View File
@@ -150,11 +150,12 @@ public:
* This method sets the received signal strength for the messages from the Extended Address.
* The default received signal strength for all received messages would be set if no Extended Address is specified.
*
* @param[in] aExtAddress A pointer to the Extended Address, or NULL to set the default received signal strength.
* @param[in] aExtAddress A pointer to the Extended Address, or nullptr to set the default received signal
* strength.
* @param[in] aRss The received signal strength to set.
*
* @retval OT_ERROR_NONE Successfully set @p aRss for @p aExtAddress, or
* set the default @p aRss for all received messages if @p aExtAddress is NULL.
* set the default @p aRss for all received messages if @p aExtAddress is nullptr.
* @retval OT_ERROR_NO_BUFS No available entry exists.
*
*/
@@ -168,8 +169,8 @@ public:
*
* @retval OT_ERROR_NONE Successfully removed the received signal strength setting for the received
* messages from @p aExtAddress or removed the default received signal strength
* setting if @p aExtAddress is NULL.
* @retval OT_ERROR_NOT_FOUND @p aExtAddress is not in the RssIn filter if it is not NULL.
* setting if @p aExtAddress is nullptr.
* @retval OT_ERROR_NOT_FOUND @p aExtAddress is not in the RssIn filter if it is not nullptr.
*
*/
otError RemoveRssIn(const ExtAddress *aExtAddress);
+12 -12
View File
@@ -838,7 +838,7 @@ uint8_t Frame::FindPayloadIndex(void) const
{
uint8_t index = SkipSecurityHeaderIndex();
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
const uint8_t *cur = NULL;
const uint8_t *cur = nullptr;
const uint8_t *footer = GetFooter();
#endif
@@ -887,7 +887,7 @@ const uint8_t *Frame::GetPayload(void) const
uint8_t index = FindPayloadIndex();
const uint8_t *payload = GetPsdu() + index;
VerifyOrExit(index != kInvalidIndex, payload = NULL);
VerifyOrExit(index != kInvalidIndex, payload = nullptr);
exit:
return payload;
@@ -938,7 +938,7 @@ exit:
const uint8_t *Frame::GetHeaderIe(uint8_t aIeId) const
{
uint8_t index = FindHeaderIeIndex();
const uint8_t *cur = NULL;
const uint8_t *cur = nullptr;
const uint8_t *payload = GetPayload();
VerifyOrExit(index != kInvalidIndex, OT_NOOP);
@@ -957,14 +957,14 @@ const uint8_t *Frame::GetHeaderIe(uint8_t aIeId) const
cur += sizeof(HeaderIe);
VerifyOrExit(cur + len <= payload, cur = NULL);
VerifyOrExit(cur + len <= payload, cur = nullptr);
cur += len;
}
if (cur == payload)
{
cur = NULL;
cur = nullptr;
}
exit:
@@ -978,7 +978,7 @@ void Frame::SetCslIe(uint16_t aCslPeriod, uint16_t aCslPhase)
uint8_t *cur = GetHeaderIe(Frame::kHeaderIeCsl);
CslIe * csl;
OT_ASSERT(cur != NULL);
OT_ASSERT(cur != nullptr);
csl = reinterpret_cast<CslIe *>(cur + sizeof(HeaderIe));
csl->SetPeriod(aCslPeriod);
@@ -989,20 +989,20 @@ void Frame::SetCslIe(uint16_t aCslPeriod, uint16_t aCslPhase)
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
const TimeIe *Frame::GetTimeIe(void) const
{
const TimeIe * timeIe = NULL;
const uint8_t *cur = NULL;
const TimeIe * timeIe = nullptr;
const uint8_t *cur = nullptr;
uint8_t oui[VendorIeHeader::kVendorOuiSize] = {VendorIeHeader::kVendorOuiNest & 0xff,
(VendorIeHeader::kVendorOuiNest >> 8) & 0xff,
(VendorIeHeader::kVendorOuiNest >> 16) & 0xff};
cur = GetHeaderIe(kHeaderIeVendor);
VerifyOrExit(cur != NULL, OT_NOOP);
VerifyOrExit(cur != nullptr, OT_NOOP);
cur += sizeof(HeaderIe);
timeIe = reinterpret_cast<const TimeIe *>(cur);
VerifyOrExit(memcmp(oui, timeIe->GetVendorOui(), VendorIeHeader::kVendorOuiSize) == 0, timeIe = NULL);
VerifyOrExit(timeIe->GetSubType() == VendorIeHeader::kVendorIeTime, timeIe = NULL);
VerifyOrExit(memcmp(oui, timeIe->GetVendorOui(), VendorIeHeader::kVendorOuiSize) == 0, timeIe = nullptr);
VerifyOrExit(timeIe->GetSubType() == VendorIeHeader::kVendorIeTime, timeIe = nullptr);
exit:
return timeIe;
@@ -1181,7 +1181,7 @@ otError TxFrame::GenerateEnhAck(const RxFrame &aFrame, bool aIsFramePending, con
// Set header IE
if (aIeLength > 0)
{
OT_ASSERT(aIeData != NULL);
OT_ASSERT(aIeData != nullptr);
memcpy(GetPsdu() + FindHeaderIeIndex(), aIeData, aIeLength);
}
+4 -4
View File
@@ -878,7 +878,7 @@ public:
/**
* This method returns a pointer to the vendor specific Time IE.
*
* @returns A pointer to the Time IE, NULL if not found.
* @returns A pointer to the Time IE, nullptr if not found.
*
*/
TimeIe *GetTimeIe(void) { return const_cast<TimeIe *>(const_cast<const Frame *>(this)->GetTimeIe()); }
@@ -886,7 +886,7 @@ public:
/**
* This method returns a pointer to the vendor specific Time IE.
*
* @returns A pointer to the Time IE, NULL if not found.
* @returns A pointer to the Time IE, nullptr if not found.
*
*/
const TimeIe *GetTimeIe(void) const;
@@ -910,7 +910,7 @@ public:
*
* @param[in] aIeId The Element Id of the Header IE.
*
* @returns A pointer to the Header IE, NULL if not found.
* @returns A pointer to the Header IE, nullptr if not found.
*
*/
uint8_t *GetHeaderIe(uint8_t aIeId)
@@ -923,7 +923,7 @@ public:
*
* @param[in] aIeId The Element Id of the Header IE.
*
* @returns A pointer to the Header IE, NULL if not found.
* @returns A pointer to the Header IE, nullptr if not found.
*
*/
const uint8_t *GetHeaderIe(uint8_t aIeId) const;
+6 -6
View File
@@ -57,8 +57,8 @@ SubMac::SubMac(Instance &aInstance)
, mEnergyScanEndTime(0)
, mTransmitFrame(Get<Radio>().GetTransmitBuffer())
, mCallbacks(aInstance)
, mPcapCallback(NULL)
, mPcapCallbackContext(NULL)
, mPcapCallback(nullptr)
, mPcapCallbackContext(nullptr)
, mFrameCounter(0)
, mKeyId(0)
, mTimer(aInstance, SubMac::HandleTimer, this)
@@ -197,12 +197,12 @@ exit:
void SubMac::HandleReceiveDone(RxFrame *aFrame, otError aError)
{
if (mPcapCallback && (aFrame != NULL) && (aError == OT_ERROR_NONE))
if (mPcapCallback && (aFrame != nullptr) && (aError == OT_ERROR_NONE))
{
mPcapCallback(aFrame, false, mPcapCallbackContext);
}
if (!ShouldHandleTransmitSecurity() && aFrame != NULL && aFrame->mInfo.mRxInfo.mAckedWithSecEnhAck)
if (!ShouldHandleTransmitSecurity() && aFrame != nullptr && aFrame->mInfo.mRxInfo.mAckedWithSecEnhAck)
{
UpdateFrameCounter(aFrame->mInfo.mRxInfo.mAckFrameCounter);
}
@@ -239,7 +239,7 @@ exit:
void SubMac::ProcessTransmitSecurity(void)
{
const ExtAddress *extAddress = NULL;
const ExtAddress *extAddress = nullptr;
uint8_t keyIdMode;
VerifyOrExit(ShouldHandleTransmitSecurity(), OT_NOOP);
@@ -536,7 +536,7 @@ void SubMac::HandleTimer(void)
case kStateTransmit:
otLogDebgMac("Ack timer timed out");
IgnoreError(Get<Radio>().Receive(mTransmitFrame.GetChannel()));
HandleTransmitDone(mTransmitFrame, NULL, OT_ERROR_NO_ACK);
HandleTransmitDone(mTransmitFrame, nullptr, OT_ERROR_NO_ACK);
break;
case kStateEnergyScan:
+4 -4
View File
@@ -102,7 +102,7 @@ public:
/**
* This method notifies user of `SubMac` of a received frame.
*
* @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.
* @param[in] aFrame A pointer to the received frame or nullptr if the receive operation failed.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received,
* OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
@@ -130,7 +130,7 @@ public:
* of a frame transmission, this method is invoked on all frame transmission attempts.
*
* @param[in] aFrame The transmitted frame.
* @param[in] aAckFrame A pointer to the ACK frame, or NULL if no ACK was received.
* @param[in] aAckFrame A pointer to the ACK frame, or nullptr if no ACK was received.
* @param[in] aError OT_ERROR_NONE when the frame was transmitted successfully,
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE tx failed due to activity on the channel,
@@ -151,7 +151,7 @@ public:
* the received ACK frame.
*
* @param[in] aFrame The transmitted frame.
* @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received.
* @param[in] aAckFrame A pointer to the ACK frame, nullptr if no ACK was received.
* @param[in] aError OT_ERROR_NONE when the frame was transmitted,
* OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
* OT_ERROR_CHANNEL_ACCESS_FAILURE tx failed due to activity on the channel,
@@ -245,7 +245,7 @@ public:
* This method registers a callback to provide received packet capture for IEEE 802.15.4 frames.
*
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame
* or NULL to disable the callback.
* or nullptr to disable the callback.
* @param[in] aCallbackContext A pointer to application-specific context.
*
*/
+3 -3
View File
@@ -61,10 +61,10 @@ otError AnnounceBeginClient::SendRequest(uint32_t aChannelMask,
otError error = OT_ERROR_NONE;
MeshCoP::ChannelMaskTlv channelMask;
Ip6::MessageInfo messageInfo;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
VerifyOrExit(Get<MeshCoP::Commissioner>().IsActive(), error = OT_ERROR_INVALID_STATE);
VerifyOrExit((message = MeshCoP::NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = MeshCoP::NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error =
message->Init(aAddress.IsMulticast() ? OT_COAP_TYPE_NON_CONFIRMABLE : OT_COAP_TYPE_CONFIRMABLE,
@@ -91,7 +91,7 @@ otError AnnounceBeginClient::SendRequest(uint32_t aChannelMask,
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
+28 -28
View File
@@ -165,16 +165,16 @@ static Coap::Message::Code CoapCodeFromError(otError aError)
static void SendErrorMessage(Coap::CoapSecure &aCoapSecure, ForwardContext &aForwardContext, otError aError)
{
otError error = OT_ERROR_NONE;
Coap::Message *message = NULL;
Coap::Message *message = nullptr;
VerifyOrExit((message = NewMeshCoPMessage(aCoapSecure)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(aCoapSecure)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = aForwardContext.ToHeader(*message, CoapCodeFromError(aError)));
SuccessOrExit(error = aCoapSecure.SendMessage(*message, aCoapSecure.GetPeerAddress()));
exit:
if (error != OT_ERROR_NONE)
{
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -189,9 +189,9 @@ static void SendErrorMessage(Coap::CoapSecure & aCoapSecure,
otError aError)
{
otError error = OT_ERROR_NONE;
Coap::Message *message = NULL;
Coap::Message *message = nullptr;
VerifyOrExit((message = NewMeshCoPMessage(aCoapSecure)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(aCoapSecure)) != nullptr, error = OT_ERROR_NO_BUFS);
if (aRequest.IsNonConfirmable() || aSeparate)
{
@@ -214,7 +214,7 @@ static void SendErrorMessage(Coap::CoapSecure & aCoapSecure,
exit:
if (error != OT_ERROR_NONE)
{
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -234,11 +234,11 @@ void BorderAgent::HandleCoapResponse(void * aContext,
BorderAgent & borderAgent = forwardContext.GetBorderAgent();
Instance & instance = borderAgent.GetInstance();
const Coap::Message *response = static_cast<const Coap::Message *>(aMessage);
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
otError error;
SuccessOrExit(error = aResult);
VerifyOrExit((message = NewMeshCoPMessage(instance.Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(instance.Get<Coap::CoapSecure>())) != nullptr, error = OT_ERROR_NO_BUFS);
if (forwardContext.IsPetition() && response->GetCode() == OT_COAP_CODE_CHANGED)
{
@@ -271,7 +271,7 @@ void BorderAgent::HandleCoapResponse(void * aContext,
exit:
if (error != OT_ERROR_NONE)
{
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -390,7 +390,7 @@ exit:
void BorderAgent::HandleProxyTransmit(const Coap::Message &aMessage)
{
Message * message = NULL;
Message * message = nullptr;
Ip6::MessageInfo messageInfo;
uint16_t offset;
otError error;
@@ -401,7 +401,7 @@ void BorderAgent::HandleProxyTransmit(const Coap::Message &aMessage)
SuccessOrExit(error = Tlv::FindTlvOffset(aMessage, Tlv::kUdpEncapsulation, offset));
VerifyOrExit(aMessage.Read(offset, sizeof(tlv), &tlv) == sizeof(tlv), error = OT_ERROR_PARSE);
VerifyOrExit((message = Get<Ip6::Udp>().NewMessage(0)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = Get<Ip6::Udp>().NewMessage(0)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetLength(tlv.GetUdpLength()));
aMessage.CopyTo(offset + sizeof(tlv), 0, tlv.GetUdpLength(), *message);
@@ -421,7 +421,7 @@ exit:
{
otLogWarnMeshCoP("Failed to send proxy stream: %s", otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -431,14 +431,14 @@ exit:
bool BorderAgent::HandleUdpReceive(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error;
Coap::Message *message = NULL;
Coap::Message *message = nullptr;
VerifyOrExit(aMessageInfo.GetSockAddr() == mCommissionerAloc.GetAddress(),
error = OT_ERROR_DESTINATION_ADDRESS_FILTERED);
VerifyOrExit(aMessage.GetLength() > 0, error = OT_ERROR_NONE);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != nullptr, error = OT_ERROR_NO_BUFS);
message->Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST);
SuccessOrExit(error = message->AppendUriPathOptions(OT_URI_PATH_PROXY_RX));
@@ -468,7 +468,7 @@ bool BorderAgent::HandleUdpReceive(const Message &aMessage, const Ip6::MessageIn
otLogInfoMeshCoP("Sent to commissioner on %s", OT_URI_PATH_PROXY_RX);
exit:
if (message != NULL && error != OT_ERROR_NONE)
if (message != nullptr && error != OT_ERROR_NONE)
{
otLogWarnMeshCoP("Failed notify commissioner on %s", OT_URI_PATH_PROXY_RX);
message->Free();
@@ -479,11 +479,11 @@ exit:
void BorderAgent::HandleRelayReceive(const Coap::Message &aMessage)
{
Coap::Message *message = NULL;
Coap::Message *message = nullptr;
otError error;
VerifyOrExit(aMessage.IsNonConfirmable() && aMessage.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != nullptr, error = OT_ERROR_NO_BUFS);
message->Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST);
SuccessOrExit(error = message->AppendUriPathOptions(OT_URI_PATH_RELAY_RX));
@@ -497,7 +497,7 @@ void BorderAgent::HandleRelayReceive(const Coap::Message &aMessage)
otLogInfoMeshCoP("Sent to commissioner on %s", OT_URI_PATH_RELAY_RX);
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -542,7 +542,7 @@ void BorderAgent::HandleRelayTransmit(const Coap::Message &aMessage)
{
otError error = OT_ERROR_NONE;
uint16_t joinerRouterRloc;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
Ip6::MessageInfo messageInfo;
uint16_t offset = 0;
@@ -550,7 +550,7 @@ void BorderAgent::HandleRelayTransmit(const Coap::Message &aMessage)
SuccessOrExit(error = Tlv::FindUint16Tlv(aMessage, Tlv::kJoinerRouterLocator, joinerRouterRloc));
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_RELAY_TX));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -574,7 +574,7 @@ exit:
{
otLogWarnMeshCoP("Failed to sent to joiner router request " OT_URI_PATH_RELAY_TX " %s",
otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -588,12 +588,12 @@ otError BorderAgent::ForwardToLeader(const Coap::Message & aMessage,
bool aSeparate)
{
otError error = OT_ERROR_NONE;
ForwardContext * forwardContext = NULL;
ForwardContext * forwardContext = nullptr;
Ip6::MessageInfo messageInfo;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
uint16_t offset = 0;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
if (aSeparate)
{
@@ -601,7 +601,7 @@ otError BorderAgent::ForwardToLeader(const Coap::Message & aMessage,
}
forwardContext = static_cast<ForwardContext *>(GetInstance().HeapCAlloc(1, sizeof(ForwardContext)));
VerifyOrExit(forwardContext != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(forwardContext != nullptr, error = OT_ERROR_NO_BUFS);
forwardContext = new (forwardContext) ForwardContext(*this, aMessage, aPetition, aSeparate);
@@ -625,19 +625,19 @@ otError BorderAgent::ForwardToLeader(const Coap::Message & aMessage,
SuccessOrExit(error = Get<Coap::Coap>().SendMessage(*message, messageInfo, HandleCoapResponse, forwardContext));
// HandleCoapResponse is responsible to free this forward context.
forwardContext = NULL;
forwardContext = nullptr;
otLogInfoMeshCoP("Forwarded request to leader on %s", aPath);
exit:
if (error != OT_ERROR_NONE)
{
if (forwardContext != NULL)
if (forwardContext != nullptr)
{
GetInstance().HeapFree(forwardContext);
}
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
+23 -23
View File
@@ -70,9 +70,9 @@ Commissioner::Commissioner(Instance &aInstance)
, mAnnounceBegin(aInstance)
, mEnergyScan(aInstance)
, mPanIdQuery(aInstance)
, mStateCallback(NULL)
, mJoinerCallback(NULL)
, mCallbackContext(NULL)
, mStateCallback(nullptr)
, mJoinerCallback(nullptr)
, mCallbackContext(nullptr)
, mState(OT_COMMISSIONER_STATE_DISABLED)
{
memset(mJoiners, 0, sizeof(mJoiners));
@@ -258,7 +258,7 @@ otError Commissioner::SendCommissionerSet(void)
dataset.mIsSteeringDataSet = true;
SuccessOrExit(error = SendMgmtCommissionerSetRequest(dataset, NULL, 0));
SuccessOrExit(error = SendMgmtCommissionerSetRequest(dataset, nullptr, 0));
exit:
return error;
@@ -291,7 +291,7 @@ otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPskd
continue;
}
if (aEui64 != NULL)
if (aEui64 != nullptr)
{
joiner->mEui64 = *aEui64;
joiner->mAny = false;
@@ -309,7 +309,7 @@ otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPskd
IgnoreError(SendCommissionerSet());
otLogInfoMeshCoP("Added Joiner (%s, %s)", (aEui64 != NULL) ? aEui64->ToString().AsCString() : "*", aPskd);
otLogInfoMeshCoP("Added Joiner (%s, %s)", (aEui64 != nullptr) ? aEui64->ToString().AsCString() : "*", aPskd);
ExitNow(error = OT_ERROR_NONE);
}
@@ -361,7 +361,7 @@ otError Commissioner::RemoveJoiner(const Mac::ExtAddress *aEui64, uint32_t aDela
continue;
}
if (aEui64 != NULL)
if (aEui64 != nullptr)
{
if (joiner->mEui64 != *aEui64)
{
@@ -394,7 +394,7 @@ otError Commissioner::RemoveJoiner(const Mac::ExtAddress *aEui64, uint32_t aDela
IgnoreError(SendCommissionerSet());
}
otLogInfoMeshCoP("Removed Joiner (%s)", (aEui64 != NULL) ? aEui64->ToString().AsCString() : "*");
otLogInfoMeshCoP("Removed Joiner (%s)", (aEui64 != nullptr) ? aEui64->ToString().AsCString() : "*");
ComputeJoinerId(joiner->mEui64, joinerId);
SignalJoinerEvent(OT_COMMISSIONER_JOINER_REMOVED, joinerId);
@@ -412,7 +412,7 @@ otError Commissioner::SetProvisioningUrl(const char *aProvisioningUrl)
otError error = OT_ERROR_NONE;
uint8_t len;
if (aProvisioningUrl == NULL)
if (aProvisioningUrl == nullptr)
{
mProvisioningUrl[0] = '\0';
ExitNow();
@@ -526,7 +526,7 @@ otError Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs, uint8
Ip6::MessageInfo messageInfo;
MeshCoP::Tlv tlv;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_COMMISSIONER_GET));
@@ -553,7 +553,7 @@ otError Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs, uint8
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -591,7 +591,7 @@ otError Commissioner::SendMgmtCommissionerSetRequest(const otCommissioningDatase
Coap::Message * message;
Ip6::MessageInfo messageInfo;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_COMMISSIONER_SET));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -639,7 +639,7 @@ otError Commissioner::SendMgmtCommissionerSetRequest(const otCommissioningDatase
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -672,13 +672,13 @@ exit:
otError Commissioner::SendPetition(void)
{
otError error = OT_ERROR_NONE;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
Ip6::MessageInfo messageInfo;
CommissionerIdTlv commissionerId;
mTransmitAttempts++;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_LEADER_PETITION));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -698,7 +698,7 @@ otError Commissioner::SendPetition(void)
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -775,10 +775,10 @@ void Commissioner::SendKeepAlive(void)
void Commissioner::SendKeepAlive(uint16_t aSessionId)
{
otError error = OT_ERROR_NONE;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
Ip6::MessageInfo messageInfo;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_LEADER_KEEP_ALIVE));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -803,7 +803,7 @@ exit:
{
otLogWarnMeshCoP("Failed to send keep alive: %s", otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -999,7 +999,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Message &aRequest, State
Coap::Message * message;
Mac::ExtAddress joinerId;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -1036,7 +1036,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Message &aRequest, State
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -1057,7 +1057,7 @@ otError Commissioner::SendRelayTransmit(Message &aMessage, const Ip6::MessageInf
uint16_t offset;
Ip6::MessageInfo messageInfo;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
message->Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST);
SuccessOrExit(error = message->AppendUriPathOptions(OT_URI_PATH_RELAY_TX));
@@ -1090,7 +1090,7 @@ otError Commissioner::SendRelayTransmit(Message &aMessage, const Ip6::MessageInf
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
+3 -3
View File
@@ -112,7 +112,7 @@ public:
/**
* This method adds a Joiner entry.
*
* @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.
* @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64 or nullptr for any Joiner.
* @param[in] aPskd A pointer to the PSKd.
* @param[in] aTimeout A time after which a Joiner is automatically removed, in seconds.
*
@@ -138,7 +138,7 @@ public:
/**
* This method removes a Joiner entry.
*
* @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.
* @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64 or nullptr for any Joiner.
* @param[in] aDelay The delay to remove Joiner (in seconds).
* @param[in] aFlags The flags for removing the Joiner.
*
@@ -161,7 +161,7 @@ public:
/**
* This method sets the Provisioning URL.
*
* @param[in] aProvisioningUrl A pointer to the Provisioning URL (may be NULL to set URL to empty string).
* @param[in] aProvisioningUrl A pointer to the Provisioning URL (may be nullptr to set URL to empty string).
*
* @retval OT_ERROR_NONE Successfully set the Provisioning URL.
* @retval OT_ERROR_INVALID_ARGS @p aProvisioningUrl is invalid (too long).
+6 -6
View File
@@ -287,18 +287,18 @@ otError Dataset::SetFrom(const otOperationalDataset &aDataset)
const Timestamp *Dataset::GetTimestamp(void) const
{
const Timestamp *timestamp = NULL;
const Timestamp *timestamp = nullptr;
if (mType == kActive)
{
const ActiveTimestampTlv *tlv = GetTlv<ActiveTimestampTlv>();
VerifyOrExit(tlv != NULL, OT_NOOP);
VerifyOrExit(tlv != nullptr, OT_NOOP);
timestamp = static_cast<const Timestamp *>(tlv);
}
else
{
const PendingTimestampTlv *tlv = GetTlv<PendingTimestampTlv>();
VerifyOrExit(tlv != NULL, OT_NOOP);
VerifyOrExit(tlv != nullptr, OT_NOOP);
timestamp = static_cast<const Timestamp *>(tlv);
}
@@ -319,14 +319,14 @@ otError Dataset::SetTlv(Tlv::Type aType, const void *aValue, uint8_t aLength)
Tlv * old = GetTlv(aType);
Tlv tlv;
if (old != NULL)
if (old != nullptr)
{
bytesAvailable += sizeof(Tlv) + old->GetLength();
}
VerifyOrExit(sizeof(Tlv) + aLength <= bytesAvailable, error = OT_ERROR_NO_BUFS);
if (old != NULL)
if (old != nullptr)
{
RemoveTlv(old);
}
@@ -381,7 +381,7 @@ void Dataset::RemoveTlv(Tlv::Type aType)
{
Tlv *tlv;
VerifyOrExit((tlv = GetTlv(aType)) != NULL, OT_NOOP);
VerifyOrExit((tlv = GetTlv(aType)) != nullptr, OT_NOOP);
RemoveTlv(tlv);
exit:
+5 -5
View File
@@ -100,7 +100,7 @@ public:
*
* @param[in] aType A TLV type.
*
* @returns A pointer to the TLV or NULL if none is found.
* @returns A pointer to the TLV or nullptr if none is found.
*
*/
Tlv *GetTlv(Tlv::Type aType) { return const_cast<Tlv *>(const_cast<const Dataset *>(this)->GetTlv(aType)); }
@@ -110,7 +110,7 @@ public:
*
* @param[in] aType The TLV type.
*
* @returns A pointer to the TLV or NULL if none is found.
* @returns A pointer to the TLV or nullptr if none is found.
*
*/
const Tlv *GetTlv(Tlv::Type aType) const;
@@ -118,7 +118,7 @@ public:
/**
* This template method returns a pointer to the TLV with a given template type `TlvType`
*
* @returns A pointer to the TLV or NULL if none is found.
* @returns A pointer to the TLV or nullptr if none is found.
*
*/
template <typename TlvType> TlvType *GetTlv(void)
@@ -129,7 +129,7 @@ public:
/**
* This template method returns a pointer to the TLV with a given template type `TlvType`
*
* @returns A pointer to the TLV or NULL if none is found.
* @returns A pointer to the TLV or nullptr if none is found.
*
*/
template <typename TlvType> const TlvType *GetTlv(void) const
@@ -329,7 +329,7 @@ public:
* @retval OT_ERROR_PARSE The dataset has at least one TLV with invalid format.
*
*/
otError ApplyConfiguration(Instance &aInstance, bool *aIsMasterKeyUpdated = NULL) const;
otError ApplyConfiguration(Instance &aInstance, bool *aIsMasterKeyUpdated = nullptr) const;
/**
* This method converts a Pending Dataset to an Active Dataset.
+4 -4
View File
@@ -79,7 +79,7 @@ otError DatasetLocal::Restore(Dataset &aDataset)
mSaved = true;
timestamp = aDataset.GetTimestamp();
if (timestamp != NULL)
if (timestamp != nullptr)
{
mTimestamp = *timestamp;
mTimestampPresent = true;
@@ -196,7 +196,7 @@ otError DatasetLocal::Save(const Dataset &aDataset)
timestamp = aDataset.GetTimestamp();
if (timestamp != NULL)
if (timestamp != nullptr)
{
mTimestamp = *timestamp;
mTimestampPresent = true;
@@ -214,8 +214,8 @@ exit:
int DatasetLocal::Compare(const Timestamp *aCompare)
{
return (aCompare == NULL) ? (!mTimestampPresent ? 0 : -1)
: (!mTimestampPresent ? 1 : mTimestamp.Compare(*aCompare));
return (aCompare == nullptr) ? (!mTimestampPresent ? 0 : -1)
: (!mTimestampPresent ? 1 : mTimestamp.Compare(*aCompare));
}
} // namespace MeshCoP
+18 -18
View File
@@ -67,7 +67,7 @@ DatasetManager::DatasetManager(Instance & aInstance,
const Timestamp *DatasetManager::GetTimestamp(void) const
{
return mTimestampValid ? &mTimestamp : NULL;
return mTimestampValid ? &mTimestamp : nullptr;
}
int DatasetManager::Compare(const Timestamp &aTimestamp) const
@@ -97,7 +97,7 @@ otError DatasetManager::Restore(void)
timestamp = dataset.GetTimestamp();
if (timestamp != NULL)
if (timestamp != nullptr)
{
mTimestamp = *timestamp;
mTimestampValid = true;
@@ -146,7 +146,7 @@ otError DatasetManager::Save(const Dataset &aDataset)
timestamp = aDataset.GetTimestamp();
if (timestamp != NULL)
if (timestamp != nullptr)
{
mTimestamp = *timestamp;
mTimestampValid = true;
@@ -235,7 +235,7 @@ otError DatasetManager::GetChannelMask(Mac::ChannelMask &aChannelMask) const
SuccessOrExit(error = mLocal.Read(dataset));
channelMaskTlv = dataset.GetTlv<ChannelMaskTlv>();
VerifyOrExit(channelMaskTlv != NULL, error = OT_ERROR_NOT_FOUND);
VerifyOrExit(channelMaskTlv != nullptr, error = OT_ERROR_NOT_FOUND);
VerifyOrExit((mask = channelMaskTlv->GetChannelMask()) != 0, OT_NOOP);
aChannelMask.SetMask(mask & Get<Mac::Mac>().GetSupportedChannelMask().GetMask());
@@ -254,7 +254,7 @@ void DatasetManager::HandleTimer(void)
void DatasetManager::SendSet(void)
{
otError error;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
Ip6::MessageInfo messageInfo;
Dataset dataset(mLocal.GetType());
@@ -270,14 +270,14 @@ void DatasetManager::SendSet(void)
const ActiveTimestampTlv *tlv = pendingDataset.GetTlv<ActiveTimestampTlv>();
const Timestamp * pendingActiveTimestamp = static_cast<const Timestamp *>(tlv);
if (pendingActiveTimestamp != NULL && mLocal.Compare(pendingActiveTimestamp) == 0)
if (pendingActiveTimestamp != nullptr && mLocal.Compare(pendingActiveTimestamp) == 0)
{
// stop registration attempts during dataset transition
ExitNow(error = OT_ERROR_INVALID_STATE);
}
}
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, mUriSet));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -308,7 +308,7 @@ exit:
default:
otLogWarnMeshCoP("Failed to send %s to leader: %s", mUriSet, otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -391,7 +391,7 @@ void DatasetManager::SendGetResponse(const Coap::Message & aRequest,
IgnoreError(mLocal.Read(dataset));
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -417,7 +417,7 @@ void DatasetManager::SendGetResponse(const Coap::Message & aRequest,
continue;
}
if ((tlv = dataset.GetTlv(static_cast<Tlv::Type>(aTlvs[index]))) != NULL)
if ((tlv = dataset.GetTlv(static_cast<Tlv::Type>(aTlvs[index]))) != nullptr)
{
SuccessOrExit(error = tlv->AppendTo(*message));
}
@@ -436,7 +436,7 @@ void DatasetManager::SendGetResponse(const Coap::Message & aRequest,
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -448,7 +448,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
Coap::Message * message;
Ip6::MessageInfo messageInfo;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, mUriSet));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -584,7 +584,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -666,7 +666,7 @@ otError DatasetManager::SendGetRequest(const otOperationalDatasetComponents &aDa
datasetTlvs[length++] = Tlv::kChannelMask;
}
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, mUriGet));
@@ -692,7 +692,7 @@ otError DatasetManager::SendGetRequest(const otOperationalDatasetComponents &aDa
}
}
if (aAddress != NULL)
if (aAddress != nullptr)
{
messageInfo.SetPeerAddr(*static_cast<const Ip6::Address *>(aAddress));
}
@@ -709,7 +709,7 @@ otError DatasetManager::SendGetRequest(const otOperationalDatasetComponents &aDa
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -840,7 +840,7 @@ void PendingDataset::StartDelayTimer(void)
mDelayTimer.Stop();
if ((delayTimer = dataset.GetTlv<DelayTimerTlv>()) != NULL)
if ((delayTimer = dataset.GetTlv<DelayTimerTlv>()) != nullptr)
{
uint32_t delay = delayTimer->GetDelayTimer();
@@ -869,7 +869,7 @@ void PendingDataset::HandleDelayTimer(void)
// if the Delay Timer value is larger than what our Timer implementation can handle, we have to compute
// the remainder and wait some more.
if ((delayTimer = dataset.GetTlv<DelayTimerTlv>()) != NULL)
if ((delayTimer = dataset.GetTlv<DelayTimerTlv>()) != nullptr)
{
uint32_t elapsed = mDelayTimer.GetFireTime() - dataset.GetUpdateTime();
uint32_t delay = delayTimer->GetDelayTimer();
+15 -15
View File
@@ -167,7 +167,7 @@ otError DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInf
// no change to master key, active timestamp must be ahead
const Timestamp *localActiveTimestamp = Get<ActiveDataset>().GetTimestamp();
VerifyOrExit(localActiveTimestamp == NULL || localActiveTimestamp->Compare(activeTimestamp) > 0, OT_NOOP);
VerifyOrExit(localActiveTimestamp == nullptr || localActiveTimestamp->Compare(activeTimestamp) > 0, OT_NOOP);
}
// check commissioner session id
@@ -180,7 +180,7 @@ otError DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInf
localId = static_cast<const CommissionerSessionIdTlv *>(
Get<NetworkData::Leader>().GetCommissioningDataSubTlv(Tlv::kCommissionerSessionId));
VerifyOrExit(localId != NULL && localId->GetCommissionerSessionId() == sessionId, OT_NOOP);
VerifyOrExit(localId != nullptr && localId->GetCommissionerSessionId() == sessionId, OT_NOOP);
}
// verify an MGMT_ACTIVE_SET.req from a Commissioner does not affect connectivity
@@ -251,7 +251,7 @@ otError DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInf
localSessionId = static_cast<const CommissionerSessionIdTlv *>(
Get<NetworkData::Leader>().GetCommissioningDataSubTlv(Tlv::kCommissionerSessionId));
VerifyOrExit(localSessionId != NULL, OT_NOOP);
VerifyOrExit(localSessionId != nullptr, OT_NOOP);
SuccessOrExit(
Get<Mle::MleRouter>().GetCommissionerAloc(destination, localSessionId->GetCommissionerSessionId()));
@@ -276,7 +276,7 @@ void DatasetManager::SendSetResponse(const Coap::Message & aRequest,
otError error = OT_ERROR_NONE;
Coap::Message *message;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -289,7 +289,7 @@ void DatasetManager::SendSetResponse(const Coap::Message & aRequest,
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -370,7 +370,7 @@ otError ActiveDataset::GenerateLocal(void)
IgnoreError(mLocal.Read(dataset));
if (dataset.GetTlv<ActiveTimestampTlv>() == NULL)
if (dataset.GetTlv<ActiveTimestampTlv>() == nullptr)
{
ActiveTimestampTlv activeTimestampTlv;
activeTimestampTlv.Init();
@@ -379,7 +379,7 @@ otError ActiveDataset::GenerateLocal(void)
IgnoreError(dataset.SetTlv(activeTimestampTlv));
}
if (dataset.GetTlv<ChannelTlv>() == NULL)
if (dataset.GetTlv<ChannelTlv>() == nullptr)
{
ChannelTlv tlv;
tlv.Init();
@@ -387,7 +387,7 @@ otError ActiveDataset::GenerateLocal(void)
IgnoreError(dataset.SetTlv(tlv));
}
if (dataset.GetTlv<ChannelMaskTlv>() == NULL)
if (dataset.GetTlv<ChannelMaskTlv>() == nullptr)
{
ChannelMaskTlv tlv;
tlv.Init();
@@ -395,36 +395,36 @@ otError ActiveDataset::GenerateLocal(void)
IgnoreError(dataset.SetTlv(tlv));
}
if (dataset.GetTlv<ExtendedPanIdTlv>() == NULL)
if (dataset.GetTlv<ExtendedPanIdTlv>() == nullptr)
{
IgnoreError(
dataset.SetTlv(Tlv::kExtendedPanId, &Get<Mac::Mac>().GetExtendedPanId(), sizeof(Mac::ExtendedPanId)));
}
if (dataset.GetTlv<MeshLocalPrefixTlv>() == NULL)
if (dataset.GetTlv<MeshLocalPrefixTlv>() == nullptr)
{
IgnoreError(dataset.SetTlv(Tlv::kMeshLocalPrefix, &Get<Mle::MleRouter>().GetMeshLocalPrefix(),
sizeof(Mle::MeshLocalPrefix)));
}
if (dataset.GetTlv<NetworkMasterKeyTlv>() == NULL)
if (dataset.GetTlv<NetworkMasterKeyTlv>() == nullptr)
{
IgnoreError(dataset.SetTlv(Tlv::kNetworkMasterKey, &Get<KeyManager>().GetMasterKey(), sizeof(MasterKey)));
}
if (dataset.GetTlv<NetworkNameTlv>() == NULL)
if (dataset.GetTlv<NetworkNameTlv>() == nullptr)
{
Mac::NameData nameData = Get<Mac::Mac>().GetNetworkName().GetAsData();
IgnoreError(dataset.SetTlv(Tlv::kNetworkName, nameData.GetBuffer(), nameData.GetLength()));
}
if (dataset.GetTlv<PanIdTlv>() == NULL)
if (dataset.GetTlv<PanIdTlv>() == nullptr)
{
IgnoreError(dataset.SetUint16Tlv(Tlv::kPanId, Get<Mac::Mac>().GetPanId()));
}
if (dataset.GetTlv<PskcTlv>() == NULL)
if (dataset.GetTlv<PskcTlv>() == nullptr)
{
if (Get<KeyManager>().IsPskcSet())
{
@@ -440,7 +440,7 @@ otError ActiveDataset::GenerateLocal(void)
}
}
if (dataset.GetTlv<SecurityPolicyTlv>() == NULL)
if (dataset.GetTlv<SecurityPolicyTlv>() == nullptr)
{
SecurityPolicyTlv tlv;
tlv.Init();
+34 -34
View File
@@ -65,31 +65,31 @@ Dtls::Dtls(Instance &aInstance, bool aLayerTwoSecurity)
, mTimerIntermediate(0)
, mTimerSet(false)
, mLayerTwoSecurity(aLayerTwoSecurity)
, mReceiveMessage(NULL)
, mConnectedHandler(NULL)
, mReceiveHandler(NULL)
, mSendHandler(NULL)
, mContext(NULL)
, mReceiveMessage(nullptr)
, mConnectedHandler(nullptr)
, mReceiveHandler(nullptr)
, mSendHandler(nullptr)
, mContext(nullptr)
, mSocket(Get<Ip6::Udp>())
, mTransportCallback(NULL)
, mTransportContext(NULL)
, mTransportCallback(nullptr)
, mTransportContext(nullptr)
, mMessageSubType(Message::kSubTypeNone)
, mMessageDefaultSubType(Message::kSubTypeNone)
{
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
#ifdef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
mPreSharedKey = NULL;
mPreSharedKeyIdentity = NULL;
mPreSharedKey = nullptr;
mPreSharedKeyIdentity = nullptr;
mPreSharedKeyIdLength = 0;
mPreSharedKeyLength = 0;
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
mCaChainSrc = NULL;
mCaChainSrc = nullptr;
mCaChainLength = 0;
mOwnCertSrc = NULL;
mOwnCertSrc = nullptr;
mOwnCertLength = 0;
mPrivateKeySrc = NULL;
mPrivateKeySrc = nullptr;
mPrivateKeyLength = 0;
memset(&mCaChain, 0, sizeof(mCaChain));
memset(&mOwnCert, 0, sizeof(mOwnCert));
@@ -218,7 +218,7 @@ otError Dtls::Bind(uint16_t aPort)
Ip6::SockAddr sockaddr;
VerifyOrExit(mState == kStateOpen, error = OT_ERROR_INVALID_STATE);
VerifyOrExit(mTransportCallback == NULL, error = OT_ERROR_ALREADY);
VerifyOrExit(mTransportCallback == nullptr, error = OT_ERROR_ALREADY);
sockaddr.mPort = aPort;
SuccessOrExit(error = mSocket.Bind(sockaddr));
@@ -233,7 +233,7 @@ otError Dtls::Bind(TransportCallback aCallback, void *aContext)
VerifyOrExit(mState == kStateOpen, error = OT_ERROR_INVALID_STATE);
VerifyOrExit(!mSocket.IsBound(), error = OT_ERROR_ALREADY);
VerifyOrExit(mTransportCallback == NULL, error = OT_ERROR_ALREADY);
VerifyOrExit(mTransportCallback == nullptr, error = OT_ERROR_ALREADY);
mTransportCallback = aCallback;
mTransportContext = aContext;
@@ -304,7 +304,7 @@ otError Dtls::Setup(bool aClient)
rval = mbedtls_ssl_setup(&mSsl, &mConf);
VerifyOrExit(rval == 0, OT_NOOP);
mbedtls_ssl_set_bio(&mSsl, this, &Dtls::HandleMbedtlsTransmit, HandleMbedtlsReceive, NULL);
mbedtls_ssl_set_bio(&mSsl, this, &Dtls::HandleMbedtlsTransmit, HandleMbedtlsReceive, nullptr);
mbedtls_ssl_set_timer_cb(&mSsl, this, &Dtls::HandleMbedtlsSetTimer, HandleMbedtlsGetTimer);
if (mCipherSuites[0] == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8)
@@ -319,7 +319,7 @@ otError Dtls::Setup(bool aClient)
#endif // OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
VerifyOrExit(rval == 0, OT_NOOP);
mReceiveMessage = NULL;
mReceiveMessage = nullptr;
mMessageSubType = Message::kSubTypeNone;
mState = kStateConnecting;
@@ -357,21 +357,21 @@ int Dtls::SetApplicationCoapSecureKeys(void)
{
case MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8:
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
if (mCaChainSrc != NULL)
if (mCaChainSrc != nullptr)
{
rval = mbedtls_x509_crt_parse(&mCaChain, static_cast<const unsigned char *>(mCaChainSrc),
static_cast<size_t>(mCaChainLength));
VerifyOrExit(rval == 0, OT_NOOP);
mbedtls_ssl_conf_ca_chain(&mConf, &mCaChain, NULL);
mbedtls_ssl_conf_ca_chain(&mConf, &mCaChain, nullptr);
}
if (mOwnCertSrc != NULL && mPrivateKeySrc != NULL)
if (mOwnCertSrc != nullptr && mPrivateKeySrc != nullptr)
{
rval = mbedtls_x509_crt_parse(&mOwnCert, static_cast<const unsigned char *>(mOwnCertSrc),
static_cast<size_t>(mOwnCertLength));
VerifyOrExit(rval == 0, OT_NOOP);
rval = mbedtls_pk_parse_key(&mPrivateKey, static_cast<const unsigned char *>(mPrivateKeySrc),
static_cast<size_t>(mPrivateKeyLength), NULL, 0);
static_cast<size_t>(mPrivateKeyLength), nullptr, 0);
VerifyOrExit(rval == 0, OT_NOOP);
rval = mbedtls_ssl_conf_own_cert(&mConf, &mOwnCert, &mPrivateKey);
VerifyOrExit(rval == 0, OT_NOOP);
@@ -410,8 +410,8 @@ void Dtls::Close(void)
Disconnect();
mState = kStateClosed;
mTransportCallback = NULL;
mTransportContext = NULL;
mTransportCallback = nullptr;
mTransportContext = nullptr;
mTimerSet = false;
IgnoreError(mSocket.Close());
@@ -459,10 +459,10 @@ void Dtls::SetCertificate(const uint8_t *aX509Certificate,
uint32_t aPrivateKeyLength)
{
OT_ASSERT(aX509CertLength > 0);
OT_ASSERT(aX509Certificate != NULL);
OT_ASSERT(aX509Certificate != nullptr);
OT_ASSERT(aPrivateKeyLength > 0);
OT_ASSERT(aPrivateKey != NULL);
OT_ASSERT(aPrivateKey != nullptr);
mOwnCertSrc = aX509Certificate;
mOwnCertLength = aX509CertLength;
@@ -476,7 +476,7 @@ void Dtls::SetCertificate(const uint8_t *aX509Certificate,
void Dtls::SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength)
{
OT_ASSERT(aX509CaCertChainLength > 0);
OT_ASSERT(aX509CaCertificateChain != NULL);
OT_ASSERT(aX509CaCertificateChain != nullptr);
mCaChainSrc = aX509CaCertificateChain;
mCaChainLength = aX509CaCertChainLength;
@@ -488,8 +488,8 @@ void Dtls::SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_
void Dtls::SetPreSharedKey(const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, uint16_t aPskIdLength)
{
OT_ASSERT(aPsk != NULL);
OT_ASSERT(aPskIdentity != NULL);
OT_ASSERT(aPsk != nullptr);
OT_ASSERT(aPskIdentity != nullptr);
OT_ASSERT(aPskLength > 0);
OT_ASSERT(aPskIdLength > 0);
@@ -559,7 +559,7 @@ void Dtls::Receive(Message &aMessage)
Process();
mReceiveMessage = NULL;
mReceiveMessage = nullptr;
}
int Dtls::HandleMbedtlsTransmit(void *aContext, const unsigned char *aBuf, size_t aLength)
@@ -627,7 +627,7 @@ int Dtls::HandleMbedtlsReceive(unsigned char *aBuf, size_t aLength)
}
#endif // OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
VerifyOrExit(mReceiveMessage != NULL && (rval = mReceiveMessage->GetLength() - mReceiveMessage->GetOffset()) > 0,
VerifyOrExit(mReceiveMessage != nullptr && (rval = mReceiveMessage->GetLength() - mReceiveMessage->GetOffset()) > 0,
rval = MBEDTLS_ERR_SSL_WANT_READ);
if (aLength > static_cast<size_t>(rval))
@@ -772,7 +772,7 @@ void Dtls::HandleTimer(void)
mState = kStateOpen;
mTimer.Stop();
if (mConnectedHandler != NULL)
if (mConnectedHandler != nullptr)
{
mConnectedHandler(mContext, false);
}
@@ -800,7 +800,7 @@ void Dtls::Process(void)
{
mState = kStateConnected;
if (mConnectedHandler != NULL)
if (mConnectedHandler != nullptr)
{
mConnectedHandler(mContext, true);
}
@@ -905,9 +905,9 @@ void Dtls::HandleMbedtlsDebug(void *ctx, int level, const char *, int, const cha
otError Dtls::HandleDtlsSend(const uint8_t *aBuf, uint16_t aLength, Message::SubType aMessageSubType)
{
otError error = OT_ERROR_NONE;
ot::Message *message = NULL;
ot::Message *message = nullptr;
VerifyOrExit((message = mSocket.NewMessage(0)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = mSocket.NewMessage(0)) != nullptr, error = OT_ERROR_NO_BUFS);
message->SetSubType(aMessageSubType);
message->SetLinkSecurityEnabled(mLayerTwoSecurity);
@@ -930,7 +930,7 @@ otError Dtls::HandleDtlsSend(const uint8_t *aBuf, uint16_t aLength, Message::Sub
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
+6 -6
View File
@@ -51,8 +51,8 @@ namespace ot {
EnergyScanClient::EnergyScanClient(Instance &aInstance)
: InstanceLocator(aInstance)
, mCallback(NULL)
, mContext(NULL)
, mCallback(nullptr)
, mContext(nullptr)
, mEnergyScan(OT_URI_PATH_ENERGY_REPORT, &EnergyScanClient::HandleReport, this)
{
Get<Coap::Coap>().AddResource(mEnergyScan);
@@ -69,10 +69,10 @@ otError EnergyScanClient::SendQuery(uint32_t aChannelM
otError error = OT_ERROR_NONE;
MeshCoP::ChannelMaskTlv channelMask;
Ip6::MessageInfo messageInfo;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
VerifyOrExit(Get<MeshCoP::Commissioner>().IsActive(), error = OT_ERROR_INVALID_STATE);
VerifyOrExit((message = MeshCoP::NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = MeshCoP::NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error =
message->Init(aAddress.IsMulticast() ? OT_COAP_TYPE_NON_CONFIRMABLE : OT_COAP_TYPE_CONFIRMABLE,
@@ -102,7 +102,7 @@ otError EnergyScanClient::SendQuery(uint32_t aChannelM
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -136,7 +136,7 @@ void EnergyScanClient::HandleReport(Coap::Message &aMessage, const Ip6::MessageI
SuccessOrExit(MeshCoP::Tlv::FindTlv(aMessage, MeshCoP::Tlv::kEnergyList, sizeof(energyList), energyList.tlv));
VerifyOrExit(energyList.tlv.IsValid(), OT_NOOP);
if (mCallback != NULL)
if (mCallback != nullptr)
{
mCallback(mask, energyList.list, energyList.tlv.GetLength(), mContext);
}
+15 -15
View File
@@ -58,10 +58,10 @@ namespace MeshCoP {
Joiner::Joiner(Instance &aInstance)
: InstanceLocator(aInstance)
, mState(OT_JOINER_STATE_IDLE)
, mCallback(NULL)
, mContext(NULL)
, mCallback(nullptr)
, mContext(nullptr)
, mJoinerRouterIndex(0)
, mFinalizeMessage(NULL)
, mFinalizeMessage(nullptr)
, mTimer(aInstance, Joiner::HandleTimer, this)
, mJoinerEntrust(OT_URI_PATH_JOINER_ENTRUST, &Joiner::HandleJoinerEntrust, this)
{
@@ -124,7 +124,7 @@ otError Joiner::Start(const char * aPskd,
SuccessOrExit(error = Get<Mle::DiscoverScanner>().Discover(Mac::ChannelMask(0), Get<Mac::Mac>().GetPanId(),
/* aJoiner */ true, /* aEnableFiltering */ true,
/* aFilterIndexes (use hash of factory EUI64) */ NULL,
/* aFilterIndexes (use hash of factory EUI64) */ nullptr,
HandleDiscoverResult, this));
mCallback = aCallback;
mContext = aContext;
@@ -145,8 +145,8 @@ void Joiner::Stop(void)
{
otLogInfoMeshCoP("Joiner stopped");
// Callback is set to `NULL` to skip calling it from `Finish()`
mCallback = NULL;
// Callback is set to `nullptr` to skip calling it from `Finish()`
mCallback = nullptr;
Finish(OT_ERROR_ABORT);
}
@@ -230,7 +230,7 @@ void Joiner::HandleDiscoverResult(otActiveScanResult *aResult)
VerifyOrExit(mState == OT_JOINER_STATE_DISCOVER, OT_NOOP);
if (aResult != NULL)
if (aResult != nullptr)
{
SaveDiscoveredJoinerRouter(*aResult);
}
@@ -396,7 +396,7 @@ otError Joiner::PrepareJoinerFinalizeMessage(const char *aProvisioningUrl,
VendorStackVersionTlv vendorStackVersionTlv;
ProvisioningUrlTlv provisioningUrlTlv;
VerifyOrExit((mFinalizeMessage = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((mFinalizeMessage = NewMeshCoPMessage(Get<Coap::CoapSecure>())) != nullptr, error = OT_ERROR_NO_BUFS);
mFinalizeMessage->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
SuccessOrExit(error = mFinalizeMessage->AppendUriPathOptions(OT_URI_PATH_JOINER_FINALIZE));
@@ -424,7 +424,7 @@ otError Joiner::PrepareJoinerFinalizeMessage(const char *aProvisioningUrl,
vendorStackVersionTlv.SetRevision(OPENTHREAD_CONFIG_STACK_VERSION_REV);
SuccessOrExit(error = vendorStackVersionTlv.AppendTo(*mFinalizeMessage));
if (aVendorData != NULL)
if (aVendorData != nullptr)
{
VendorDataTlv vendorDataTlv;
vendorDataTlv.Init();
@@ -451,10 +451,10 @@ exit:
void Joiner::FreeJoinerFinalizeMessage(void)
{
VerifyOrExit(mState == OT_JOINER_STATE_IDLE && mFinalizeMessage != NULL, OT_NOOP);
VerifyOrExit(mState == OT_JOINER_STATE_IDLE && mFinalizeMessage != nullptr, OT_NOOP);
mFinalizeMessage->Free();
mFinalizeMessage = NULL;
mFinalizeMessage = nullptr;
exit:
return;
@@ -462,14 +462,14 @@ exit:
void Joiner::SendJoinerFinalize(void)
{
OT_ASSERT(mFinalizeMessage != NULL);
OT_ASSERT(mFinalizeMessage != nullptr);
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
LogCertMessage("[THCI] direction=send | type=JOIN_FIN.req |", *mFinalizeMessage);
#endif
SuccessOrExit(Get<Coap::CoapSecure>().SendMessage(*mFinalizeMessage, Joiner::HandleJoinerFinalizeResponse, this));
mFinalizeMessage = NULL;
mFinalizeMessage = nullptr;
otLogInfoMeshCoP("Joiner sent finalize");
@@ -566,7 +566,7 @@ void Joiner::SendJoinerEntrustResponse(const Coap::Message &aRequest, const Ip6:
Coap::Message * message;
Ip6::MessageInfo responseInfo(aRequestInfo);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
message->SetSubType(Message::kSubTypeJoinerEntrust);
@@ -580,7 +580,7 @@ void Joiner::SendJoinerEntrustResponse(const Coap::Message &aRequest, const Ip6:
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
+5 -5
View File
@@ -67,11 +67,11 @@ public:
* This method starts the Joiner service.
*
* @param[in] aPskd A pointer to the PSKd.
* @param[in] aProvisioningUrl A pointer to the Provisioning URL (may be NULL).
* @param[in] aVendorName A pointer to the Vendor Name (may be NULL).
* @param[in] aVendorModel A pointer to the Vendor Model (may be NULL).
* @param[in] aVendorSwVersion A pointer to the Vendor SW Version (may be NULL).
* @param[in] aVendorData A pointer to the Vendor Data (may be NULL).
* @param[in] aProvisioningUrl A pointer to the Provisioning URL (may be nullptr).
* @param[in] aVendorName A pointer to the Vendor Name (may be nullptr).
* @param[in] aVendorModel A pointer to the Vendor Model (may be nullptr).
* @param[in] aVendorSwVersion A pointer to the Vendor SW Version (may be nullptr).
* @param[in] aVendorData A pointer to the Vendor Data (may be nullptr).
* @param[in] aCallback A pointer to a function that is called when the join operation completes.
* @param[in] aContext A pointer to application-specific context.
*
+21 -21
View File
@@ -118,7 +118,7 @@ uint16_t JoinerRouter::GetJoinerUdpPort(void)
joinerUdpPort = static_cast<const JoinerUdpPortTlv *>(
Get<NetworkData::Leader>().GetCommissioningDataSubTlv(Tlv::kJoinerUdpPort));
VerifyOrExit(joinerUdpPort != NULL, OT_NOOP);
VerifyOrExit(joinerUdpPort != nullptr, OT_NOOP);
rval = joinerUdpPort->GetUdpPort();
@@ -142,7 +142,7 @@ void JoinerRouter::HandleUdpReceive(void *aContext, otMessage *aMessage, const o
void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
Ip6::MessageInfo messageInfo;
ExtendedTlv tlv;
uint16_t borderAgentRloc;
@@ -152,7 +152,7 @@ void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &a
SuccessOrExit(error = GetBorderAgentRloc(Get<ThreadNetif>(), borderAgentRloc));
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_RELAY_RX));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -180,7 +180,7 @@ void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &a
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -202,7 +202,7 @@ void JoinerRouter::HandleRelayTransmit(Coap::Message &aMessage, const Ip6::Messa
Kek kek;
uint16_t offset;
uint16_t length;
Message * message = NULL;
Message * message = nullptr;
Message::Settings settings(Message::kNoLinkSecurity, Message::kPriorityNet);
Ip6::MessageInfo messageInfo;
@@ -215,7 +215,7 @@ void JoinerRouter::HandleRelayTransmit(Coap::Message &aMessage, const Ip6::Messa
SuccessOrExit(error = Tlv::FindTlvValueOffset(aMessage, Tlv::kJoinerDtlsEncapsulation, offset, length));
VerifyOrExit((message = mSocket.NewMessage(0, settings)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = mSocket.NewMessage(0, settings)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetLength(length));
aMessage.CopyTo(offset, 0, length, *message);
@@ -233,7 +233,7 @@ void JoinerRouter::HandleRelayTransmit(Coap::Message &aMessage, const Ip6::Messa
}
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -245,7 +245,7 @@ void JoinerRouter::DelaySendingJoinerEntrust(const Ip6::MessageInfo &aMessageInf
Message * message = Get<MessagePool>().New(Message::kTypeOther, 0);
JoinerEntrustMetadata metadata;
VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
metadata.mMessageInfo = aMessageInfo;
metadata.mMessageInfo.SetPeerPort(kCoapUdpPort);
@@ -267,7 +267,7 @@ exit:
{
otLogNoteMeshCoP("Failed to schedule joiner entrust: %s", otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -289,7 +289,7 @@ void JoinerRouter::SendDelayedJoinerEntrust(void)
JoinerEntrustMetadata metadata;
Message * message = mDelayedJoinEnts.GetHead();
VerifyOrExit(message != NULL, OT_NOOP);
VerifyOrExit(message != nullptr, OT_NOOP);
VerifyOrExit(!mTimer.IsRunning(), OT_NOOP);
metadata.ReadFrom(*message);
@@ -327,7 +327,7 @@ otError JoinerRouter::SendJoinerEntrust(const Ip6::MessageInfo &aMessageInfo)
Coap::Message *message;
message = PrepareJoinerEntrustMessage();
VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
IgnoreError(Get<Coap::Coap>().AbortTransaction(&JoinerRouter::HandleJoinerEntrustResponse, this));
@@ -341,7 +341,7 @@ otError JoinerRouter::SendJoinerEntrust(const Ip6::MessageInfo &aMessageInfo)
mExpectJoinEntRsp = true;
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -352,13 +352,13 @@ exit:
Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void)
{
otError error;
Coap::Message *message = NULL;
Coap::Message *message = nullptr;
Dataset dataset(Dataset::kActive);
NetworkNameTlv networkName;
const Tlv * tlv;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
SuccessOrExit(error = message->AppendUriPathOptions(OT_URI_PATH_JOINER_ENTRUST));
@@ -380,7 +380,7 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void)
IgnoreError(Get<ActiveDataset>().Read(dataset));
if ((tlv = dataset.GetTlv<ActiveTimestampTlv>()) != NULL)
if ((tlv = dataset.GetTlv<ActiveTimestampTlv>()) != nullptr)
{
SuccessOrExit(error = tlv->AppendTo(*message));
}
@@ -391,7 +391,7 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void)
SuccessOrExit(error = activeTimestamp.AppendTo(*message));
}
if ((tlv = dataset.GetTlv<ChannelMaskTlv>()) != NULL)
if ((tlv = dataset.GetTlv<ChannelMaskTlv>()) != nullptr)
{
SuccessOrExit(error = tlv->AppendTo(*message));
}
@@ -402,7 +402,7 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void)
SuccessOrExit(error = channelMask.AppendTo(*message));
}
if ((tlv = dataset.GetTlv<PskcTlv>()) != NULL)
if ((tlv = dataset.GetTlv<PskcTlv>()) != nullptr)
{
SuccessOrExit(error = tlv->AppendTo(*message));
}
@@ -413,7 +413,7 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void)
SuccessOrExit(error = pskc.AppendTo(*message));
}
if ((tlv = dataset.GetTlv<SecurityPolicyTlv>()) != NULL)
if ((tlv = dataset.GetTlv<SecurityPolicyTlv>()) != nullptr)
{
SuccessOrExit(error = tlv->AppendTo(*message));
}
@@ -429,10 +429,10 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void)
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
message = NULL;
message = nullptr;
}
return message;
@@ -456,7 +456,7 @@ void JoinerRouter::HandleJoinerEntrustResponse(Coap::Message * aMessage,
mExpectJoinEntRsp = false;
SendDelayedJoinerEntrust();
VerifyOrExit(aResult == OT_ERROR_NONE && aMessage != NULL, OT_NOOP);
VerifyOrExit(aResult == OT_ERROR_NONE && aMessage != nullptr, OT_NOOP);
VerifyOrExit(aMessage->GetCode() == OT_COAP_CODE_CHANGED, OT_NOOP);
+1 -1
View File
@@ -140,7 +140,7 @@ otError GetBorderAgentRloc(ThreadNetif &aNetif, uint16_t &aRloc)
borderAgentLocator = static_cast<const BorderAgentLocatorTlv *>(
aNetif.Get<NetworkData::Leader>().GetCommissioningDataSubTlv(Tlv::kBorderAgentLocator));
VerifyOrExit(borderAgentLocator != NULL, error = OT_ERROR_NOT_FOUND);
VerifyOrExit(borderAgentLocator != nullptr, error = OT_ERROR_NOT_FOUND);
aRloc = borderAgentLocator->GetBorderAgentLocator();
+7 -7
View File
@@ -127,7 +127,7 @@ void Leader::SendPetitionResponse(const Coap::Message & aRequest,
otError error = OT_ERROR_NONE;
Coap::Message *message;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -154,7 +154,7 @@ exit:
{
otLogInfoMeshCoP("Failed to send petition response: %s", otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -183,7 +183,7 @@ void Leader::HandleKeepAlive(Coap::Message &aMessage, const Ip6::MessageInfo &aM
borderAgentLocator = static_cast<BorderAgentLocatorTlv *>(
Get<NetworkData::Leader>().GetCommissioningDataSubTlv(Tlv::kBorderAgentLocator));
if ((borderAgentLocator == NULL) || (sessionId != mSessionId))
if ((borderAgentLocator == nullptr) || (sessionId != mSessionId))
{
responseState = StateTlv::kReject;
}
@@ -219,7 +219,7 @@ void Leader::SendKeepAliveResponse(const Coap::Message & aRequest,
otError error = OT_ERROR_NONE;
Coap::Message *message;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetDefaultResponseHeader(aRequest));
SuccessOrExit(error = message->SetPayloadMarker());
@@ -236,7 +236,7 @@ exit:
{
otLogWarnMeshCoP("Failed to send keep alive response: %s", otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
@@ -249,7 +249,7 @@ void Leader::SendDatasetChanged(const Ip6::Address &aAddress)
Ip6::MessageInfo messageInfo;
Coap::Message * message;
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST, OT_URI_PATH_DATASET_CHANGED));
@@ -266,7 +266,7 @@ exit:
{
otLogWarnMeshCoP("Failed to send dataset changed: %s", otThreadErrorToString(error));
if (message != NULL)
if (message != nullptr)
{
message->Free();
}
+8 -8
View File
@@ -91,11 +91,11 @@ const Tlv *Tlv::FindTlv(const uint8_t *aTlvsStart, uint16_t aTlvsLength, Type aT
for (tlv = reinterpret_cast<const Tlv *>(aTlvsStart); tlv < end; tlv = tlv->GetNext())
{
VerifyOrExit((tlv + 1) <= end, tlv = NULL);
VerifyOrExit((tlv + 1) <= end, tlv = nullptr);
VerifyOrExit(!tlv->IsExtended() ||
(reinterpret_cast<const ExtendedTlv *>(tlv) + 1 <= reinterpret_cast<const ExtendedTlv *>(end)),
tlv = NULL);
VerifyOrExit(tlv->GetNext() <= end, tlv = NULL);
tlv = nullptr);
VerifyOrExit(tlv->GetNext() <= end, tlv = nullptr);
if (tlv->GetType() == aType)
{
@@ -103,7 +103,7 @@ const Tlv *Tlv::FindTlv(const uint8_t *aTlvsStart, uint16_t aTlvsLength, Type aT
}
}
tlv = NULL;
tlv = nullptr;
exit:
return tlv;
@@ -173,12 +173,12 @@ void ChannelTlv::SetChannel(uint16_t aChannel)
const ChannelMaskEntryBase *ChannelMaskBaseTlv::GetFirstEntry(void) const
{
const ChannelMaskEntryBase *entry = NULL;
const ChannelMaskEntryBase *entry = nullptr;
VerifyOrExit(GetLength() >= sizeof(ChannelMaskEntryBase), OT_NOOP);
entry = reinterpret_cast<const ChannelMaskEntryBase *>(GetValue());
VerifyOrExit(GetLength() >= entry->GetEntrySize(), entry = NULL);
VerifyOrExit(GetLength() >= entry->GetEntrySize(), entry = nullptr);
exit:
return entry;
@@ -199,7 +199,7 @@ void ChannelMaskTlv::SetChannelMask(uint32_t aChannelMask)
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
if (aChannelMask & OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK)
{
OT_ASSERT(entry != NULL);
OT_ASSERT(entry != nullptr);
entry->Init();
entry->SetChannelPage(OT_RADIO_CHANNEL_PAGE_2);
entry->SetMask(aChannelMask & OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK);
@@ -213,7 +213,7 @@ void ChannelMaskTlv::SetChannelMask(uint32_t aChannelMask)
#if OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
if (aChannelMask & OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK)
{
OT_ASSERT(entry != NULL);
OT_ASSERT(entry != nullptr);
entry->Init();
entry->SetChannelPage(OT_RADIO_CHANNEL_PAGE_0);
entry->SetMask(aChannelMask & OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK);
+10 -10
View File
@@ -204,7 +204,7 @@ public:
* @param[in] aTlvsLength The length (number of bytes) in TLV sequence.
* @param[in] aType The TLV Type to search for.
*
* @returns A pointer to the TLV if found, or NULL if not found.
* @returns A pointer to the TLV if found, or nullptr if not found.
*
*/
static Tlv *FindTlv(uint8_t *aTlvsStart, uint16_t aTlvsLength, Type aType)
@@ -219,7 +219,7 @@ public:
* @param[in] aTlvsLength The length (number of bytes) in TLV sequence.
* @param[in] aType The TLV Type to search for.
*
* @returns A pointer to the TLV if found, or NULL if not found.
* @returns A pointer to the TLV if found, or nullptr if not found.
*
*/
static const Tlv *FindTlv(const uint8_t *aTlvsStart, uint16_t aTlvsLength, Type aType);
@@ -231,7 +231,7 @@ public:
* @param[in] aTlvsStart A pointer to the start of the sequence of TLVs to search within.
* @param[in] aTlvsLength The length (number of bytes) in TLV sequence.
*
* @returns A pointer to the TLV if found, or NULL if not found.
* @returns A pointer to the TLV if found, or nullptr if not found.
*
*/
template <typename TlvType> static TlvType *FindTlv(uint8_t *aTlvsStart, uint16_t aTlvsLength)
@@ -246,7 +246,7 @@ public:
* @param[in] aTlvsStart A pointer to the start of the sequence of TLVs to search within.
* @param[in] aTlvsLength The length (number of bytes) in TLV sequence.
*
* @returns A pointer to the TLV if found, or NULL if not found.
* @returns A pointer to the TLV if found, or nullptr if not found.
*
*/
template <typename TlvType> static const TlvType *FindTlv(const uint8_t *aTlvsStart, uint16_t aTlvsLength)
@@ -1477,7 +1477,7 @@ public:
/**
* This method gets the first Channel Mask Entry in the Channel Mask TLV.
*
* @returns A pointer to first Channel Mask Entry or NULL if not found.
* @returns A pointer to first Channel Mask Entry or nullptr if not found.
*
*/
const ChannelMaskEntryBase *GetFirstEntry(void) const;
@@ -1485,7 +1485,7 @@ public:
/**
* This method gets the first Channel Mask Entry in the Channel Mask TLV.
*
* @returns A pointer to first Channel Mask Entry or NULL if not found.
* @returns A pointer to first Channel Mask Entry or nullptr if not found.
*
*/
ChannelMaskEntryBase *GetFirstEntry(void);
@@ -1693,7 +1693,7 @@ public:
*/
void SetVendorName(const char *aVendorName)
{
uint16_t len = (aVendorName == NULL) ? 0 : StringLength(aVendorName, sizeof(mVendorName));
uint16_t len = (aVendorName == nullptr) ? 0 : StringLength(aVendorName, sizeof(mVendorName));
SetLength(static_cast<uint8_t>(len));
@@ -1762,7 +1762,7 @@ public:
*/
void SetVendorModel(const char *aVendorModel)
{
uint16_t len = (aVendorModel == NULL) ? 0 : StringLength(aVendorModel, sizeof(mVendorModel));
uint16_t len = (aVendorModel == nullptr) ? 0 : StringLength(aVendorModel, sizeof(mVendorModel));
SetLength(static_cast<uint8_t>(len));
@@ -1831,7 +1831,7 @@ public:
*/
void SetVendorSwVersion(const char *aVendorSwVersion)
{
uint16_t len = (aVendorSwVersion == NULL) ? 0 : StringLength(aVendorSwVersion, sizeof(mVendorSwVersion));
uint16_t len = (aVendorSwVersion == nullptr) ? 0 : StringLength(aVendorSwVersion, sizeof(mVendorSwVersion));
SetLength(static_cast<uint8_t>(len));
@@ -1900,7 +1900,7 @@ public:
*/
void SetVendorData(const char *aVendorData)
{
uint16_t len = (aVendorData == NULL) ? 0 : StringLength(aVendorData, sizeof(mVendorData));
uint16_t len = (aVendorData == nullptr) ? 0 : StringLength(aVendorData, sizeof(mVendorData));
SetLength(static_cast<uint8_t>(len));
+6 -6
View File
@@ -50,8 +50,8 @@ namespace ot {
PanIdQueryClient::PanIdQueryClient(Instance &aInstance)
: InstanceLocator(aInstance)
, mCallback(NULL)
, mContext(NULL)
, mCallback(nullptr)
, mContext(nullptr)
, mPanIdQuery(OT_URI_PATH_PANID_CONFLICT, &PanIdQueryClient::HandleConflict, this)
{
Get<Coap::Coap>().AddResource(mPanIdQuery);
@@ -66,10 +66,10 @@ otError PanIdQueryClient::SendQuery(uint16_t aPanId,
otError error = OT_ERROR_NONE;
MeshCoP::ChannelMaskTlv channelMask;
Ip6::MessageInfo messageInfo;
Coap::Message * message = NULL;
Coap::Message * message = nullptr;
VerifyOrExit(Get<MeshCoP::Commissioner>().IsActive(), error = OT_ERROR_INVALID_STATE);
VerifyOrExit((message = MeshCoP::NewMeshCoPMessage(Get<Coap::Coap>())) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = MeshCoP::NewMeshCoPMessage(Get<Coap::Coap>())) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error =
message->Init(aAddress.IsMulticast() ? OT_COAP_TYPE_NON_CONFIRMABLE : OT_COAP_TYPE_CONFIRMABLE,
@@ -97,7 +97,7 @@ otError PanIdQueryClient::SendQuery(uint16_t aPanId,
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -125,7 +125,7 @@ void PanIdQueryClient::HandleConflict(Coap::Message &aMessage, const Ip6::Messag
VerifyOrExit((mask = MeshCoP::ChannelMaskTlv::GetChannelMask(aMessage)) != 0, OT_NOOP);
if (mCallback != NULL)
if (mCallback != nullptr)
{
mCallback(panId, mask, mContext);
}
+11 -11
View File
@@ -54,9 +54,9 @@ namespace Dhcp6 {
Dhcp6Client::Dhcp6Client(Instance &aInstance)
: InstanceLocator(aInstance)
, mSocket(Get<Ip6::Udp>())
, mTrickleTimer(aInstance, Dhcp6Client::HandleTrickleTimer, NULL, this)
, mTrickleTimer(aInstance, Dhcp6Client::HandleTrickleTimer, nullptr, this)
, mStartTime(0)
, mIdentityAssociationCurrent(NULL)
, mIdentityAssociationCurrent(nullptr)
{
memset(mIdentityAssociations, 0, sizeof(mIdentityAssociations));
}
@@ -114,7 +114,7 @@ void Dhcp6Client::UpdateAddresses(void)
while (Get<NetworkData::Leader>().GetNextOnMeshPrefix(iterator, config) == OT_ERROR_NONE)
{
IdentityAssociation *ia = NULL;
IdentityAssociation *ia = nullptr;
if (!config.mDhcp)
{
@@ -128,7 +128,7 @@ void Dhcp6Client::UpdateAddresses(void)
if (mIdentityAssociations[i].mStatus == kIaStatusInvalid)
{
// record an available ia
if (ia == NULL)
if (ia == nullptr)
{
ia = &mIdentityAssociations[i];
}
@@ -142,7 +142,7 @@ void Dhcp6Client::UpdateAddresses(void)
if (!found)
{
if (ia != NULL)
if (ia != nullptr)
{
ia->mPrefixAgentRloc = config.mRloc16;
ia->mNetifAddress.mAddress = config.mPrefix.mPrefix;
@@ -189,7 +189,7 @@ bool Dhcp6Client::ProcessNextIdentityAssociation()
bool rval = false;
// not interrupt in-progress solicit
VerifyOrExit(mIdentityAssociationCurrent == NULL || mIdentityAssociationCurrent->mStatus != kIaStatusSoliciting,
VerifyOrExit(mIdentityAssociationCurrent == nullptr || mIdentityAssociationCurrent->mStatus != kIaStatusSoliciting,
OT_NOOP);
mTrickleTimer.Stop();
@@ -227,7 +227,7 @@ bool Dhcp6Client::HandleTrickleTimer(void)
{
bool rval = true;
VerifyOrExit(mIdentityAssociationCurrent != NULL, rval = false);
VerifyOrExit(mIdentityAssociationCurrent != nullptr, rval = false);
switch (mIdentityAssociationCurrent->mStatus)
{
@@ -242,7 +242,7 @@ bool Dhcp6Client::HandleTrickleTimer(void)
break;
case kIaStatusSolicitReplied:
mIdentityAssociationCurrent = NULL;
mIdentityAssociationCurrent = nullptr;
if (!ProcessNextIdentityAssociation())
{
@@ -267,7 +267,7 @@ void Dhcp6Client::Solicit(uint16_t aRloc16)
Message * message;
Ip6::MessageInfo messageInfo;
VerifyOrExit((message = mSocket.NewMessage(0)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = mSocket.NewMessage(0)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = AppendHeader(*message));
SuccessOrExit(error = AppendElapsedTime(*message));
@@ -290,7 +290,7 @@ void Dhcp6Client::Solicit(uint16_t aRloc16)
exit:
if (message != NULL)
if (message != nullptr)
{
otLogWarnIp6("Failed to send DHCPv6 Solicit: %s", otThreadErrorToString(error));
@@ -342,7 +342,7 @@ otError Dhcp6Client::AppendIaNa(Message &aMessage, uint16_t aRloc16)
uint16_t length = 0;
IaNa option;
VerifyOrExit(mIdentityAssociationCurrent != NULL, error = OT_ERROR_DROP);
VerifyOrExit(mIdentityAssociationCurrent != nullptr, error = OT_ERROR_DROP);
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
{
+4 -4
View File
@@ -147,7 +147,7 @@ void Dhcp6Server::Stop(void)
void Dhcp6Server::AddPrefixAgent(const otIp6Prefix &aIp6Prefix, const Lowpan::Context &aContext)
{
otError error = OT_ERROR_NONE;
PrefixAgent *newEntry = NULL;
PrefixAgent *newEntry = nullptr;
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
{
@@ -162,7 +162,7 @@ void Dhcp6Server::AddPrefixAgent(const otIp6Prefix &aIp6Prefix, const Lowpan::Co
}
}
VerifyOrExit(newEntry != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit(newEntry != nullptr, error = OT_ERROR_NO_BUFS);
newEntry->Set(aIp6Prefix, Get<Mle::MleRouter>().GetMeshLocalPrefix(), aContext.mContextId);
Get<ThreadNetif>().AddUnicastAddress(newEntry->GetAloc());
@@ -335,7 +335,7 @@ otError Dhcp6Server::SendReply(otIp6Address &aDst, uint8_t *aTransactionId, Clie
Ip6::MessageInfo messageInfo;
Message * message;
VerifyOrExit((message = mSocket.NewMessage(0)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = mSocket.NewMessage(0)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = AppendHeader(*message, aTransactionId));
SuccessOrExit(error = AppendServerIdentifier(*message));
SuccessOrExit(error = AppendClientIdentifier(*message, aClientId));
@@ -350,7 +350,7 @@ otError Dhcp6Server::SendReply(otIp6Address &aDst, uint8_t *aTransactionId, Clie
exit:
if (message != NULL && error != OT_ERROR_NONE)
if (message != nullptr && error != OT_ERROR_NONE)
{
message->Free();
}
+29 -29
View File
@@ -49,9 +49,9 @@ namespace ot {
namespace Dns {
QueryMetadata::QueryMetadata(void)
: mHostname(NULL)
, mResponseHandler(NULL)
, mResponseContext(NULL)
: mHostname(nullptr)
, mResponseHandler(nullptr)
, mResponseContext(nullptr)
, mTransmissionTime()
, mDestinationPort(0)
, mRetransmissionCount(0)
@@ -61,7 +61,7 @@ QueryMetadata::QueryMetadata(void)
}
QueryMetadata::QueryMetadata(otDnsResponseHandler aHandler, void *aContext)
: mHostname(NULL)
: mHostname(nullptr)
, mResponseHandler(aHandler)
, mResponseContext(aContext)
, mTransmissionTime()
@@ -98,13 +98,13 @@ otError Client::Stop(void)
QueryMetadata queryMetadata;
// Remove all pending queries.
while (message != NULL)
while (message != nullptr)
{
messageToRemove = message;
message = message->GetNext();
queryMetadata.ReadFrom(*messageToRemove);
FinalizeDnsTransaction(*messageToRemove, queryMetadata, NULL, 0, OT_ERROR_ABORT);
FinalizeDnsTransaction(*messageToRemove, queryMetadata, nullptr, 0, OT_ERROR_ABORT);
}
return mSocket.Close();
@@ -114,13 +114,13 @@ otError Client::Query(const otDnsQuery *aQuery, otDnsResponseHandler aHandler, v
{
otError error;
QueryMetadata queryMetadata(aHandler, aContext);
Message * message = NULL;
Message * messageCopy = NULL;
Message * message = nullptr;
Message * messageCopy = nullptr;
Header header;
QuestionAaaa question;
const Ip6::MessageInfo *messageInfo;
VerifyOrExit(aQuery->mHostname != NULL && aQuery->mMessageInfo != NULL, error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(aQuery->mHostname != nullptr && aQuery->mMessageInfo != nullptr, error = OT_ERROR_INVALID_ARGS);
header.SetMessageId(mMessageId++);
header.SetType(Header::kTypeQuery);
@@ -133,7 +133,7 @@ otError Client::Query(const otDnsQuery *aQuery, otDnsResponseHandler aHandler, v
header.SetQuestionCount(1);
VerifyOrExit((message = NewMessage(header)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = NewMessage(header)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = AppendCompressedHostname(*message, aQuery->mHostname));
SuccessOrExit(error = question.AppendTo(*message));
@@ -147,7 +147,7 @@ otError Client::Query(const otDnsQuery *aQuery, otDnsResponseHandler aHandler, v
queryMetadata.mDestinationAddress = messageInfo->GetPeerAddr();
queryMetadata.mRetransmissionCount = 0;
VerifyOrExit((messageCopy = CopyAndEnqueueMessage(*message, queryMetadata)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((messageCopy = CopyAndEnqueueMessage(*message, queryMetadata)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = SendMessage(*message, *messageInfo));
exit:
@@ -170,9 +170,9 @@ exit:
Message *Client::NewMessage(const Header &aHeader)
{
Message *message = NULL;
Message *message = nullptr;
VerifyOrExit((message = mSocket.NewMessage(sizeof(aHeader))) != NULL, OT_NOOP);
VerifyOrExit((message = mSocket.NewMessage(sizeof(aHeader))) != nullptr, OT_NOOP);
IgnoreError(message->Prepend(&aHeader, sizeof(aHeader)));
message->SetOffset(0);
@@ -183,10 +183,10 @@ exit:
Message *Client::CopyAndEnqueueMessage(const Message &aMessage, const QueryMetadata &aQueryMetadata)
{
otError error = OT_ERROR_NONE;
Message *messageCopy = NULL;
Message *messageCopy = nullptr;
// Create a message copy for further retransmissions.
VerifyOrExit((messageCopy = aMessage.Clone()) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((messageCopy = aMessage.Clone()) != nullptr, error = OT_ERROR_NO_BUFS);
// Append the copy with retransmission data and add it to the queue.
SuccessOrExit(error = aQueryMetadata.AppendTo(*messageCopy));
@@ -196,10 +196,10 @@ Message *Client::CopyAndEnqueueMessage(const Message &aMessage, const QueryMetad
exit:
if (error != OT_ERROR_NONE && messageCopy != NULL)
if (error != OT_ERROR_NONE && messageCopy != nullptr)
{
messageCopy->Free();
messageCopy = NULL;
messageCopy = nullptr;
}
return messageCopy;
@@ -209,7 +209,7 @@ void Client::DequeueMessage(Message &aMessage)
{
mPendingQueries.Dequeue(aMessage);
if (mRetransmissionTimer.IsRunning() && (mPendingQueries.GetHead() == NULL))
if (mRetransmissionTimer.IsRunning() && (mPendingQueries.GetHead() == nullptr))
{
// No more requests pending, stop the timer.
mRetransmissionTimer.Stop();
@@ -227,10 +227,10 @@ otError Client::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMessageI
void Client::SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error;
Message *messageCopy = NULL;
Message *messageCopy = nullptr;
// Create a message copy for lower layers.
VerifyOrExit((messageCopy = aMessage.Clone(aMessage.GetLength() - sizeof(QueryMetadata))) != NULL,
VerifyOrExit((messageCopy = aMessage.Clone(aMessage.GetLength() - sizeof(QueryMetadata))) != nullptr,
error = OT_ERROR_NO_BUFS);
// Send the copy.
@@ -242,7 +242,7 @@ exit:
{
otLogWarnIp6("Failed to send DNS request: %s", otThreadErrorToString(error));
if (messageCopy != NULL)
if (messageCopy != nullptr)
{
messageCopy->Free();
}
@@ -363,7 +363,7 @@ Message *Client::FindRelatedQuery(const Header &aResponseHeader, QueryMetadata &
uint16_t messageId;
Message *message = mPendingQueries.GetHead();
while (message != NULL)
while (message != nullptr)
{
// Partially read DNS header to obtain message ID only.
uint16_t count = message->Read(message->GetOffset(), sizeof(messageId), &messageId);
@@ -392,7 +392,7 @@ void Client::FinalizeDnsTransaction(Message & aQuery,
{
DequeueMessage(aQuery);
if (aQueryMetadata.mResponseHandler != NULL)
if (aQueryMetadata.mResponseHandler != nullptr)
{
aQueryMetadata.mResponseHandler(aQueryMetadata.mResponseContext, aQueryMetadata.mHostname, aAddress, aTtl,
aResult);
@@ -413,7 +413,7 @@ void Client::HandleRetransmissionTimer(void)
Message * nextMessage;
Ip6::MessageInfo messageInfo;
for (message = mPendingQueries.GetHead(); message != NULL; message = nextMessage)
for (message = mPendingQueries.GetHead(); message != nullptr; message = nextMessage)
{
nextMessage = message->GetNext();
@@ -424,7 +424,7 @@ void Client::HandleRetransmissionTimer(void)
if (queryMetadata.mRetransmissionCount >= kMaxRetransmit)
{
// No expected response.
FinalizeDnsTransaction(*message, queryMetadata, NULL, 0, OT_ERROR_RESPONSE_TIMEOUT);
FinalizeDnsTransaction(*message, queryMetadata, nullptr, 0, OT_ERROR_RESPONSE_TIMEOUT);
continue;
}
@@ -470,7 +470,7 @@ void Client::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessag
Header responseHeader;
QueryMetadata queryMetadata;
ResourceRecordAaaa record;
Message * message = NULL;
Message * message = nullptr;
uint16_t offset;
VerifyOrExit(aMessage.Read(aMessage.GetOffset(), sizeof(responseHeader), &responseHeader) == sizeof(responseHeader),
@@ -482,7 +482,7 @@ void Client::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessag
aMessage.MoveOffset(sizeof(responseHeader));
offset = aMessage.GetOffset();
VerifyOrExit((message = FindRelatedQuery(responseHeader, queryMetadata)) != NULL, OT_NOOP);
VerifyOrExit((message = FindRelatedQuery(responseHeader, queryMetadata)) != nullptr, OT_NOOP);
VerifyOrExit(responseHeader.GetResponseCode() == Header::kResponseSuccess, error = OT_ERROR_FAILED);
@@ -517,9 +517,9 @@ void Client::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessag
exit:
if (message != NULL && error != OT_ERROR_NONE)
if (message != nullptr && error != OT_ERROR_NONE)
{
FinalizeDnsTransaction(*message, queryMetadata, NULL, 0, error);
FinalizeDnsTransaction(*message, queryMetadata, nullptr, 0, error);
}
}
+6 -6
View File
@@ -94,7 +94,7 @@ otError Icmp::SendError(IcmpHeader::Type aType,
{
otError error = OT_ERROR_NONE;
MessageInfo messageInfoLocal;
Message * message = NULL;
Message * message = nullptr;
IcmpHeader icmp6Header;
Header ip6Header;
Message::Settings settings(Message::kWithLinkSecurity, Message::kPriorityNet);
@@ -113,7 +113,7 @@ otError Icmp::SendError(IcmpHeader::Type aType,
messageInfoLocal = aMessageInfo;
VerifyOrExit((message = Get<Ip6>().NewMessage(0, settings)) != NULL, error = OT_ERROR_NO_BUFS);
VerifyOrExit((message = Get<Ip6>().NewMessage(0, settings)) != nullptr, error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetLength(sizeof(icmp6Header) + sizeof(ip6Header)));
message->Write(sizeof(icmp6Header), sizeof(ip6Header), &ip6Header);
@@ -129,7 +129,7 @@ otError Icmp::SendError(IcmpHeader::Type aType,
exit:
if (error != OT_ERROR_NONE && message != NULL)
if (error != OT_ERROR_NONE && message != nullptr)
{
message->Free();
}
@@ -197,7 +197,7 @@ otError Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMe
{
otError error = OT_ERROR_NONE;
IcmpHeader icmp6Header;
Message * replyMessage = NULL;
Message * replyMessage = nullptr;
MessageInfo replyMessageInfo;
uint16_t payloadLength;
@@ -209,7 +209,7 @@ otError Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMe
icmp6Header.Init();
icmp6Header.SetType(IcmpHeader::kTypeEchoReply);
if ((replyMessage = Get<Ip6>().NewMessage(0)) == NULL)
if ((replyMessage = Get<Ip6>().NewMessage(0)) == nullptr)
{
otLogDebgIcmp("Failed to allocate a new message");
ExitNow();
@@ -236,7 +236,7 @@ otError Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo &aMe
exit:
if (error != OT_ERROR_NONE && replyMessage != NULL)
if (error != OT_ERROR_NONE && replyMessage != nullptr)
{
replyMessage->Free();
}
+2 -2
View File
@@ -228,7 +228,7 @@ public:
{
mReceiveCallback = aCallback;
mContext = aContext;
mNext = NULL;
mNext = nullptr;
}
private:
@@ -258,7 +258,7 @@ public:
*
* @param[in] aReserved The number of header bytes to reserve after the ICMP header.
*
* @returns A pointer to the message or NULL if no buffers are available.
* @returns A pointer to the message or nullptr if no buffers are available.
*
*/
Message *NewMessage(uint16_t aReserved);

Some files were not shown because too many files have changed in this diff Show More