src/amf/agent/ava_hdl.cc | 13 +++++-------- src/amf/agent/ava_mds.cc | 12 ++++-------- src/amf/agent/ava_op.cc | 11 ++++------- src/amf/amfwd/amf_wdog.c | 2 +- src/amf/common/d2nmsg.c | 7 ++----- src/amf/common/n2avamsg.c | 1 - src/amf/tools/amf_pm.c | 4 +--- 7 files changed, 17 insertions(+), 33 deletions(-)
[staging/src/amf/agent/ava_hdl.cc:59] -> [staging/src/amf/agent/ava_hdl.cc:67]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_hdl.cc:420]: (style) The scope of the variable 'rec' can be reduced. [staging/src/amf/agent/ava_hdl.cc:592]: (style) The scope of the variable 'i' can be reduced. [staging/src/amf/agent/ava_mds.cc:86] -> [staging/src/amf/agent/ava_mds.cc:90]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_mds.cc:149] -> [staging/src/amf/agent/ava_mds.cc:158]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_mds.cc:1020] -> [staging/src/amf/agent/ava_mds.cc:1028]: (style) Variable 'rc' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_mds.cc:1103] -> [staging/src/amf/agent/ava_mds.cc:1107]: (style) Variable 'msg' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_op.cc:221] -> [staging/src/amf/agent/ava_op.cc:222]: (style) Variable 'osaf_cbk.saAmfContainedComponentInstantiateCallback' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_op.cc:240] -> [staging/src/amf/agent/ava_op.cc:241]: (style) Variable 'osaf_cbk.saAmfContainedComponentInstantiateCallback' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_op.cc:241] -> [staging/src/amf/agent/ava_op.cc:242]: (style) Variable 'osaf_cbk.saAmfContainedComponentInstantiateCallback' is reassigned a value before the old one has been used. [staging/src/amf/agent/ava_op.cc:120]: (style) The scope of the variable 'cb' can be reduced. [staging/src/amf/agent/ava_hdl.cc:888]: (style) The function 'ava_hdl_pend_resp_get' is never used. [staging/src/amf/agent/ava_hdl.cc:820]: (style) The function 'ava_hdl_pend_resp_pop' is never used. [staging/src/amf/agent/ava_mds.cc:1132]: (style) The function 'ava_install_amf_down_cb' is never used. [staging/src/amf/agent/ava_init.cc:50]: (style) The function 'logtrace_init_constructor' is never used. [staging/src/amf/agent/amf_agent.cc:1330]: (style) The function 'saAmfCSIQuiescingComplete' is never used. [staging/src/amf/agent/amf_agent.cc:2719]: (style) The function 'saAmfComponentErrorClear_4' is never used. [staging/src/amf/agent/amf_agent.cc:2631]: (style) The function 'saAmfComponentErrorReport_4' is never used. [staging/src/amf/agent/amf_agent.cc:1256]: (style) The function 'saAmfComponentNameGet' is never used. [staging/src/amf/agent/amf_agent.cc:426]: (style) The function 'saAmfComponentRegister' is never used. [staging/src/amf/agent/amf_agent.cc:588]: (style) The function 'saAmfComponentUnregister' is never used. [staging/src/amf/agent/amf_agent.cc:2698]: (style) The function 'saAmfCorrelationIdsGet' is never used. [staging/src/amf/agent/amf_agent.cc:242]: (style) The function 'saAmfDispatch' is never used. [staging/src/amf/agent/amf_agent.cc:326]: (style) The function 'saAmfFinalize' is never used. [staging/src/amf/agent/amf_agent.cc:2326]: (style) The function 'saAmfHAReadinessStateSet' is never used. [staging/src/amf/agent/amf_agent.cc:1441]: (style) The function 'saAmfHAStateGet' is never used. [staging/src/amf/agent/amf_agent.cc:922]: (style) The function 'saAmfHealthcheckConfirm' is never used. [staging/src/amf/agent/amf_agent.cc:719]: (style) The function 'saAmfHealthcheckStart' is never used. [staging/src/amf/agent/amf_agent.cc:838]: (style) The function 'saAmfHealthcheckStop' is never used. [staging/src/amf/agent/amf_agent.cc:56]: (style) The function 'saAmfInitialize' is never used. [staging/src/amf/agent/amf_agent.cc:2120]: (style) The function 'saAmfInitialize_4' is never used. [staging/src/amf/agent/amf_agent.cc:2835]: (style) The function 'saAmfInitialize_o4' is never used. [staging/src/amf/agent/amf_agent.cc:2261]: (style) The function 'saAmfPmStart_3' is never used. [staging/src/amf/agent/amf_agent.cc:1141]: (style) The function 'saAmfPmStop' is never used. [staging/src/amf/agent/amf_agent.cc:2556]: (style) The function 'saAmfProtectionGroupNotificationFree_4' is never used. [staging/src/amf/agent/amf_agent.cc:1532]: (style) The function 'saAmfProtectionGroupTrack' is never used. [staging/src/amf/agent/amf_agent.cc:1709]: (style) The function 'saAmfProtectionGroupTrackStop' is never used. [staging/src/amf/agent/amf_agent.cc:2354]: (style) The function 'saAmfProtectionGroupTrack_4' is never used. [staging/src/amf/agent/amf_agent.cc:2777]: (style) The function 'saAmfResponse_4' is never used. [staging/src/amf/agent/amf_agent.cc:174]: (style) The function 'saAmfSelectionObjectGet' is never used. (information) Cppcheck cannot find all the include files (use --check-config for details) [staging/src/amf/amfwd/amf_wdog.c:106]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'. [staging/src/amf/amfwd/amf_wdog.c:108]: (style) Obsolete function 'asctime' called. It is recommended to use 'strftime' instead. (information) Cppcheck cannot find all the include files (use --check-config for details) [staging/src/amf/common/d2nmsg.c:272] -> [staging/src/amf/common/d2nmsg.c:273]: (style) Variable 'd_info.mem_list.notification' is reassigned a value before the old one has been used. [staging/src/amf/common/d2nmsg.c:230]: (style) The scope of the variable 'i' can be reduced. [staging/src/amf/common/d2nmsg.c:498]: (style) The scope of the variable 'i' can be reduced. [staging/src/amf/common/n2avamsg.c:495]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [staging/src/amf/common/n2avamsg.c:799]: (style) The function 'avsv_amf_csi_attr_convert' is never used. [staging/src/amf/common/util.c:284]: (style) The function 'avsv_amfcompcategory_to_avsvcomptype' is never used. [staging/src/amf/common/util.c:181]: (style) The function 'avsv_create_association_class_dn' is never used. [staging/src/amf/common/util.c:138]: (style) The function 'avsv_dblist_sahckey_cmp' is never used. [staging/src/amf/common/util.c:110]: (style) The function 'avsv_dblist_saname_cmp' is never used. [staging/src/amf/common/util.c:353]: (style) The function 'avsv_dblist_sastring_cmp' is never used. [staging/src/amf/common/util.c:60]: (style) The function 'avsv_dblist_uns32_cmp' is never used. [staging/src/amf/common/util.c:85]: (style) The function 'avsv_dblist_uns64_cmp' is never used. [staging/src/amf/common/d2nmsg.c:636]: (style) The function 'avsv_dnd_msg_copy' is never used. [staging/src/amf/common/d2nmsg.c:531]: (style) The function 'avsv_dnd_msg_free' is never used. [staging/src/amf/common/n2avamsg.c:77]: (style) The function 'avsv_nd2nd_avnd_msg_free' is never used. [staging/src/amf/common/n2avamsg.c:154]: (style) The function 'avsv_ndnd_avnd_msg_copy' is never used. [staging/src/amf/common/util.c:162]: (style) The function 'avsv_sa_name_is_null' is never used. [staging/src/amf/common/util.c:238]: (style) The function 'avsv_sanamet_init_from_association_dn' is never used. (information) Cppcheck cannot find all the include files (use --check-config for details) diff --git a/src/amf/agent/ava_hdl.cc b/src/amf/agent/ava_hdl.cc --- a/src/amf/agent/ava_hdl.cc +++ b/src/amf/agent/ava_hdl.cc @@ -56,7 +56,6 @@ static bool ava_hdl_cbk_ipc_mbx_del(NCSC uint32_t ava_hdl_init(AVA_HDL_DB *hdl_db) { NCS_PATRICIA_PARAMS param; - uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); memset(¶m, 0, sizeof(NCS_PATRICIA_PARAMS)); @@ -64,7 +63,7 @@ uint32_t ava_hdl_init(AVA_HDL_DB *hdl_db /* init the hdl db tree */ param.key_size = sizeof(uint32_t); - rc = ncs_patricia_tree_init(&hdl_db->hdl_db_anchor, ¶m); + uint32_t rc = ncs_patricia_tree_init(&hdl_db->hdl_db_anchor, ¶m); if (NCSCC_RC_SUCCESS == rc) hdl_db->num = 0; else @@ -417,7 +416,6 @@ uint32_t ava_hdl_cbk_dispatch_one(AVA_CB uint32_t ava_hdl_cbk_dispatch_all(AVA_CB **cb, AVA_HDL_REC **hdl_rec) { AVA_PEND_RESP *list_resp = &(*hdl_rec)->pend_resp; - AVA_PEND_CBK_REC *rec = 0; uint32_t hdl = (*hdl_rec)->hdl; OsafAmfCallbacksT reg_cbk; uint32_t rc = SA_AIS_OK; @@ -428,7 +426,7 @@ uint32_t ava_hdl_cbk_dispatch_all(AVA_CB /* pop all the records from the mailbox & process them */ do { - rec = (AVA_PEND_CBK_REC *)m_NCS_IPC_NON_BLK_RECEIVE(&(*hdl_rec)->callbk_mbx, NULL); + AVA_PEND_CBK_REC *rec = (AVA_PEND_CBK_REC *)m_NCS_IPC_NON_BLK_RECEIVE(&(*hdl_rec)->callbk_mbx, NULL); if (!rec) break; @@ -589,7 +587,6 @@ uint32_t ava_hdl_cbk_dispatch_block(AVA_ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_INFO *info, OsafAmfCallbacksT *reg_cbk) { uint32_t rc = SA_AIS_OK; - uint32_t i; TRACE_ENTER2("CallbackType = %d",info->type); /* invoke the corresponding callback */ @@ -678,7 +675,7 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB if(ava_B4_ver_used(0)) { SaAmfProtectionGroupNotificationBufferT_4 buf ={0}; - for (i = 0 ; i < pg_track->buf.numberOfItems ; i++) { + for (uint32_t i = 0 ; i < pg_track->buf.numberOfItems ; i++) { if (!ava_sanamet_is_valid(&pg_track->buf.notification[i].member.compName)) { rc = SA_AIS_ERR_NAME_TOO_LONG; break; @@ -716,7 +713,7 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB else /* B01 version is used */ { SaAmfProtectionGroupNotificationBufferT buf; - for (i = 0 ; i < pg_track->buf.numberOfItems ; i++) { + for (uint32_t i = 0 ; i < pg_track->buf.numberOfItems ; i++) { if (!ava_sanamet_is_valid(&pg_track->buf.notification[i].member.compName)) { rc = SA_AIS_ERR_NAME_TOO_LONG; break; @@ -738,7 +735,7 @@ uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CB /* allocate LongDn strings for notification if any * then client needs to free these LongDn string as well */ - for (i=0 ; i < buf.numberOfItems; i++) { + for (uint32_t i=0 ; i < buf.numberOfItems; i++) { osaf_extended_name_alloc( osaf_extended_name_borrow(&pg_track->buf.notification[i].member.compName), &buf.notification[i].member.compName); diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc --- a/src/amf/agent/ava_mds.cc +++ b/src/amf/agent/ava_mds.cc @@ -83,11 +83,10 @@ uint32_t ava_mds_reg(AVA_CB *cb) { NCSMDS_INFO mds_info; MDS_SVC_ID svc_id; - uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); /* get the mds-hdl & ava mds address */ - rc = ava_mds_param_get(cb); + uint32_t rc = ava_mds_param_get(cb); if (NCSCC_RC_SUCCESS != rc) { LOG_ER("Unable to get MDS handle"); return NCSCC_RC_FAILURE; @@ -146,7 +145,6 @@ uint32_t ava_mds_reg(AVA_CB *cb) uint32_t ava_mds_unreg(AVA_CB *cb) { NCSMDS_INFO mds_info; - uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); memset(&mds_info, 0, sizeof(NCSMDS_INFO)); @@ -155,7 +153,7 @@ uint32_t ava_mds_unreg(AVA_CB *cb) mds_info.i_svc_id = NCSMDS_SVC_ID_AVA; mds_info.i_op = MDS_UNINSTALL; - rc = ncsmds_api(&mds_info); + uint32_t rc = ncsmds_api(&mds_info); TRACE_LEAVE2("retval = %u",rc); return rc; @@ -1017,7 +1015,6 @@ uint32_t ava_mds_msg_syn_send(AVA_CB *cb uint32_t ava_mds_param_get(AVA_CB *cb) { NCSADA_INFO ada_info; - uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); memset(&ada_info, 0, sizeof(ada_info)); @@ -1025,7 +1022,7 @@ uint32_t ava_mds_param_get(AVA_CB *cb) ada_info.req = NCSADA_GET_HDLS; /* invoke ada request */ - rc = ncsada_api(&ada_info); + uint32_t rc = ncsada_api(&ada_info); if (NCSCC_RC_SUCCESS != rc) { TRACE_2("MDS Get handle request failed"); goto done; @@ -1100,11 +1097,10 @@ uint32_t ava_mds_dec(AVA_CB *cb, MDS_CAL uint32_t ava_mds_enc(AVA_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { EDU_ERR ederror = static_cast<EDU_ERR>(0); - AVSV_NDA_AVA_MSG *msg = NULL; uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); - msg = (AVSV_NDA_AVA_MSG *)enc_info->i_msg; + AVSV_NDA_AVA_MSG *msg = (AVSV_NDA_AVA_MSG *)enc_info->i_msg; switch (msg->type) { case AVSV_AVA_API_MSG: diff --git a/src/amf/agent/ava_op.cc b/src/amf/agent/ava_op.cc --- a/src/amf/agent/ava_op.cc +++ b/src/amf/agent/ava_op.cc @@ -117,7 +117,6 @@ uint32_t ava_avnd_msg_prc(AVA_CB *cb, AV ******************************************************************************/ bool ava_B4_ver_used(AVA_CB *in_cb) { - AVA_CB *cb = 0; bool rc = false; if(in_cb) { @@ -125,8 +124,7 @@ bool ava_B4_ver_used(AVA_CB *in_cb) rc = true; } else { - - cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl); + AVA_CB *cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl); if(cb) { if((cb->version.releaseCode == 'B') && (cb->version.majorVersion == 0x04)) @@ -219,7 +217,7 @@ void amf_copy_from_SaAmfCallbacksT_4_to_ osaf_cbk->saAmfProxiedComponentInstantiateCallback = cbk->saAmfProxiedComponentInstantiateCallback; osaf_cbk->saAmfProxiedComponentCleanupCallback = cbk->saAmfProxiedComponentCleanupCallback; osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; + osaf_cbk->saAmfContainedComponentCleanupCallback = cbk->saAmfContainedComponentCleanupCallback; } /* @@ -238,7 +236,6 @@ void amf_copy_from_SaAmfCallbacksT_o4_to osaf_cbk->saAmfProxiedComponentInstantiateCallback = cbk->saAmfProxiedComponentInstantiateCallback; osaf_cbk->saAmfProxiedComponentCleanupCallback = cbk->saAmfProxiedComponentCleanupCallback; osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->saAmfContainedComponentInstantiateCallback = cbk->saAmfContainedComponentInstantiateCallback; - osaf_cbk->osafCsiAttributeChangeCallback = cbk->osafCsiAttributeChangeCallback; + osaf_cbk->saAmfContainedComponentCleanupCallback = cbk->saAmfContainedComponentCleanupCallback; + osaf_cbk->osafCsiAttributeChangeCallback = cbk->osafCsiAttributeChangeCallback; } diff --git a/src/amf/amfwd/amf_wdog.c b/src/amf/amfwd/amf_wdog.c --- a/src/amf/amfwd/amf_wdog.c +++ b/src/amf/amfwd/amf_wdog.c @@ -104,7 +104,7 @@ static void amf_healthcheck_callback(SaI osafassert(tstamp_data); snprintf(latest_healthcheck_trace, sizeof(latest_healthcheck_trace), - "Last received healthcheck cnt=%u at %s", + "Last received healthcheck cnt=%d at %s", healthcheck_count, asctime(tstamp_data)); rc = saAmfResponse(amf_hdl, inv, SA_AIS_OK); diff --git a/src/amf/common/d2nmsg.c b/src/amf/common/d2nmsg.c --- a/src/amf/common/d2nmsg.c +++ b/src/amf/common/d2nmsg.c @@ -227,10 +227,9 @@ static uint32_t cpy_d2n_susi_msg(AVSV_DN static void free_d2n_pg_msg_info(AVSV_DND_MSG *pg_msg) { AVSV_D2N_PG_TRACK_ACT_RSP_MSG_INFO *info = &pg_msg->msg_info.d2n_pg_track_act_rsp; - uint16_t i; if (info->mem_list.numberOfItems) { - for (i = 0; i< info->mem_list.numberOfItems; i++) { + for (uint16_t i = 0; i< info->mem_list.numberOfItems; i++) { osaf_extended_name_free(&info->mem_list.notification[i].member.compName); } free(info->mem_list.notification); @@ -269,7 +268,6 @@ static uint32_t cpy_d2n_pg_msg(AVSV_DND_ return NCSCC_RC_SUCCESS; /* alloc the memory for the notify buffer */ - d_info->mem_list.notification = 0; d_info->mem_list.notification = (SaAmfProtectionGroupNotificationT *) malloc(sizeof(SaAmfProtectionGroupNotificationT) * s_info->mem_list.numberOfItems); if (!d_info->mem_list.notification) @@ -495,13 +493,12 @@ static uint32_t cpy_d2n_comp_msg(AVSV_DN static void free_d2n_compcsi_info(AVSV_DND_MSG *compcsi_msg) { - uint16_t i; AVSV_D2N_COMPCSI_ASSIGN_MSG_INFO *compcsi = &compcsi_msg->msg_info.d2n_compcsi_assign_msg_info; osaf_extended_name_free(&compcsi->comp_name); osaf_extended_name_free(&compcsi->csi_name); if (compcsi->info.attrs.list != NULL) { - for (i = 0; i < compcsi->info.attrs.number; i++) { + for (uint16_t i = 0; i < compcsi->info.attrs.number; i++) { osaf_extended_name_free(&compcsi->info.attrs.list[i].name); osaf_extended_name_free(&compcsi->info.attrs.list[i].value); free(compcsi->info.attrs.list[i].string_ptr); diff --git a/src/amf/common/n2avamsg.c b/src/amf/common/n2avamsg.c --- a/src/amf/common/n2avamsg.c +++ b/src/amf/common/n2avamsg.c @@ -492,7 +492,6 @@ void avsv_amf_cbk_free(AVSV_AMF_CBK_INFO /* free the cbk-info ptr */ free(cbk_info); - cbk_info = NULL; return; } diff --git a/src/amf/tools/amf_pm.c b/src/amf/tools/amf_pm.c --- a/src/amf/tools/amf_pm.c +++ b/src/amf/tools/amf_pm.c @@ -142,7 +142,6 @@ int main(int argc, char **argv) SaUint64T processId = 0; bool start = false; bool stop = false; - int c; struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"file", required_argument, 0, 'f'}, @@ -159,9 +158,8 @@ int main(int argc, char **argv) SaAmfRecommendedRecoveryT recrec = SA_AMF_NO_RECOMMENDATION; char name[2048]; int length; - while (1) { - c = getopt_long(argc, argv, "af:p:hor:", long_options, NULL); + int c = getopt_long(argc, argv, "af:p:hor:", long_options, NULL); if (c == -1) /* have all command-line options have been parsed? */ break; ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel