Fix spacing and alignments for src/ncp source code (#1829)

This commit contains no code/logic change. It is cosmetic change only,
fixing alignments/spacing in some of file under `/ncp` folder.
This commit is contained in:
Abtin Keshavarzian
2017-05-26 10:57:50 -07:00
committed by Jonathan Hui
parent fefdb4884a
commit 012015e351
5 changed files with 843 additions and 657 deletions
+8 -2
View File
@@ -154,7 +154,7 @@ exit:
bool Encoder::BufferWriteIterator::CanWrite(uint16_t aWriteLength) const
{
return (mRemainingLength >= aWriteLength);
return (mRemainingLength >= aWriteLength);
}
Encoder::Encoder(void):
@@ -203,6 +203,7 @@ otError Encoder::Encode(const uint8_t *aInBuf, uint16_t aInLength, BufferWriteIt
}
exit:
if (error != OT_ERROR_NONE)
{
aIterator = oldIterator;
@@ -227,6 +228,7 @@ otError Encoder::Finalize(BufferWriteIterator &aIterator)
SuccessOrExit(error = aIterator.WriteByte(kFlagSequence));
exit:
if (error != OT_ERROR_NONE)
{
aIterator = oldIterator;
@@ -236,7 +238,8 @@ exit:
return error;
}
Decoder::Decoder(uint8_t *aOutBuf, uint16_t aOutLength, FrameHandler aFrameHandler, ErrorHandler aErrorHandler, void *aContext):
Decoder::Decoder(uint8_t *aOutBuf, uint16_t aOutLength, FrameHandler aFrameHandler, ErrorHandler aErrorHandler,
void *aContext):
mState(kStateNoSync),
mFrameHandler(aFrameHandler),
mErrorHandler(aErrorHandler),
@@ -276,6 +279,7 @@ void Decoder::Decode(const uint8_t *aInBuf, uint16_t aInLength)
break;
case kFlagSequence:
// We ignore frames which are smaller
// than the size of the CRC check.
if (mOutOffset > sizeof(uint16_t))
@@ -307,6 +311,7 @@ void Decoder::Decode(const uint8_t *aInBuf, uint16_t aInLength)
{
mErrorHandler(mContext, OT_ERROR_NO_BUFS, mOutBuf, mOutOffset);
}
mState = kStateNoSync;
}
@@ -329,6 +334,7 @@ void Decoder::Decode(const uint8_t *aInBuf, uint16_t aInLength)
{
mErrorHandler(mContext, OT_ERROR_NO_BUFS, mOutBuf, mOutOffset);
}
mState = kStateNoSync;
}
+730 -554
View File
File diff suppressed because it is too large Load Diff
+91 -91
View File
@@ -258,20 +258,20 @@ private:
otError HandleCommandPropertyGet(uint8_t header, spinel_prop_key_t key);
otError HandleCommandPropertySet(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError HandleCommandPropertyInsert(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SendLastStatus(uint8_t header, spinel_status_t lastStatus);
private:
otError SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, otMessage *message);
@@ -280,12 +280,12 @@ private:
private:
typedef otError(NcpBase::*CommandHandlerType)(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
typedef otError(NcpBase::*GetPropertyHandlerType)(uint8_t header, spinel_prop_key_t key);
typedef otError(NcpBase::*SetPropertyHandlerType)(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
struct CommandHandlerEntry
{
@@ -326,18 +326,18 @@ private:
otError CommandHandler_NOOP(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
otError CommandHandler_RESET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
otError CommandHandler_PROP_VALUE_GET(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
otError CommandHandler_PROP_VALUE_SET(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
otError CommandHandler_PROP_VALUE_INSERT(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
otError CommandHandler_PROP_VALUE_REMOVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
otError CommandHandler_NET_SAVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
otError CommandHandler_NET_CLEAR(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
otError CommandHandler_NET_RECALL(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
uint16_t arg_len);
uint16_t arg_len);
otError GetPropertyHandler_ChannelMaskHelper(uint8_t header, spinel_prop_key_t key, uint32_t channel_mask);
@@ -451,200 +451,200 @@ private:
otError SetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#if OPENTHREAD_ENABLE_RAW_LINK_API
otError SetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
otError SetPropertyHandler_NET_IF_UP(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
otError SetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_BA_PROXY_STREAM(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#if OPENTHREAD_ENABLE_RAW_LINK_API
otError SetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
otError SetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#if OPENTHREAD_ENABLE_RAW_LINK_API
otError SetPropertyHandler_MAC_SRC_MATCH_ENABLED(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
#if OPENTHREAD_FTD
otError SetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#endif
otError SetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#if OPENTHREAD_FTD
otError SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB
otError SetPropertyHandler_THREAD_THREAD_STEERING_DATA(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
#endif // #if OPENTHREAD_FTD
otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
#if OPENTHREAD_ENABLE_COMMISSIONER
otError SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
otError SetPropertyHandler_BA_PROXY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#if OPENTHREAD_ENABLE_JAM_DETECTION
otError SetPropertyHandler_JAM_DETECT_ENABLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError SetPropertyHandler_JAM_DETECT_WINDOW(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
otError SetPropertyHandler_JAM_DETECT_BUSY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#endif
#if OPENTHREAD_ENABLE_DIAG
otError SetPropertyHandler_NEST_STREAM_MFG(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#endif
#if OPENTHREAD_ENABLE_LEGACY
otError SetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
#if OPENTHREAD_ENABLE_RAW_LINK_API
otError InsertPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError InsertPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
otError InsertPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError InsertPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError InsertPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError InsertPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#if OPENTHREAD_ENABLE_COMMISSIONER
otError InsertPropertyHandler_THREAD_JOINERS(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#endif
#if OPENTHREAD_ENABLE_RAW_LINK_API
otError RemovePropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError RemovePropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
otError RemovePropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError RemovePropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError RemovePropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
otError RemovePropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
uint16_t value_len);
uint16_t value_len);
#if OPENTHREAD_FTD
otError RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t header, spinel_prop_key_t key,
const uint8_t *value_ptr, uint16_t value_len);
const uint8_t *value_ptr, uint16_t value_len);
#endif
public:
@@ -659,7 +659,7 @@ public:
protected:
static NcpBase *sNcpInstance;
otInstance* mInstance;
otInstance *mInstance;
NcpFrameBuffer mTxFrameBuffer;
private:
+7 -5
View File
@@ -174,6 +174,7 @@ otError NcpFrameBuffer::InFrameFeedByte(uint8_t aByte)
mWriteSegmentTail = newTail;
exit:
if (error != OT_ERROR_NONE)
{
InFrameDiscard();
@@ -361,7 +362,7 @@ otError NcpFrameBuffer::OutFramePrepareSegment(void)
// Find tail/end of current segment.
mReadSegmentTail = Advance(mReadSegmentHead,
kSegmentHeaderSize + (header & kSegmentHeaderLengthMask));
kSegmentHeaderSize + (header & kSegmentHeaderLengthMask));
// Update the current read pointer to skip the segment header.
mReadPointer = Advance(mReadSegmentHead, kSegmentHeaderSize);
@@ -385,6 +386,7 @@ otError NcpFrameBuffer::OutFramePrepareSegment(void)
}
exit:
if (error != OT_ERROR_NONE)
{
mReadState = kReadStateDone;
@@ -408,8 +410,8 @@ otError NcpFrameBuffer::OutFramePrepareMessage(void)
// Update the current message from the queue.
mReadMessage = (mReadMessage == NULL) ?
otMessageQueueGetHead(&mMessageQueue) :
otMessageQueueGetNext(&mMessageQueue, mReadMessage);
otMessageQueueGetHead(&mMessageQueue) :
otMessageQueueGetNext(&mMessageQueue, mReadMessage);
VerifyOrExit(mReadMessage != NULL, error = OT_ERROR_NOT_FOUND);
@@ -641,8 +643,8 @@ uint16_t NcpFrameBuffer::OutFrameGetLength(void)
if (header & kSegmentHeaderMessageIndicatorFlag)
{
message = (message == NULL) ?
otMessageQueueGetHead(&mMessageQueue) :
otMessageQueueGetNext(&mMessageQueue, message);
otMessageQueueGetHead(&mMessageQueue) :
otMessageQueueGetNext(&mMessageQueue, message);
if (message != NULL)
{
+7 -5
View File
@@ -252,7 +252,7 @@ void NcpUart::HandleError(otError aError, uint8_t *aBuf, uint16_t aBufLength)
snprintf(hexbuf, sizeof(hexbuf), "Framing error %d: [", aError);
// Write out the first part of our log message.
otNcpStreamWrite(0, reinterpret_cast<uint8_t*>(hexbuf), static_cast<int>(strlen(hexbuf)));
otNcpStreamWrite(0, reinterpret_cast<uint8_t *>(hexbuf), static_cast<int>(strlen(hexbuf)));
// The first '3' comes from the trailing "]\n\000" at the end o the string.
// The second '3' comes from the length of two hex digits and a space.
@@ -261,16 +261,16 @@ void NcpUart::HandleError(otError aError, uint8_t *aBuf, uint16_t aBufLength)
// We can get away with sprintf because we know
// `hexbuf` is large enough, based on our calculations
// above.
snprintf(&hexbuf[i*3], sizeof(hexbuf) - i*3, " %02X", static_cast<uint8_t>(aBuf[i]));
snprintf(&hexbuf[i * 3], sizeof(hexbuf) - i * 3, " %02X", static_cast<uint8_t>(aBuf[i]));
}
// Append a final closing bracket and newline character
// so our log line looks nice.
snprintf(&hexbuf[i*3], sizeof(hexbuf) - i*3, "]\n");
snprintf(&hexbuf[i * 3], sizeof(hexbuf) - i * 3, "]\n");
// Write out the second part of our log message.
// We skip the first byte since it has a space in it.
otNcpStreamWrite(0, reinterpret_cast<uint8_t*>(hexbuf + 1), static_cast<int>(strlen(hexbuf) - 1));
otNcpStreamWrite(0, reinterpret_cast<uint8_t *>(hexbuf + 1), static_cast<int>(strlen(hexbuf) - 1));
}
#if OPENTHREAD_ENABLE_DEFAULT_LOGGING
@@ -284,6 +284,7 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat
va_list args;
va_start(args, aFormat);
if ((charsWritten = vsnprintf(logString, sizeof(logString), aFormat, args)) > 0)
{
if (charsWritten > static_cast<int>(sizeof(logString) - 1))
@@ -291,8 +292,9 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat
charsWritten = static_cast<int>(sizeof(logString) - 1);
}
otNcpStreamWrite(0, reinterpret_cast<uint8_t*>(logString), charsWritten);
otNcpStreamWrite(0, reinterpret_cast<uint8_t *>(logString), charsWritten);
}
va_end(args);
(void)aLogLevel;