VERIFY_NON_NULL(remoteAddress, EDR_ADAPTER_TAG, "Remote address is null");
VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
- if (0 >= dataLength)
+ if (0 == dataLength)
{
OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative data length!");
return CA_STATUS_INVALID_PARAM;
// Input validation
VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
- if (0 >= dataLength)
+ if (0 == dataLength)
{
OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative data length!");
return CA_STATUS_INVALID_PARAM;
oc_mutex_lock(g_senderInfoMutex);
senderInfo->refCount--;
- if(senderInfo->refCount <= 0)
+ if(senderInfo->refCount == 0)
{
OICFree(senderInfo->defragData);
OICFree(senderInfo->remoteEndpoint);
OIC_LOG_V(DEBUG, CALEADAPTER_TAG,
"Secure Data Receive - decrypted datalen = %zd", dataLen);
- if (dataLen <= 0)
+ if (dataLen == 0)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "incorrect dataLen, derecypt fail !");
return CA_STATUS_INVALID_PARAM;
//Input validation
VERIFY_NON_NULL_RET(data, CALEADAPTER_TAG, "Data is null", -1);
- if (0 >= dataLen)
+ if (0 == dataLen)
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "Invalid Parameter");
return -1;
int man_id;
result = bt_adapter_le_get_scan_result_manufacturer_data(scanInfo,
pkt_type, &man_id, &man_data, &man_data_len);
-
+
if (result == BT_ERROR_NONE && NULL != man_data)
{
char *compare_man_data = OICMalloc((man_data_len*2)+1);
VERIFY_NON_NULL(data, TAG, "data is NULL");
- if (0 >= dataLen)
+ if (0 == dataLen)
{
OIC_LOG(ERROR, TAG, "dataLen is less than or equal zero. Invalid input!");
return CA_STATUS_INVALID_PARAM;
VERIFY_NON_NULL(data, TAG, "data is NULL");
- if (0 >= dataLen)
+ if (0 == dataLen)
{
OIC_LOG(ERROR, TAG, "dataLen is less than or equal zero. Invalid input !");
return CA_STATUS_INVALID_PARAM;
VERIFY_NON_NULL(data, TAG, "data is NULL");
- if (0 >= dataLen)
+ if (0 == dataLen)
{
OIC_LOG(ERROR, TAG, "dataLen is less than or equal zero. Invalid input!");
return CA_STATUS_INVALID_PARAM;
VERIFY_NON_NULL(data, TAG, "data is NULL");
- if (0 >= dataLen)
+ if (0 == dataLen)
{
OIC_LOG(ERROR, TAG, "dataLen is less than or equal zero. Invalid input !");
return CA_STATUS_INVALID_PARAM;
OIC_LOG(DEBUG, TAG, "IN");
- if(!data || strlen(data) <= 0 || length <=0 )
+ if(!data || strlen(data) == 0 || length <=0 )
{
OIC_LOG(ERROR, TAG, "Invalid param is passed");
return CA_STATUS_INVALID_PARAM;
OIC_LOG(DEBUG, TAG, "IN");
- if(!data || strlen(data) <= 0 || length <=0 )
+ if(!data || strlen(data) == 0 || length <=0 )
{
OIC_LOG(ERROR, TAG, "Invalid param is passed");
return CA_STATUS_INVALID_PARAM;
CATerminateLEGattServer();
return CA_STATUS_FAILED;
}
-
+
if(g_leServerAutoAdvertisement)
{
ret = CALEStartAdvertise();
{
OIC_LOG(WARNING, TAG, "Auto advertisement is DISABLED. Advertising is not started.");
}
-
+
g_isLEGattServerStarted = true;
oc_mutex_unlock(g_leServerStateMutex);
{
OIC_LOG_V(ERROR, TAG, "CALEStartAdvertiseImpl failed[%d]", res);
}
-
+
//This array is freed here because it's used in CALEStartAdvertiseImpl() method (freeing earlier causes bluetooth to crash)
if(data)
free(data);
VERIFY_NON_NULL_VOID(blockID, TAG, "blockID");
OICFree(blockID->id);
OICFree(blockID);
- blockID = NULL;
}
bool CABlockidMatches(const CABlockData_t *currData, const CABlockDataID_t *blockID)
ssize_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
- for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len))
+ for (nh = (struct nlmsghdr *)buf; nh != NULL && NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len))
{
- if (nh != NULL && (nh->nlmsg_type != RTM_DELADDR && nh->nlmsg_type != RTM_NEWADDR))
+ if (nh->nlmsg_type != RTM_DELADDR && nh->nlmsg_type != RTM_NEWADDR)
{
continue;
}
OCRepPayloadGetPropInt(payload, GATEWAY, &tempGateway);
*gatewayId = tempGateway;
- if (NULL == gatewayId || 0 == *gatewayId)
+ if (0 == *gatewayId)
{
return OC_STACK_COMM_ERROR;
}
for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
{
RTMDestIntfInfo_t *destCheck = u_arraylist_get(entry->destination->destIntfAddr, i);
- if (!destCheck && !destCheck->isValid)
+ if (destCheck && !destCheck->isValid)
{
void *data = u_arraylist_remove(entry->destination->destIntfAddr, i);
OICFree(data);
RM_NULL_CHECK_WITH_RET(numOptions, TAG, "numOptions");
RM_NULL_CHECK_WITH_RET(endpoint, TAG, "endpoint");
- if (0 >= *numOptions)
+ if (0 == *numOptions)
{
OIC_LOG(ERROR, TAG, "Invalid arguement: numOptions");
return OC_STACK_ERROR;
}
#endif // WITH_PRESENCE
OICFree(cbNode);
- cbNode = NULL;
}
OIC_TRACE_END();
}
return OC_STACK_NO_RESOURCE;
}
- if (resourcePtr && resourcePtr->rsrcChildResourcesHead != NULL)
+ if (resourcePtr->rsrcChildResourcesHead != NULL)
{
// Collection resource
if (resourcePtr->entityHandler != defaultResourceEHandler)
OICFree(serverRequest->requestToken);
OICFree(serverRequest->rcvdVendorSpecificHeaderOptions);
OICFree(serverRequest);
- serverRequest = NULL;
OIC_LOG(INFO, TAG, "Server Request Removed!!");
}
}
if (strcmp(rdPubUri, targetUri) == 0)
{
// Update resource unique id in stack.
- if (response)
+ if (response->payload)
{
- if (response->payload)
+ OCRepPayload *rdPayload = (OCRepPayload *) response->payload;
+ OCRepPayload **links = NULL;
+ size_t dimensions[MAX_REP_ARRAY_DEPTH] = { 0 };
+ if (OCRepPayloadGetPropObjectArray(rdPayload, OC_RSRVD_LINKS,
+ &links, dimensions))
{
- OCRepPayload *rdPayload = (OCRepPayload *) response->payload;
- OCRepPayload **links = NULL;
- size_t dimensions[MAX_REP_ARRAY_DEPTH] = { 0 };
- if (OCRepPayloadGetPropObjectArray(rdPayload, OC_RSRVD_LINKS,
- &links, dimensions))
+ size_t i = 0;
+ for (; i < dimensions[0]; i++)
{
- size_t i = 0;
- for (; i < dimensions[0]; i++)
+ char *uri = NULL;
+ if (OCRepPayloadGetPropString(links[i], OC_RSRVD_HREF, &uri))
{
- char *uri = NULL;
- if (OCRepPayloadGetPropString(links[i], OC_RSRVD_HREF, &uri))
+ OCResourceHandle handle = OCGetResourceHandleAtUri(uri);
+ int64_t ins = 0;
+ if (OCRepPayloadGetPropInt(links[i], OC_RSRVD_INS, &ins))
{
- OCResourceHandle handle = OCGetResourceHandleAtUri(uri);
- int64_t ins = 0;
- if (OCRepPayloadGetPropInt(links[i], OC_RSRVD_INS, &ins))
- {
- OCBindResourceInsToResource(handle, ins);
- }
-
- OICFree(uri);
- uri = NULL;
+ OCBindResourceInsToResource(handle, ins);
}
- }
- // Free links
- size_t count = calcDimTotal(dimensions);
- for (size_t k = 0; k < count; k++)
- {
- OCRepPayloadDestroy(links[k]);
+ OICFree(uri);
+ uri = NULL;
}
- OICFree(links);
}
+
+ // Free links
+ size_t count = calcDimTotal(dimensions);
+ for (size_t k = 0; k < count; k++)
+ {
+ OCRepPayloadDestroy(links[k]);
+ }
+ OICFree(links);
}
}
}
}
else
{
- if ((key != NULL) && (value != NULL))
+ if (value != NULL)
{
OIC_LOG(INFO, TAG, "Build OCCapability Instance.");
// Requested interface is Link list interface
//if(ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_LL))
- if(!ehRequest->query ||
- (ehRequest->query && !strcmp(ehRequest->query, "")) ||
- (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_LL)) ||
- (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT)))
+ if (!ehRequest->query || !strcmp(ehRequest->query, "") ||
+ CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_LL) ||
+ CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))
{
const OCRepPayload *arrayPayload[3] = {NULL};
size_t dimensions[MAX_REP_ARRAY_DEPTH] = {childResCnt, 0, 0};
- if(!ehRequest->query ||
- (ehRequest->query && !strcmp(ehRequest->query, "")) ||
- (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT)))
+ if(!ehRequest->query || !strcmp(ehRequest->query, "") ||
+ CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))
{
OIC_LOG(DEBUG, ES_RH_TAG, "constructResponse EasySetup res");
OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_EASYSETUP);
OCEntityHandlerResult CheckEhRequestPayload(OCEntityHandlerRequest *ehRequest)
{
- if( !(ehRequest->query) ||
- (ehRequest->query &&
- (strcmp(ehRequest->query, "") && !CompareResourceInterface(ehRequest->query,
- OC_RSRVD_INTERFACE_DEFAULT))))
+ if( !ehRequest->query || (strcmp(ehRequest->query, "") &&
+ !CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT)))
{
OIC_LOG(ERROR, ES_RH_TAG, "Not supported Interface");
return OC_EH_BAD_REQ;
while (iter)
{
following = iter->next;
- if (iter)
- {
- NSOICFree(iter->topicName);
- iter->next = NULL;
- NSOICFree(iter);
- }
+ NSOICFree(iter->topicName);
+ iter->next = NULL;
+ NSOICFree(iter);
iter = following;
}
}
while (iter)\r
{\r
following = iter->next;\r
- if (iter)\r
- {\r
- NSOICFree(iter->topicName);\r
- iter->next = NULL;\r
- NSOICFree(iter);\r
- }\r
+ NSOICFree(iter->topicName);\r
+ iter->next = NULL;\r
+ NSOICFree(iter);\r
iter = following;\r
}\r
}\r
(obj->consumerId)[0] = '\0';
OICFree(obj);
- obj = NULL;
return NS_OK;
}
address = schema + 2;
}
size_t prefixLen = schema - inputaddress;
- if (prefixLen <= 0)
+ if (prefixLen == 0)
{
NS_LOG(ERROR, "Invalid Input address.");
return NULL;
if (!serverInfo)
{
- NS_LOG(DEBUG, "serverInfo is not NULL");
- NS_LOG_V(DEBUG, "serverInfo->serverUri = %s", serverInfo->serverUri);
+ NS_LOG(ERROR, "serverInfo is NULL");
+ return OC_STACK_ERROR;
}
+ NS_LOG_V(DEBUG, "serverInfo->serverUri = %s", serverInfo->serverUri);
+
NS_LOG(DEBUG, "NSProviderPublishTopic - OUT");
return OCDoResource(NULL, OC_REST_POST, serverInfo->serverUri, serverInfo->devAddr,