Fix control flow issues. (#171)

This commit is contained in:
Jonathan Hui
2016-06-17 11:58:37 -07:00
committed by GitHub
parent 0a45e89955
commit 2e17520f07
5 changed files with 8 additions and 7 deletions
+2 -1
View File
@@ -395,10 +395,10 @@ exit:
void Interpreter::ProcessMasterKey(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
uint8_t keyLength;
if (argc == 0)
{
uint8_t keyLength;
const uint8_t *key = otGetMasterKey(&keyLength);
for (int i = 0; i < keyLength; i++)
@@ -410,6 +410,7 @@ void Interpreter::ProcessMasterKey(int argc, char *argv[])
}
else
{
int8_t keyLength;
uint8_t key[16];
VerifyOrExit((keyLength = Hex2Bin(argv[0], key, sizeof(key))) >= 0, error = kThreadError_Parse);
+2
View File
@@ -516,6 +516,8 @@ void Mac::TransmitDoneTask(bool aRxPending, ThreadError aError)
mReceiveTimer.Stop();
}
// fall through
case kStateActiveScan:
case kStateTransmitBeacon:
SentFrame(aError == kThreadError_None);
-1
View File
@@ -542,7 +542,6 @@ void AddressResolver::SendAddressQueryResponse(const ThreadTargetTlv &aTargetTlv
memset(&messageInfo, 0, sizeof(messageInfo));
memcpy(&messageInfo.GetPeerAddr(), &aDestination, sizeof(messageInfo.GetPeerAddr()));
messageInfo.mInterfaceId = messageInfo.mInterfaceId;
messageInfo.mPeerPort = kCoapUdpPort;
SuccessOrExit(error = mSocket.SendTo(*message, messageInfo));
+1 -2
View File
@@ -96,8 +96,7 @@ int MleRouter::AllocateRouterId(void)
// choose available router id at random
uint8_t freeBit;
// freeBit = otPlatRandomGet() % numAvailable;
freeBit = 0;
freeBit = otPlatRandomGet() % numAvailable;
// allocate router id
for (int i = 0; i < kMaxRouterId; i++)
+3 -3
View File
@@ -873,7 +873,7 @@ ThreadError Leader::AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorder
PrefixTlv *dstPrefix;
ContextTlv *dstContext;
BorderRouterTlv *dstBorderRouter;
uint8_t aContextId;
int contextId;
if ((dstPrefix = FindPrefix(aPrefix.GetPrefix(), aPrefix.GetPrefixLength())) == NULL)
{
@@ -890,7 +890,7 @@ ThreadError Leader::AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorder
{
dstContext->SetCompress();
}
else if ((aContextId = AllocateContext()) >= 0)
else if ((contextId = AllocateContext()) >= 0)
{
dstContext = reinterpret_cast<ContextTlv *>(dstPrefix->GetNext());
Insert(reinterpret_cast<uint8_t *>(dstContext), sizeof(ContextTlv));
@@ -898,7 +898,7 @@ ThreadError Leader::AddBorderRouter(PrefixTlv &aPrefix, BorderRouterTlv &aBorder
dstContext->Init();
dstContext->SetStable();
dstContext->SetCompress();
dstContext->SetContextId(aContextId);
dstContext->SetContextId(contextId);
dstContext->SetContextLength(aPrefix.GetPrefixLength());
}
else