[style] apply missing const declarations (#3921)

This commit is contained in:
Jonathan Hui
2019-06-14 12:45:39 -07:00
committed by GitHub
parent 6dfd716da1
commit 932cd78f04
23 changed files with 42 additions and 55 deletions
+2 -2
View File
@@ -123,7 +123,7 @@ public:
* @retval FALSE If DTLS session is not active.
*
*/
bool IsConnectionActive(void) { return mDtls.IsConnectionActive(); }
bool IsConnectionActive(void) const { return mDtls.IsConnectionActive(); }
/**
* This method indicates whether or not the DTLS session is connected.
@@ -132,7 +132,7 @@ public:
* @retval FALSE The DTLS session is not connected.
*
*/
bool IsConnected(void) { return mDtls.IsConnected(); }
bool IsConnected(void) const { return mDtls.IsConnected(); }
/**
* This method stops the DTLS connection.
+1 -1
View File
@@ -383,7 +383,7 @@ public:
* @retval FALSE The current entry is valid.
*
*/
bool IsDone(void) { return mIsDone; }
bool IsDone(void) const { return mIsDone; }
/**
* This method advances the iterator to move to the next Child Info entry in the list (if any).
+1 -1
View File
@@ -164,7 +164,7 @@ public:
* @retval FALSE If there are no tasklets pending.
*
*/
bool AreTaskletsPending(void) { return mHead != NULL; }
bool AreTaskletsPending(void) const { return mHead != NULL; }
/**
* This method processes all tasklets queued when this is called.
+1 -11
View File
@@ -172,17 +172,7 @@ void Mac::Scan(Operation aScanOperation, uint32_t aScanChannels, uint16_t aScanD
StartOperation(aScanOperation);
}
bool Mac::IsActiveScanInProgress(void)
{
return (mOperation == kOperationActiveScan) || (mPendingActiveScan);
}
bool Mac::IsEnergyScanInProgress(void)
{
return (mOperation == kOperationEnergyScan) || (mPendingEnergyScan);
}
bool Mac::IsInTransmitState(void)
bool Mac::IsInTransmitState(void) const
{
return (mOperation == kOperationTransmitData) || (mOperation == kOperationTransmitBeacon) ||
(mOperation == kOperationTransmitOutOfBandFrame);
+4 -4
View File
@@ -466,13 +466,13 @@ public:
* This method returns if an active scan is in progress.
*
*/
bool IsActiveScanInProgress(void);
bool IsActiveScanInProgress(void) const { return (mOperation == kOperationActiveScan) || (mPendingActiveScan); }
/**
* This method returns if an energy scan is in progress.
*
*/
bool IsEnergyScanInProgress(void);
bool IsEnergyScanInProgress(void) const { return (mOperation == kOperationEnergyScan) || (mPendingEnergyScan); }
/**
* This method returns if the MAC layer is in transmit state.
@@ -482,7 +482,7 @@ public:
* Requests.
*
*/
bool IsInTransmitState(void);
bool IsInTransmitState(void) const;
/**
* This method registers a callback to provide received raw IEEE 802.15.4 frames.
@@ -564,7 +564,7 @@ public:
* @retval false Link layer is not enabled.
*
*/
bool IsEnabled(void) { return mEnabled; }
bool IsEnabled(void) const { return mEnabled; }
/**
* This method performs AES CCM on the frame which is going to be sent.
+2 -2
View File
@@ -142,13 +142,13 @@ void Filter::ClearAddresses(void)
}
}
otError Filter::GetNextAddress(Iterator &aIterator, Entry &aEntry)
otError Filter::GetNextAddress(Iterator &aIterator, Entry &aEntry) const
{
otError error = OT_ERROR_NOT_FOUND;
for (; aIterator < OT_ARRAY_LENGTH(mFilterEntries); aIterator++)
{
FilterEntry &entry = mFilterEntries[aIterator];
const FilterEntry &entry = mFilterEntries[aIterator];
if (entry.mFiltered)
{
+1 -1
View File
@@ -144,7 +144,7 @@ public:
* @retval OT_ERROR_NOT_FOUND No subsequent entry exists.
*
*/
otError GetNextAddress(Iterator &aIterator, Entry &aEntry);
otError GetNextAddress(Iterator &aIterator, Entry &aEntry) const;
/**
* This method sets the received signal strength for the messages from the Extended Address.
+2 -2
View File
@@ -1319,7 +1319,7 @@ public:
* @retval FALSE if the beacon does not appear to be a valid Thread Beacon message.
*
*/
bool IsValid(void)
bool IsValid(void) const
{
return (mSuperframeSpec == ot::Encoding::LittleEndian::HostSwap16(kSuperFrameSpec)) && (mGtsSpec == 0) &&
(mPendingAddressSpec == 0);
@@ -1387,7 +1387,7 @@ public:
* @retval FALSE if the beacon does not appear to be a valid Thread Beacon Payload.
*
*/
bool IsValid(void) { return (mProtocolId == kProtocolId); }
bool IsValid(void) const { return (mProtocolId == kProtocolId); }
/**
* This method returns the Protocol ID value.
-2
View File
@@ -408,8 +408,6 @@ private:
#if OPENTHREAD_FTD
static void HandleSet(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
void HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
bool IsTlvInitialized(Tlv::Type aType);
#endif
Coap::Resource mResourceGet;
+2 -2
View File
@@ -216,7 +216,7 @@ public:
* @retval TRUE If the message shall be sent before the given time.
* @retval FALSE Otherwise.
*/
bool IsEarlier(uint32_t aTime) { return (static_cast<int32_t>(aTime - mSendTime) > 0); }
bool IsEarlier(uint32_t aTime) const { return (static_cast<int32_t>(aTime - mSendTime) > 0); }
/**
* This method checks if the message shall be sent after the given time.
@@ -226,7 +226,7 @@ public:
* @retval TRUE If the message shall be sent after the given time.
* @retval FALSE Otherwise.
*/
bool IsLater(uint32_t aTime) { return (static_cast<int32_t>(aTime - mSendTime) < 0); }
bool IsLater(uint32_t aTime) const { return (static_cast<int32_t>(aTime - mSendTime) < 0); }
private:
Ip6::MessageInfo mMessageInfo; ///< Message info of the message to send.
+2 -2
View File
@@ -2445,7 +2445,7 @@ public:
* @retval FALSE If the Joiner flag is not set.
*
*/
bool IsJoiner(void) { return (mFlags & kJoinerMask) != 0; }
bool IsJoiner(void) const { return (mFlags & kJoinerMask) != 0; }
/**
* This method sets the Joiner flag.
@@ -2532,7 +2532,7 @@ public:
* @retval FALSE If the Native Commissioner flag is not set.
*
*/
bool IsNativeCommissioner(void) { return (mFlags & kNativeMask) != 0; }
bool IsNativeCommissioner(void) const { return (mFlags & kNativeMask) != 0; }
/**
* This method sets the Native Commissioner flag.
+2 -2
View File
@@ -279,7 +279,7 @@ public:
* @sa SetReceiveIp6FilterEnabled
*
*/
bool IsReceiveIp6FilterEnabled(void) { return mIsReceiveIp6FilterEnabled; }
bool IsReceiveIp6FilterEnabled(void) const { return mIsReceiveIp6FilterEnabled; }
/**
* This method sets whether or not Thread control traffic is filtered out when delivering IPv6 datagrams
@@ -299,7 +299,7 @@ public:
* @returns TRUE if IPv6 forwarding is enabled, FALSE otherwise.
*
*/
bool IsForwardingEnabled(void) { return mForwardingEnabled; }
bool IsForwardingEnabled(void) const { return mForwardingEnabled; }
/**
* This method enables/disables IPv6 forwarding.
+2 -2
View File
@@ -576,7 +576,7 @@ public:
* @returns The Fragment Offset value.
*
*/
uint16_t GetOffset(void) { return (HostSwap16(mOffsetMore) & kOffsetMask) >> kOffsetOffset; }
uint16_t GetOffset(void) const { return (HostSwap16(mOffsetMore) & kOffsetMask) >> kOffsetOffset; }
/**
* This method sets the Fragment Offset value.
@@ -596,7 +596,7 @@ public:
* @returns The M flag value.
*
*/
bool IsMoreFlagSet(void) { return HostSwap16(mOffsetMore) & kMoreFlag; }
bool IsMoreFlagSet(void) const { return HostSwap16(mOffsetMore) & kMoreFlag; }
/**
* This method clears the M flag value.
+1 -1
View File
@@ -125,7 +125,7 @@ public:
* @retval FALSE If the MPL M flag is not set.
*
*/
bool IsMaxFlagSet(void) { return (mControl & kMaxFlag) != 0; }
bool IsMaxFlagSet(void) const { return (mControl & kMaxFlag) != 0; }
/**
* This method clears the MPL M flag.
+6 -7
View File
@@ -302,23 +302,22 @@ exit:
return error;
}
otError Netif::GetNextExternalMulticast(uint8_t &aIterator, Address &aAddress)
otError Netif::GetNextExternalMulticast(uint8_t &aIterator, Address &aAddress) const
{
otError error = OT_ERROR_NOT_FOUND;
size_t num = OT_ARRAY_LENGTH(mExtMulticastAddresses);
NetifMulticastAddress *entry;
otError error = OT_ERROR_NOT_FOUND;
size_t num = OT_ARRAY_LENGTH(mExtMulticastAddresses);
VerifyOrExit(aIterator < num);
// Find an available entry in the `mExtMulticastAddresses` array.
for (uint8_t i = aIterator; i < num; i++)
{
entry = &mExtMulticastAddresses[i];
const NetifMulticastAddress &entry = mExtMulticastAddresses[i];
// In an unused/available entry, `mNext` points back to the entry itself.
if (entry->mNext != entry)
if (entry.mNext != &entry)
{
aAddress = entry->GetAddress();
aAddress = entry.GetAddress();
aIterator = i + 1;
ExitNow(error = OT_ERROR_NONE);
}
+2 -2
View File
@@ -360,7 +360,7 @@ public:
* @retval OT_ERROR_NOT_FOUND No subsequent external multicast address.
*
*/
otError GetNextExternalMulticast(uint8_t &aIterator, Address &aAddress);
otError GetNextExternalMulticast(uint8_t &aIterator, Address &aAddress) const;
/**
* This method subscribes the network interface to the external (to OpenThread) multicast address.
@@ -400,7 +400,7 @@ public:
* @retval TRUE If the multicast promiscuous mode is enabled.
* @retval FALSE If the multicast promiscuous mode is disabled.
*/
bool IsMulticastPromiscuousEnabled(void) { return mMulticastPromiscuous; }
bool IsMulticastPromiscuousEnabled(void) const { return mMulticastPromiscuous; }
/**
* This method enables multicast promiscuous mode on the network interface.
+1 -1
View File
@@ -385,7 +385,7 @@ exit:
return error;
}
bool MeshForwarder::GetRxOnWhenIdle(void)
bool MeshForwarder::GetRxOnWhenIdle(void) const
{
return Get<Mac::Mac>().GetRxOnWhenIdle();
}
+1 -1
View File
@@ -219,7 +219,7 @@ public:
* @retval FALSE The rx-on-when-idle-mode is disabled.
*
*/
bool GetRxOnWhenIdle(void);
bool GetRxOnWhenIdle(void) const;
/**
* This method sets the rx-on-when-idle mode
+1 -1
View File
@@ -282,7 +282,7 @@ public:
* @returns The current router selection jitter timeout value.
*
*/
uint8_t GetRouterSelectionJitterTimeout(void) { return mRouterSelectionJitterTimeout; }
uint8_t GetRouterSelectionJitterTimeout(void) const { return mRouterSelectionJitterTimeout; }
/**
* This method returns the ROUTER_UPGRADE_THRESHOLD value.
+3 -3
View File
@@ -62,12 +62,12 @@ public:
bool IsRouterRoleEnabled(void) const { return false; }
bool IsSingleton(void) { return false; }
bool IsSingleton(void) const { return false; }
otError BecomeRouter(ThreadStatusTlv::Status) { return OT_ERROR_NOT_CAPABLE; }
otError BecomeLeader(void) { return OT_ERROR_NOT_CAPABLE; }
uint8_t GetRouterSelectionJitterTimeout(void) { return 0; }
uint8_t GetRouterSelectionJitterTimeout(void) const { return 0; }
uint32_t GetPreviousPartitionId(void) const { return 0; }
void SetPreviousPartitionId(uint32_t) {}
@@ -84,7 +84,7 @@ public:
otError RemoveNeighbor(const Mac::Address &) { return BecomeDetached(); }
otError RemoveNeighbor(Neighbor &) { return BecomeDetached(); }
bool IsMinimalChild(uint16_t) { return false; }
bool IsMinimalChild(uint16_t) const { return false; }
void RestoreChildren(void) {}
otError RemoveStoredChild(uint16_t) { return OT_ERROR_NOT_IMPLEMENTED; }
+3 -3
View File
@@ -1152,7 +1152,7 @@ public:
* @retval OT_ERROR_NOT_FOUND No subsequent Tlv exists in TlvRequestTlv.
*
*/
otError GetNextTlv(TlvRequestIterator &aIterator, uint8_t &aTlv)
otError GetNextTlv(TlvRequestIterator &aIterator, uint8_t &aTlv) const
{
otError error = OT_ERROR_NOT_FOUND;
@@ -1233,7 +1233,7 @@ public:
* @retval TRUE If the Router flag is set.
* @retval FALSE If the Router flag is not set.
*/
bool IsRouterFlagSet(void) { return (mMask & kRouterFlag) != 0; }
bool IsRouterFlagSet(void) const { return (mMask & kRouterFlag) != 0; }
/**
* This method clears the End Device flag.
@@ -1253,7 +1253,7 @@ public:
* @retval TRUE If the End Device flag is set.
* @retval FALSE If the End Device flag is not set.
*/
bool IsEndDeviceFlagSet(void) { return (mMask & kEndDeviceFlag) != 0; }
bool IsEndDeviceFlagSet(void) const { return (mMask & kEndDeviceFlag) != 0; }
/**
* This method sets the Mask byte value.
+1 -1
View File
@@ -196,7 +196,7 @@ public:
* @returns The interval (in seconds).
*
*/
uint32_t GetAutoChannelSelectionInterval(void) { return mAutoSelectInterval; }
uint32_t GetAutoChannelSelectionInterval(void) const { return mAutoSelectInterval; }
/**
* This method gets the supported channel mask.
+1 -1
View File
@@ -225,7 +225,7 @@ protected:
uint16_t aValueLen);
otError SendQueuedResponses(void);
bool IsResponseQueueEmpty(void) { return (mResponseQueueHead == mResponseQueueTail); }
bool IsResponseQueueEmpty(void) const { return (mResponseQueueHead == mResponseQueueTail); }
otError EnqueueResponse(uint8_t aHeader, ResponseType aType, unsigned int aPropKeyOrStatus);
otError PrepareGetResponse(uint8_t aHeader, spinel_prop_key_t aPropKey)