From 927ac08060d0056137e926b1927eca11f712f315 Mon Sep 17 00:00:00 2001 From: "hyuna0213.jo" Date: Wed, 5 Aug 2015 17:44:43 +0900 Subject: [PATCH] fixed build warnings in CA common logic modified build warnings in CA common files Change-Id: If7ba87b32a971d6e8e921f92081051d7959d8380 Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/2114 Reviewed-by: Naga Ashok Jampani Tested-by: jenkins-iotivity Reviewed-by: Erich Keane --- resource/csdk/connectivity/src/adapter_util/caadapterutils.c | 7 +++---- resource/csdk/connectivity/src/cablockwisetransfer.c | 10 +++++----- resource/csdk/connectivity/src/caretransmission.c | 11 +++-------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c index 2094a6e..56cbe70 100644 --- a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c +++ b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c @@ -170,10 +170,9 @@ void CAConvertNameToAddr(const char *host, uint16_t port, struct sockaddr_storag VERIFY_NON_NULL_VOID(sockaddr, CA_ADAPTER_UTILS_TAG, "sockaddr is null"); struct addrinfo *addrs; - struct addrinfo hints = { 0 }; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_NUMERICHOST; + struct addrinfo hints = { .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_NUMERICHOST }; int r = getaddrinfo(host, NULL, &hints, &addrs); if (r) diff --git a/resource/csdk/connectivity/src/cablockwisetransfer.c b/resource/csdk/connectivity/src/cablockwisetransfer.c index 46ea13c..f5026c1 100644 --- a/resource/csdk/connectivity/src/cablockwisetransfer.c +++ b/resource/csdk/connectivity/src/cablockwisetransfer.c @@ -288,7 +288,7 @@ CAResult_t CAReceiveBlockWiseData(coap_pdu_t *pdu, const CAEndpoint_t *endpoint, } // check if block option is set and get block data - coap_block_t block = {0}; + coap_block_t block = {0, 0, 0}; // get block1 option int isBlock1 = coap_get_block(pdu, COAP_OPTION_BLOCK1, &block); @@ -1943,15 +1943,15 @@ CAData_t* CACreateNewDataSet(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint VERIFY_NON_NULL_RET(pdu->hdr, TAG, "pdu->hdr", NULL); VERIFY_NON_NULL_RET(endpoint, TAG, "endpoint", NULL); - CAInfo_t responseData = { 0 }; - responseData.token = (CAToken_t) OICMalloc(pdu->hdr->token_length); + CAInfo_t responseData = { .tokenLength = pdu->hdr->token_length }; + responseData.token = (CAToken_t) OICMalloc(responseData.tokenLength); if (NULL == responseData.token) { OIC_LOG(ERROR, TAG, "out of memory"); return NULL; } - memcpy(responseData.token, pdu->hdr->token, pdu->hdr->token_length); - responseData.tokenLength = pdu->hdr->token_length; + memcpy(responseData.token, pdu->hdr->token, responseData.tokenLength); + CAResponseInfo_t* responseInfo = (CAResponseInfo_t*) OICCalloc(1, sizeof(CAResponseInfo_t)); if (NULL == responseInfo) { diff --git a/resource/csdk/connectivity/src/caretransmission.c b/resource/csdk/connectivity/src/caretransmission.c index b19b0db..4f212c2 100644 --- a/resource/csdk/connectivity/src/caretransmission.c +++ b/resource/csdk/connectivity/src/caretransmission.c @@ -329,15 +329,10 @@ CAResult_t CARetransmissionInitialize(CARetransmission_t *context, memset(context, 0, sizeof(CARetransmission_t)); - CARetransmissionConfig_t cfg = { 0 }; + CARetransmissionConfig_t cfg = { .supportType = DEFAULT_RETRANSMISSION_TYPE, + .tryingCount = DEFAULT_RETRANSMISSION_COUNT }; - if (NULL == config) - { - // setDefault - cfg.supportType = DEFAULT_RETRANSMISSION_TYPE; - cfg.tryingCount = DEFAULT_RETRANSMISSION_COUNT; - } - else + if (config) { cfg = *config; } -- 2.7.4