Hi Mahesh,

Ok. I have no comment with your fix for cppcheck 1.77's report.

Regards, Vu

> -----Original Message-----
> From: A V Mahesh [mailto:[email protected]]
> Sent: Tuesday, March 7, 2017 5:11 AM
> To: Vu Minh Nguyen <[email protected]>;
> [email protected]; [email protected]
> Cc: [email protected]
> Subject: Re: [PATCH 1 of 1] log: Fix all Cppcheck 1.77 issues [#2326] V1
> 
>   Hi Vu,
> 
>   I did check, LOG code still using lgs_cb as structure not as a class,
> may that conversion we can address in a separate new #ticket,
>   and fixing that issue in Cppcheck 1.77 errors doesn't look appropriate
> even.
> 
>   If you don't have any other comments specific  to  Cppcheck 1.77
> errors, as if i have already recive ACK for Lennart  and  Canh
>   I would lie to push .
> 
> -AVM
> 
> On 3/6/2017 8:48 AM, A V Mahesh wrote:
> > Hi Vu,
> >
> > Ok I will check & match with other DB definitions .
> >
> > -AVM
> >
> >
> > On 3/3/2017 12:49 PM, Vu Minh Nguyen wrote:
> >> Hi Mahesh,
> >>
> >> In #1984 ticket, I had comments on clientMap data type, have you looked
> >> them?:
> >>
> >>> +extern void *client_db;       /* used for C++ STL map */
> >> [Vu] Any reason not using ClientMap* client_db?
> >>
> >>> +  /* Loop through Client DB */
> >>> +  ClientMap *clientMap(reinterpret_cast<ClientMap *>(client_db));
> >> [Vu] Any reason why not using "ClientMap* client_db" to avoid typecast?
> >>
> >> Regards, Vu
> >>
> >>> -----Original Message-----
> >>> From: [email protected] [mailto:[email protected]]
> >>> Sent: Thursday, March 2, 2017 11:16 AM
> >>> To: [email protected]; [email protected];
> >>> [email protected]
> >>> Cc: [email protected]
> >>> Subject: [PATCH 1 of 1] log: Fix all Cppcheck 1.77 issues [#2326] V1
> >>>
> >>>   src/log/agent/lga_api.c      |   3 +--
> >>>   src/log/agent/lga_mds.c      |   6 ++----
> >>>   src/log/agent/lga_state.c    |   3 +--
> >>>   src/log/agent/lga_util.c     |   4 +---
> >>>   src/log/logd/lgs_clm.cc      |   8 +++-----
> >>>   src/log/logd/lgs_config.cc   |  36
> >>> +++++++++++++++++-------------------
> >>>   src/log/logd/lgs_config.h    |  10 +++++-----
> >>>   src/log/logd/lgs_evt.cc      |  17 +++++++----------
> >>>   src/log/logd/lgs_filehdl.cc  |   4 ----
> >>>   src/log/logd/lgs_fmt.cc      |   3 +--
> >>>   src/log/logd/lgs_imm.cc      |  25 ++++++++++++-------------
> >>>   src/log/logd/lgs_imm_gcfg.cc |  21 +++++++--------------
> >>>   src/log/logd/lgs_main.cc     |   2 +-
> >>>   src/log/logd/lgs_mbcsv.cc    |  21 ++++++++-------------
> >>>   src/log/logd/lgs_mds.cc      |   3 +--
> >>>   src/log/logd/lgs_stream.cc   |   6 ++----
> >>>   src/log/logd/lgs_util.cc     |  10 ++++------
> >>>   17 files changed, 73 insertions(+), 109 deletions(-)
> >>>
> >>>
> >>> V1 is on 5.2 GA tag
> >>> Except never used functions all other issues are fixed  of below,
> >>> some UN-pushed enhancement may be using those functions.
> >>>
> >>>
> ==============================================================
> >>> ========================
> >>> [staging/src/log/logd/lgs_config.h:90]: (performance) Function
> >>> parameter
> >>> param_name should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.h:230]: (performance) Function
> >>> parameter
> >>> attribute_name should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.h:231]: (performance) Function
> >>> parameter
> >>> value_list should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.h:238]: (performance) Function
> >>> parameter
> >>> attribute_name should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.h:239]: (performance) Function
> >>> parameter
> >>> value_list should be passed by reference.
> >>> [staging/src/log/logd/lgs_clm.cc:137]: (style) The scope of the
> >>> variable
> >>> clm_node can be reduced.
> >>> [staging/src/log/logd/lgs_clm.cc:220]: (performance) Prefer prefix
> >>> ++/--
> >>> operators for non-primitive types.
> >>> [staging/src/log/logd/lgs_config.cc:401] ->
> >>> [staging/src/log/logd/lgs_config.cc:498]: (warning) Either the
> >>> condition
> >>> allocmem_ptr!=NULL is redundant or there is possible null pointer
> >>> dereference: param_ptr.
> >>> [staging/src/log/logd/lgs_config.cc:410] ->
> >>> [staging/src/log/logd/lgs_config.cc:498]: (warning) Either the
> >>> condition
> >>> allocmem_ptr!=NULL is redundant or there is possible null pointer
> >>> dereference: param_ptr.
> >>> [staging/src/log/logd/lgs_config.cc:184] ->
> >>> [staging/src/log/logd/lgs_config.cc:190]: (style) Variable
> >>> cfg_param_str
> >> is
> >>> reassigned a value before the old one has been used.
> >>> [staging/src/log/logd/lgs_config.cc:183]: (style) The scope of the
> >> variable
> >>> prev_size can be reduced.
> >>> [staging/src/log/logd/lgs_config.cc:727]: (style) The scope of the
> >> variable
> >>> nl_cnt can be reduced.
> >>> [staging/src/log/logd/lgs_config.cc:995]: (style) The scope of the
> >> variable
> >>> value_string can be reduced.
> >>> [staging/src/log/logd/lgs_config.cc:1034]: (style) The scope of the
> >> variable n
> >>> can be reduced.
> >>> [staging/src/log/logd/lgs_config.cc:142]: (warning) Member variable
> >>> _lgs_conf_t::chkp_file_close_time is not initialized in the
> >>> constructor.
> >>> [staging/src/log/logd/lgs_config.cc:293]: (performance) Function
> >>> parameter
> >>> attribute_name should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.cc:294]: (performance) Function
> >>> parameter
> >>> value_list should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.cc:324]: (performance) Function
> >>> parameter
> >>> attribute_name should be passed by reference.
> >>> [staging/src/log/logd/lgs_config.cc:325]: (performance) Function
> >>> parameter
> >>> value_list should be passed by reference.
> >>> [staging/src/log/logd/lgs_evt.cc:531] ->
> >>> [staging/src/log/logd/lgs_evt.cc:536]: (style) Variable lga_down_rec
is
> >>> reassigned a value before the old one has been used.
> >>> [staging/src/log/logd/lgs_evt.cc:416]: (style) The scope of the
> >>> variable
> >>> ckpt_ptr can be reduced.
> >>> [staging/src/log/logd/lgs_evt.cc:553]: (style) The scope of the
> >>> variable
> >>> stream can be reduced.
> >>> [staging/src/log/logd/lgs_evt.cc:163]: (error) Mismatching
> >>> allocation and
> >>> deallocation: client
> >>> [staging/src/log/logd/lgs_evt.cc:168]: (error) Mismatching
> >>> allocation and
> >>> deallocation: client
> >>> [staging/src/log/logd/lgs_evt.cc:344]: (performance) Prefer prefix
> >>> ++/--
> >>> operators for non-primitive types.
> >>> [staging/src/log/logd/lgs_filehdl.cc:542]: (style) Variable len is
> >> assigned a
> >>> value that is never used.
> >>> [staging/src/log/logd/lgs_fmt.cc:560]: (style) The scope of the
> >>> variable
> >>> no_ch can be reduced.
> >>> [staging/src/log/logd/lgs_imm.cc:3478] ->
> >>> [staging/src/log/logd/lgs_imm.cc:3479]: (warning) Either the condition
> >>> attribute!=NULL is redundant or there is possible null pointer
> >> dereference:
> >>> attribute.
> >>> [staging/src/log/logd/lgs_imm.cc:963]: (style) The scope of the
> >>> variable i
> >> can
> >>> be reduced.
> >>> [staging/src/log/logd/lgs_imm.cc:1885]: (style) The scope of the
> >>> variable
> >>> current_time can be reduced.
> >>> [staging/src/log/logd/lgs_imm.cc:1924]: (style) The scope of the
> >>> variable
> >>> stream can be reduced.
> >>> [staging/src/log/logd/lgs_imm.cc:3264]: (style) The scope of the
> >>> variable
> >>> name_str can be reduced.
> >>> [staging/src/log/logd/lgs_imm.cc:3474]: (style) The scope of the
> >>> variable
> >>> value can be reduced.
> >>> [staging/src/log/logd/lgs_imm_gcfg.cc:857] ->
> >>> [staging/src/log/logd/lgs_imm_gcfg.cc:859]: (style) Variable rc is
> >> reassigned
> >>> a value before the old one has been used.
> >>> [staging/src/log/logd/lgs_imm_gcfg.cc:532]: (style) The scope of the
> >>> variable name_len can be reduced.
> >>> [staging/src/log/logd/lgs_imm_gcfg.cc:940]: (style) The scope of the
> >>> variable rc can be reduced.
> >>> [staging/src/log/logd/lgs_main.cc:319]: (style) Suspicious condition
> >>> (assignment + comparison); Clarify expression with parentheses.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:214]: (style) Suspicious condition
> >>> (assignment + comparison); Clarify expression with parentheses.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:541] ->
> >>> [staging/src/log/logd/lgs_mbcsv.cc:551]: (style) Variable rc is
> >>> reassigned
> >> a
> >>> value before the old one has been used.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:695] ->
> >>> [staging/src/log/logd/lgs_mbcsv.cc:702]: (style) Variable pheader is
> >>> reassigned a value before the old one has been used.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:938] ->
> >>> [staging/src/log/logd/lgs_mbcsv.cc:941]: (style) Variable rc is
> >>> reassigned
> >> a
> >>> value before the old one has been used.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:1125] ->
> >>> [staging/src/log/logd/lgs_mbcsv.cc:1148]: (style) Variable rc is
> >> reassigned a
> >>> value before the old one has been used.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:1875]: (style) Checking if unsigned
> >>> variable clientId is less than zero.
> >>> [staging/src/log/logd/lgs_mbcsv.cc:711]: (performance) Prefer prefix
> >>> ++/--
> >>> operators for non-primitive types.
> >>> [staging/src/log/logd/lgs_mds.cc:1003] ->
> >>> [staging/src/log/logd/lgs_mds.cc:1009]: (style) Variable rc is
> >>> reassigned
> >> a
> >>> value before the old one has been used.
> >>> [staging/src/log/logd/lgs_stream.cc:416]: (warning) Assignment of
> >>> function
> >>> parameter has no effect outside the function. Did you forget
> >>> dereferencing
> >>> it?
> >>> [staging/src/log/logd/lgs_stream.cc:665] ->
> >>> [staging/src/log/logd/lgs_stream.cc:669]: (style) Variable stream is
> >>> reassigned a value before the old one has been used.
> >>> [staging/src/log/logd/lgs_stream.cc:1337]: (style) Unsigned variable
id
> >> cant
> >>> be negative so it is unnecessary to test it.
> >>> [staging/src/log/logd/lgs_util.cc:363]: (performance) Prefer prefix
> >>> ++/--
> >>> operators for non-primitive types.
> >>> [staging/src/log/logd/lgs_util.cc:912]: (performance) Prefer prefix
> >>> ++/--
> >>> operators for non-primitive types.
> >>> [staging/src/log/logd/lgs_config.cc:1854]: (style) The function
> >>> lgs_cfg_read_trace is never used.
> >>> [staging/src/log/logd/lgs_util.cc:521]: (style) The function
> >>> lgs_check_path_exists_h is never used.
> >>> [staging/src/log/logd/lgs_imm.cc:3234]: (style) The function
> >>> lgs_delete_one_stream_object is never used.
> >>> [staging/src/log/logd/lgs_stream.cc:408]: (style) The function
> >>> log_free_stream_resources is never used.
> >>> [staging/src/log/logd/lgs_stream.cc:1447]: (style) The function
> >>> log_stream_id_print is never used.
> >>> [staging/src/log/logd/lgs_config.cc:1513]: (style) The function
> >>> update_multival_rattr is never used.
> >>> (information) Cppcheck cannot find all the include files (use
> >> --check-config
> >>> for details)
> >>> [staging/src/log/agent/lga_api.c:1104] ->
> >>> [staging/src/log/agent/lga_api.c:1106]: (style) Variable
> >>> logSvcUsrChars is
> >>> reassigned a value before the old one has been used.
> >>> [staging/src/log/agent/lga_mds.c:1408] ->
> >>> [staging/src/log/agent/lga_mds.c:1428]: (style) Variable rc is
> >>> reassigned
> >> a
> >>> value before the old one has been used.
> >>> [staging/src/log/agent/lga_mds.c:1219]: (style) The scope of the
> >>> variable
> >> rc
> >>> can be reduced.
> >>> [staging/src/log/agent/lga_state.c:412] ->
> >>> [staging/src/log/agent/lga_state.c:421]: (style) Variable ncs_rc is
> >> reassigned
> >>> a value before the old one has been used.
> >>> [staging/src/log/agent/lga_util.c:312] ->
> >>> [staging/src/log/agent/lga_util.c:317]: (style) Variable client_hdl is
> >>> reassigned a value before the old one has been used.
> >>> [staging/src/log/agent/lga_util.c:416]: (style) The function
> >>> lga_force_shutdown is never used.
> >>> [staging/src/log/agent/lga_util.c:890]: (style) The function
> >>> logtrace_init_constructor is never used.
> >>> [staging/src/log/agent/lga_api.c:419]: (style) The function
> >>> saLogDispatch
> >> is
> >>> never used.
> >>> [staging/src/log/agent/lga_api.c:538]: (style) The function
> >>> saLogFinalize
> >> is
> >>> never used.
> >>> [staging/src/log/agent/lga_api.c:165]: (style) The function
> >> saLogInitialize is
> >>> never used.
> >>> [staging/src/log/agent/lga_api.c:1529]: (style) The function
> >>> saLogLimitGet
> >> is
> >>> never used.
> >>> [staging/src/log/agent/lga_api.c:351]: (style) The function
> >>> saLogSelectionObjectGet is never used.
> >>> [staging/src/log/agent/lga_api.c:1373]: (style) The function
> >>> saLogStreamClose is never used.
> >>> [staging/src/log/agent/lga_api.c:1026]: (style) The function
> >>> saLogStreamOpenAsync_2 is never used.
> >>> [staging/src/log/agent/lga_api.c:798]: (style) The function
> >>> saLogStreamOpen_2 is never used.
> >>> [staging/src/log/agent/lga_api.c:1164]: (style) The function
> >>> saLogWriteLog
> >>> is never used.
> >>> [staging/src/log/agent/lga_api.c:1180]: (style) The function
> >>> saLogWriteLogAsync is never used.
> >>>
> ==============================================================
> >>>
> ==============================================================
> >>> =====
> >>>
> >>> diff --git a/src/log/agent/lga_api.c b/src/log/agent/lga_api.c
> >>> --- a/src/log/agent/lga_api.c
> >>> +++ b/src/log/agent/lga_api.c
> >>> @@ -1101,9 +1101,8 @@ static SaAisErrorT handle_log_record(con
> >>>          Section 3.6.3, Return Values */
> >>>       if (logRecord->logHdrType == SA_LOG_GENERIC_HEADER) {
> >>>           if (logRecord->logHeader.genericHdr.logSvcUsrName ==
> >>> NULL) {
> >>> -            char *logSvcUsrChars = NULL;
> >>>               TRACE("logSvcUsrName == NULL");
> >>> -            logSvcUsrChars =
> >>> getenv("SA_AMF_COMPONENT_NAME");
> >>> +            char *logSvcUsrChars =
> >>> getenv("SA_AMF_COMPONENT_NAME");
> >>>               if (logSvcUsrChars == NULL) {
> >>>                   ais_rc = SA_AIS_ERR_INVALID_PARAM;
> >>>                   goto done;
> >>> diff --git a/src/log/agent/lga_mds.c b/src/log/agent/lga_mds.c
> >>> --- a/src/log/agent/lga_mds.c
> >>> +++ b/src/log/agent/lga_mds.c
> >>> @@ -1216,7 +1216,6 @@ static uint32_t lga_mds_cpy(struct ncsmd
> >>>
> >>>   static uint32_t lga_mds_callback(struct ncsmds_callback_info *info)
> >>>   {
> >>> -    uint32_t rc;
> >>>
> >>>       static NCSMDS_CALLBACK_API cb_set[MDS_CALLBACK_SVC_MAX] =
> >>> {
> >>>           lga_mds_cpy,    /* MDS_CALLBACK_COPY      0 */
> >>> @@ -1229,7 +1228,7 @@ static uint32_t lga_mds_callback(struct
> >>>       };
> >>>
> >>>       if (info->i_op <= MDS_CALLBACK_SVC_EVENT) {
> >>> -        rc = (*cb_set[info->i_op]) (info);
> >>> +        uint32_t rc = (*cb_set[info->i_op]) (info);
> >>>           if (rc != NCSCC_RC_SUCCESS)
> >>>               TRACE("MDS_CALLBACK_SVC_EVENT not in range");
> >>>
> >>> @@ -1405,7 +1404,6 @@ uint32_t lga_mds_msg_sync_send(lga_cb_t
> >>>   uint32_t lga_mds_msg_async_send(lga_cb_t *cb, struct lgsv_msg
> *i_msg,
> >>> uint32_t prio)
> >>>   {
> >>>       NCSMDS_INFO mds_info;
> >>> -    uint32_t rc = NCSCC_RC_SUCCESS;
> >>>
> >>>       TRACE_ENTER();
> >>>       osafassert(cb != NULL && i_msg != NULL);
> >>> @@ -1425,7 +1423,7 @@ uint32_t lga_mds_msg_async_send(lga_cb_t
> >>>       mds_info.info.svc_send.info.snd.i_to_dest = cb->lgs_mds_dest;
> >>>
> >>>       /* send the message */
> >>> -    rc = ncsmds_api(&mds_info);
> >>> +    uint32_t rc = ncsmds_api(&mds_info);
> >>>       if (rc != NCSCC_RC_SUCCESS) {
> >>>           TRACE("%s: async send failed", __FUNCTION__);
> >>>       }
> >>> diff --git a/src/log/agent/lga_state.c b/src/log/agent/lga_state.c
> >>> --- a/src/log/agent/lga_state.c
> >>> +++ b/src/log/agent/lga_state.c
> >>> @@ -409,7 +409,6 @@ done:
> >>>   static int start_recovery2_thread(void)
> >>>   {
> >>>       int rc = 0;
> >>> -    uint32_t ncs_rc = NCSCC_RC_SUCCESS;
> >>>       pthread_attr_t attr;
> >>>
> >>>       TRACE_ENTER();
> >>> @@ -418,7 +417,7 @@ static int start_recovery2_thread(void)
> >>>       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
> >>>
> >>>       /* Create a selection object for signaling the recovery2
> >>> thread */
> >>> -    ncs_rc = ncs_sel_obj_create(&state2_terminate_sel_obj);
> >>> +    uint32_t ncs_rc = ncs_sel_obj_create(&state2_terminate_sel_obj);
> >>>       if (ncs_rc != NCSCC_RC_SUCCESS) {
> >>>           TRACE("%s ncs_sel_obj_create Fail", __FUNCTION__);
> >>>           rc = -1;
> >>> diff --git a/src/log/agent/lga_util.c b/src/log/agent/lga_util.c
> >>> --- a/src/log/agent/lga_util.c
> >>> +++ b/src/log/agent/lga_util.c
> >>> @@ -309,12 +309,10 @@ static uint32_t lga_hdl_cbk_dispatch_blo
> >>>    */
> >>>   static void lga_free_client_hdl(lga_client_hdl_rec_t **p_client_hdl)
> >>>   {
> >>> -    lga_client_hdl_rec_t *client_hdl = NULL;
> >>> -
> >>>       /* Synchronize b/w client & mds thread */
> >>>       osaf_mutex_lock_ordie(&lga_cb.cb_lock);
> >>>
> >>> -    client_hdl = *p_client_hdl;
> >>> +    lga_client_hdl_rec_t *client_hdl = *p_client_hdl;
> >>>       if (client_hdl == NULL) goto done;
> >>>
> >>>       free(client_hdl);
> >>> diff --git a/src/log/logd/lgs_clm.cc b/src/log/logd/lgs_clm.cc
> >>> --- a/src/log/logd/lgs_clm.cc
> >>> +++ b/src/log/logd/lgs_clm.cc
> >>> @@ -134,7 +134,6 @@ static uint32_t lgs_clm_node_add(NODE_ID
> >>>   static uint32_t lgs_clm_node_del(NODE_ID clm_node_id) {
> >>>     TRACE_ENTER();
> >>>     uint32_t rc;
> >>> -  lgs_clm_node_t *clm_node;
> >>>
> >>>     ClmNodeMap *clmNodeMap(reinterpret_cast<ClmNodeMap *>
> >>>                            (clm_node_db));
> >>> @@ -143,7 +142,7 @@ static uint32_t lgs_clm_node_del(NODE_ID
> >>>       auto it = (clmNodeMap->find(clm_node_id));
> >>>
> >>>       if (it != clmNodeMap->end()) {
> >>> -      clm_node = it->second;
> >>> +      lgs_clm_node_t *clm_node = it->second;
> >>>         clmNodeMap->erase(it);
> >>>         delete clm_node;
> >>>         rc = NCSCC_RC_SUCCESS;
> >>> @@ -216,9 +215,8 @@ static uint32_t send_cluster_membership_
> >>>     TRACE_3("clm_node_id: %x, change:%u", clm_node_id,
> clusterChange);
> >>>     /* Loop through Client DB */
> >>>     ClientMap *clientMap(reinterpret_cast<ClientMap *>(client_db));
> >>> -  ClientMap::iterator pos;
> >>> -  for (pos = clientMap->begin(); pos != clientMap->end(); pos++) {
> >>> -    rec = pos->second;
> >>> +  for (const auto& value : *clientMap) {
> >>> +    rec =  value.second;
> >>>       NODE_ID tmp_clm_node_id =
> m_LGS_GET_NODE_ID_FROM_ADEST(rec-
> >>>> mds_dest);
> >>>       //  Do not send to A11 client. Send only to specific Node
> >>>       if (tmp_clm_node_id == clm_node_id)
> >>> diff --git a/src/log/logd/lgs_config.cc b/src/log/logd/lgs_config.cc
> >>> --- a/src/log/logd/lgs_config.cc
> >>> +++ b/src/log/logd/lgs_config.cc
> >>> @@ -123,7 +123,7 @@ typedef struct _lgs_conf_t {
> >>>     std::vector<std::string> logRecordDestinationStatus; // Default
> >>> empty
> >>>
> >>>     /* Used for checkpointing time when files are closed */
> >>> -  time_t chkp_file_close_time;
> >>> +  time_t chkp_file_close_time = 0;
> >>>
> >>>     bool OpenSafLogConfig_object_exist;
> >>>
> >>> @@ -181,14 +181,12 @@ static int verify_all_init();
> >>>   void lgs_cfgupd_list_create(const char *name_str, char *value_str,
> >>>                               lgs_config_chg_t *config_data) {
> >>>     char *tmp_char_ptr = NULL;
> >>> -  size_t prev_size = 0;
> >>> -  char *cfg_param_str = NULL;
> >>>     size_t cfg_size = 0;
> >>>
> >>>     TRACE_ENTER2("name_str '%s', value_str \"%s\"", name_str,
> >>> value_str);
> >>>
> >>>     cfg_size = strlen(name_str) + strlen(value_str) + 2;
> >>> -  cfg_param_str = static_cast<char *>(malloc(cfg_size));
> >>> +  char *cfg_param_str = static_cast<char *>(malloc(cfg_size));
> >>>     if (cfg_param_str == NULL) {
> >>>       TRACE("%s: malloc Fail Aborted", __FUNCTION__);
> >>>       osaf_abort(0);
> >>> @@ -218,7 +216,7 @@ void lgs_cfgupd_list_create(const char *
> >>>         osaf_abort(0);
> >>>       }
> >>>
> >>> -    prev_size = config_data->ckpt_buffer_size;
> >>> +    size_t prev_size = config_data->ckpt_buffer_size;
> >>>       config_data->ckpt_buffer_ptr = tmp_char_ptr;
> >>>       config_data->ckpt_buffer_size = alloc_size;
> >>>       /* Add config data directly after the previous data */
> >>> @@ -291,8 +289,8 @@ static bool is_value_in_vector(const std
> >>>     }
> >>>     return rc;
> >>>   }
> >>> -void lgs_cfgupd_multival_delete(const std::string attribute_name,
> >>> -                                const std::vector<std::string>
> >> value_list,
> >>> +void lgs_cfgupd_multival_delete(const std::string& attribute_name,
> >>> +                                const std::vector<std::string>&
> >> value_list,
> >>> lgs_config_chg_t *config_data) {
> >>>     TRACE_ENTER();
> >>>     // Get the existing multi-values
> >>> @@ -322,8 +320,8 @@ void lgs_cfgupd_multival_delete(const st
> >>>    * Replace all existing values in the multi value attribute with the
> >> values in
> >>>    * the list
> >>>    */
> >>> -void lgs_cfgupd_mutival_replace(const std::string attribute_name,
> >>> -                                const std::vector<std::string>
> >> value_list,
> >>> +void lgs_cfgupd_mutival_replace(const std::string& attribute_name,
> >>> +                                const std::vector<std::string>&
> >> value_list,
> >>> lgs_config_chg_t *config_data) {
> >>>     TRACE_ENTER();
> >>>
> >>> @@ -398,6 +396,11 @@ int lgs_cfg_update(const lgs_config_chg_
> >>>      * original config_data must not be changed.
> >>>      */
> >>>     allocmem_ptr = static_cast<char *>(calloc(1,config_data-
> >>>> ckpt_buffer_size));
> >>> +  if (allocmem_ptr == nullptr) {
> >>> +    LOG_ER("%s: calloc Fail, Aborted", __FUNCTION__);
> >>> +    osaf_abort(0);
> >>> +  }
> >>> +
> >>>     param_ptr = allocmem_ptr;
> >>>     (void) memcpy(param_ptr, config_data->ckpt_buffer_ptr,
> config_data-
> >>>> ckpt_buffer_size);
> >>> @@ -496,8 +499,7 @@ int lgs_cfg_update(const lgs_config_chg_
> >>>       rc = -1;
> >>>     }
> >>>
> >>> -  if (allocmem_ptr != NULL)
> >>> -    free(allocmem_ptr);
> >>> +  free(allocmem_ptr);
> >>>
> >>>   done:
> >>>     TRACE_LEAVE();
> >>> @@ -724,10 +726,9 @@ const char kSemicolon[] = ";";
> >>>   // no more, no less.
> >>>   //
> >>>   bool is_right_destination_fmt(const VectorString& vdest) {
> >>> -  int nl_cnt = 0;
> >>>     // Check each single destination
> >>>     for (const auto& it : vdest) {
> >>> -    nl_cnt = std::count(it.begin(), it.end(), ';');
> >>> +    int nl_cnt = std::count(it.begin(), it.end(), ';');
> >>>       if (nl_cnt != 2) {
> >>>         TRACE("%s wrong destination format", __func__);
> >>>         return false;
> >>> @@ -822,8 +823,7 @@ bool check_configuration_duplicated(cons
> >>>       // in adding destination configurations and existing ones.
> >>>       // Firstly, check if any duplicate in added items.
> >>>       if (vdest.size() > 1) {
> >>> -      bool isNoDuplicated = true;
> >>> -      isNoDuplicated = is_no_config_duplicated(vdest, vdest);
> >>> +      bool isNoDuplicated = is_no_config_duplicated(vdest, vdest);
> >>>         if (isNoDuplicated == false) return false;
> >>>       }
> >>>       // Secondly, check if any duplicate in added items with existing
> >> list.
> >>> @@ -1112,10 +1112,9 @@ static void read_logsv_config_obj_2() {
> >>>       } else if (!strcmp(attribute->attrName,
> >>> LOG_RECORD_DESTINATION_CONFIGURATION)) {
> >>>         // Note: Multi value
> >>> -      char *value_string;
> >>>         for (uint32_t i = 0; i < attribute->attrValuesNumber; i++) {
> >>>           value = attribute->attrValues[i];
> >>> -        value_string = *(reinterpret_cast<char **>(value));
> >>> +        char *value_string = *(reinterpret_cast<char **>(value));
> >>>
> >> lgs_conf.logRecordDestinationConfiguration.push_back(value_string);
> >>>           TRACE("Conf obj; logRecordDestinationConfiguration: '%s'",
> >>> lgs_conf.logRecordDestinationConfiguration.back().c_str());
> >>> @@ -1151,7 +1150,6 @@ done:
> >>>   static void read_log_config_environ_var_2() {
> >>>     char *val_str;
> >>>     unsigned long int val_uint;
> >>> -  int n;
> >>>
> >>>     TRACE_ENTER();
> >>>
> >>> @@ -1181,7 +1179,7 @@ static void read_log_config_environ_var_
> >>>      */
> >>>     if (lgs_conf.logDataGroupname_cnfflag == LGS_CNF_DEF) {
> >>>       if ((val_str = getenv("LOGSV_DATA_GROUPNAME")) != NULL) {
> >>> -      n = snprintf(lgs_conf.logDataGroupname, UT_NAMESIZE, "%s",
> >> val_str);
> >>> +      int n = snprintf(lgs_conf.logDataGroupname, UT_NAMESIZE, "%s",
> >>> val_str);
> >>>         if (n >= UT_NAMESIZE) {
> >>>           /* Fail */
> >>>           LOG_WA("LOG data group name read from config file is >
> >>> UT_NAMESIZE");
> >>> diff --git a/src/log/logd/lgs_config.h b/src/log/logd/lgs_config.h
> >>> --- a/src/log/logd/lgs_config.h
> >>> +++ b/src/log/logd/lgs_config.h
> >>> @@ -87,7 +87,7 @@ typedef enum {
> >>>     LGS_IMM_LOG_NUMEND
> >>>   } lgs_logconfGet_t;
> >>>
> >>> -static inline lgs_logconfGet_t param_name_to_id(std::string
> >>> param_name) {
> >>> +static inline lgs_logconfGet_t param_name_to_id(const std::string&
> >>> param_name) {
> >>>     if (param_name == LOG_ROOT_DIRECTORY) {
> >>>       return LGS_IMM_LOG_ROOT_DIRECTORY;
> >>>     } else if (param_name == LOG_DATA_GROUPNAME) {
> >>> @@ -227,16 +227,16 @@ void lgs_cfgupd_multival_add(const std::
> >>>    * Note: The attribute shall have the NO_DUPLICATES flag
> >>>    *
> >>>    */
> >>> -void lgs_cfgupd_multival_delete(const std::string attribute_name,
> >>> -                                const std::vector<std::string>
> >> value_list,
> >>> +void lgs_cfgupd_multival_delete(const std::string& attribute_name,
> >>> +                                const std::vector<std::string>&
> >> value_list,
> >>> lgs_config_chg_t *config_data);
> >>>
> >>>   /**
> >>>    * Replace all existing values in the multi value attribute with the
> >> values in
> >>>    * the list
> >>>    */
> >>> -void lgs_cfgupd_mutival_replace(const std::string attribute_name,
> >>> -                                const std::vector<std::string>
> >> value_list,
> >>> +void lgs_cfgupd_mutival_replace(const std::string& attribute_name,
> >>> +                                const std::vector<std::string>&
> >> value_list,
> >>> lgs_config_chg_t *config_data);
> >>>
> >>>   /**
> >>> diff --git a/src/log/logd/lgs_evt.cc b/src/log/logd/lgs_evt.cc
> >>> --- a/src/log/logd/lgs_evt.cc
> >>> +++ b/src/log/logd/lgs_evt.cc
> >>> @@ -161,12 +161,12 @@ log_client_t *lgs_client_new(MDS_DEST md
> >>>       if (!p.second) {
> >>>         TRACE("unable to add clm node info map - the id %x already
> >> existed",
> >>>               client->client_id);
> >>> -      free(client);
> >>> +      delete client;
> >>>         client = NULL;
> >>>       }
> >>>     } else {
> >>>       TRACE("can't find local sec map in lgs_clm_node_add");
> >>> -    free(client);
> >>> +    delete client;
> >>>       client = nullptr;
> >>>     }
> >>>
> >>> @@ -341,9 +341,8 @@ int lgs_client_delete_by_mds_dest(MDS_DE
> >>>     /* Loop through Client DB */
> >>>     ClientMap *clientMap(reinterpret_cast<ClientMap *>
> >>>                            (client_db));
> >>> -  ClientMap::iterator pos;
> >>> -  for (pos = clientMap->begin(); pos != clientMap->end(); pos++) {
> >>> -    rp = pos->second;
> >>> +  for (const auto& value : *clientMap) {
> >>> +    rp =  value.second;
> >>>
> >>>       if (m_NCS_MDS_DEST_EQUAL(&rp->mds_dest, &mds_dest))
> >>>         rc = lgs_client_delete(rp->client_id, closetime_ptr);
> >>> @@ -414,7 +413,6 @@ uint32_t lgs_remove_lga_down_rec(lgs_cb_
> >>>   static uint32_t proc_lga_updn_mds_msg(lgsv_lgs_evt_t *evt) {
> >>>     lgsv_ckpt_msg_v1_t ckpt_v1;
> >>>     lgsv_ckpt_msg_v2_t ckpt_v2;
> >>> -  void *ckpt_ptr;
> >>>     uint32_t async_rc = NCSCC_RC_SUCCESS;
> >>>     struct timespec closetime_tspec;
> >>>
> >>> @@ -432,9 +430,9 @@ static uint32_t proc_lga_updn_mds_msg(lg
> >>>           osaf_clock_gettime(CLOCK_REALTIME, &closetime_tspec);
> >>>           time_t closetime = closetime_tspec.tv_sec;
> >>>           (void)lgs_client_delete_by_mds_dest(evt->fr_dest,
> >>> &closetime);
> >>> -
> >>>           /*Send an async checkpoint update to STANDBY EDS peer */
> >>>           if (lgs_cb->ha_state == SA_AMF_HA_ACTIVE) {
> >>> +          void *ckpt_ptr;
> >>>             if (lgs_is_peer_v2()) {
> >>>               memset(&ckpt_v2, 0, sizeof(ckpt_v2));
> >>>               ckpt_v2.header.ckpt_rec_type = LGS_CKPT_CLIENT_DOWN;
> >>> @@ -529,12 +527,11 @@ static uint32_t proc_mds_quiesced_ack_ms
> >>>   static void lgs_process_lga_down_list() {
> >>>     struct timespec closetime_tspec;
> >>>     if (lgs_cb->ha_state == SA_AMF_HA_ACTIVE) {
> >>> -    LGA_DOWN_LIST *lga_down_rec = NULL;
> >>>       LGA_DOWN_LIST *temp_lga_down_rec = NULL;
> >>>       osaf_clock_gettime(CLOCK_REALTIME, &closetime_tspec);
> >>>       time_t closetime = closetime_tspec.tv_sec;
> >>>
> >>> -    lga_down_rec = lgs_cb->lga_down_list_head;
> >>> +    LGA_DOWN_LIST *lga_down_rec = lgs_cb->lga_down_list_head;
> >>>       while (lga_down_rec) {
> >>>         /*Remove the LGA DOWN REC from the LGA_DOWN_LIST */
> >>>         /* Free the LGA_DOWN_REC */
> >>> @@ -551,7 +548,6 @@ static void lgs_process_lga_down_list()
> >>>
> >>>
> >>>   static uint32_t proc_rda_cb_msg(lgsv_lgs_evt_t *evt) {
> >>> -  log_stream_t *stream;
> >>>     uint32_t rc = NCSCC_RC_SUCCESS;
> >>>
> >>>     TRACE_ENTER2("%d", (int) evt->info.rda_info.io_role);
> >>> @@ -590,6 +586,7 @@ static uint32_t proc_rda_cb_msg(lgsv_lgs
> >>>       /* Check existing streams */
> >>>       // Iterate all existing log streams in cluster.
> >>>       uint32_t count = 0;
> >>> +    log_stream_t *stream;
> >>>       SaBoolT endloop = SA_FALSE, jstart = SA_TRUE;
> >>>       while ((stream = iterate_all_streams(endloop, jstart)) &&
> >>> !endloop) {
> >>>         jstart = SA_FALSE;
> >>> diff --git a/src/log/logd/lgs_filehdl.cc b/src/log/logd/lgs_filehdl.cc
> >>> --- a/src/log/logd/lgs_filehdl.cc
> >>> +++ b/src/log/logd/lgs_filehdl.cc
> >>> @@ -534,13 +534,9 @@ int delete_file_hdl(void *indata, void *
> >>>   static int check_log_oldest(char *line, char *fname_prefix, int
> >>> fname_prefix_size, int *old_date, int *old_time) {
> >>>     int date, time, c, d;
> >>>     date = time = c = d = 0;
> >>> -  int len = 0;
> >>>     std::string name_format;
> >>>     char time_stamps[] = "_%d_%d_%d_%d.log";
> >>>
> >>> -  len = strlen(time_stamps);
> >>> -  len += fname_prefix_size;
> >>> -
> >>>     name_format = std::string(fname_prefix);
> >>>     TRACE_3("fname: %s", name_format.c_str());
> >>>
> >>> diff --git a/src/log/logd/lgs_fmt.cc b/src/log/logd/lgs_fmt.cc
> >>> --- a/src/log/logd/lgs_fmt.cc
> >>> +++ b/src/log/logd/lgs_fmt.cc
> >>> @@ -557,7 +557,6 @@ static int extractCommonField(char *dest
> >>>     SaUint16T fieldSizeOffset = 0;
> >>>     int characters = 0;
> >>>     char *hex_string = NULL, *hex_string_ptr = NULL;
> >>> -  int no_ch = 0;
> >>>     SaTimeT ms;
> >>>     long gmtOffset = 0, uGmtOffset = 0;
> >>>
> >>> @@ -790,7 +789,7 @@ static int extractCommonField(char *dest
> >>>         hex_string_ptr = hex_string;
> >>>
> >>>         for (i = 0; i < stringSize; i++) {
> >>> -        no_ch = sprintf(hex_string_ptr, "%x",
> >>> (int)logRecord->logBuffer-
> >>>> logBuf[i]);
> >>> +        int no_ch = sprintf(hex_string_ptr, "%x",
> >> (int)logRecord->logBuffer-
> >>>> logBuf[i]);
> >>>           hex_string_ptr = hex_string_ptr + no_ch;
> >>>         }
> >>>         *hex_string_ptr = '\0';
> >>> diff --git a/src/log/logd/lgs_imm.cc b/src/log/logd/lgs_imm.cc
> >>> --- a/src/log/logd/lgs_imm.cc
> >>> +++ b/src/log/logd/lgs_imm.cc
> >>> @@ -985,7 +985,6 @@ static lgs_stream_defval_t *get_SaLogStr
> >>>     SaImmClassCategoryT cc;
> >>>     SaImmAttrDefinitionT_2 **attributes = NULL;
> >>>     SaImmAttrDefinitionT_2 *attribute = NULL;
> >>> -  int i = 0;
> >>>
> >>>     TRACE_ENTER();
> >>>     if (lgs_stream_defval_updated_flag == false) {
> >>> @@ -1004,6 +1003,7 @@ static lgs_stream_defval_t *get_SaLogStr
> >>>       }
> >>>
> >>>       if (rc == SA_AIS_OK) {
> >>> +      int i = 0;
> >>>         while ((attribute = attributes[i++]) != NULL) {
> >>>           if (!strcmp(attribute->attrName,
> >>> "saLogStreamMaxLogFileSize")) {
> >>>             TRACE("Got saLogStreamMaxLogFileSize");
> >>> @@ -1952,7 +1952,6 @@ void logRootDirectory_filemove(
> >>>
> >>>     /* Create new files at new path
> >>>      */
> >>> -  char *current_time;
> >>>     endloop = SA_FALSE;
> >>>     jstart = SA_TRUE;
> >>>     while ((stream = iterate_all_streams(endloop, jstart)) &&
> >>> !endloop) {
> >>> @@ -1963,7 +1962,7 @@ void logRootDirectory_filemove(
> >>>       }
> >>>
> >>>       /* Create the new log file based on updated configuration */
> >>> -    current_time = lgs_get_time(cur_time_in);
> >>> +    char *current_time = lgs_get_time(cur_time_in);
> >>>       stream->logFileCurrent = stream->fileName + "_" + current_time;
> >>>
> >>>       if ((*stream->p_fd = log_file_open(new_logRootDirectory,
> >>> @@ -1991,7 +1990,6 @@ void logRootDirectory_filemove(
> >>>    */
> >>>   void logDataGroupname_fileown(const char
> *new_logDataGroupname) {
> >>>     TRACE_ENTER();
> >>> -  log_stream_t *stream;
> >>>
> >>>     if (new_logDataGroupname == NULL) {
> >>>       LOG_ER("Data group is NULL");
> >>> @@ -2005,6 +2003,7 @@ void logDataGroupname_fileown(const char
> >>>        */
> >>>       // Iterate all existing log streams in cluster.
> >>>       SaBoolT endloop = SA_FALSE, jstart = SA_TRUE;
> >>> +    log_stream_t *stream;
> >>>       while ((stream = iterate_all_streams(endloop, jstart)) &&
> >>> !endloop) {
> >>>         jstart = SA_FALSE;
> >>>         lgs_own_log_files_h(stream, new_logDataGroupname);
> >>> @@ -3406,7 +3405,6 @@ void lgs_delete_one_stream_object(const
> >>>   void lgs_cleanup_abandoned_streams() {
> >>>     SaAisErrorT ais_rc = SA_AIS_OK;
> >>>     int pos = 0;
> >>> -  char *name_str;
> >>>     SaNameT object_name;
> >>>
> >>>     TRACE_ENTER();
> >>> @@ -3419,7 +3417,7 @@ void lgs_cleanup_abandoned_streams() {
> >>>     pos = log_rtobj_list_getnamepos();
> >>>     while (pos != -1) {
> >>>       /* Get found name */
> >>> -    name_str = log_rtobj_list_getname(pos);
> >>> +    char *name_str = log_rtobj_list_getname(pos);
> >>>
> >>>       /* Append the close time to log file and configuration file */
> >>>       (void) log_close_rtstream_files(name_str);
> >>> @@ -3616,16 +3614,17 @@ SaUint32T
> *lgs_get_scAbsenceAllowed_attr
> >>>       goto done_fin_Om;
> >>>     }
> >>>
> >>> -  void *value;
> >>>
> >>>     /* Handle the global scAbsenceAllowed_flag */
> >>>     attribute = attributes[0];
> >>> -  TRACE("%s\t attrName \"%s\"", __FUNCTION__, attribute-
> >attrName);
> >>> -  if ((attribute != NULL) && (attribute->attrValuesNumber != 0)) {
> >>> -    /* scAbsenceAllowed has value. Get the value */
> >>> -    value = attribute->attrValues[0];
> >>> -    *attr_val = *(static_cast<SaUint32T *>(value));
> >>> -    rc_attr_val = attr_val;
> >>> +  if (attribute != NULL) {
> >>> +    TRACE("%s\t attrName \"%s\"", __FUNCTION__, attribute-
> >attrName);
> >>> +    if (attribute->attrValuesNumber != 0) {
> >>> +      /* scAbsenceAllowed has value. Get the value */
> >>> +      void *value = attribute->attrValues[0];
> >>> +      *attr_val = *(static_cast<SaUint32T *>(value));
> >>> +      rc_attr_val = attr_val;
> >>> +    }
> >>>     }
> >>>
> >>>   done_fin_Om:
> >>> diff --git a/src/log/logd/lgs_imm_gcfg.cc
> >>> b/src/log/logd/lgs_imm_gcfg.cc
> >>> --- a/src/log/logd/lgs_imm_gcfg.cc
> >>> +++ b/src/log/logd/lgs_imm_gcfg.cc
> >>> @@ -529,7 +529,6 @@ static const SaImmOiCallbacksT_2 callbac
> >>>    * @param new_name[in]
> >>>    */
> >>>   static void save_network_name(char* new_name) {
> >>> -  uint32_t name_len = 0;
> >>>
> >>>     TRACE_ENTER();
> >>>
> >>> @@ -543,7 +542,7 @@ static void save_network_name(char* new_
> >>>     if (new_name == NULL) {
> >>>       network_name = NULL;
> >>>     } else {
> >>> -    name_len = strlen(new_name) + 1;
> >>> +     uint32_t name_len = strlen(new_name) + 1;
> >>>       network_name = static_cast<char *>(calloc(1, name_len));
> >>>       if (network_name == NULL) {
> >>>         LOG_ER("%s: calloc Fail", __FUNCTION__);
> >>> @@ -854,9 +853,8 @@ static void applier_finalize(SaImmOiHand
> >>>    * @return true if cancellation is active
> >>>    */
> >>>   static bool th_do_cancel() {
> >>> -  bool rc = false;
> >>>     osaf_mutex_lock_ordie(&lgs_gcfg_applier_mutex);
> >>> -  rc = cancel_flg;
> >>> +  bool rc = cancel_flg;
> >>>     cancel_flg = false;
> >>>     osaf_mutex_unlock_ordie(&lgs_gcfg_applier_mutex);
> >>>     return rc;
> >>> @@ -937,8 +935,6 @@ static void *applier_thread(void *info_i
> >>>
> >>>     static struct pollfd fds[2];
> >>>     static nfds_t nfds = 1; /* We have no IMM selection object yet */
> >>> -  int rc = 0;
> >>> -  SaAisErrorT ais_rc = SA_AIS_OK;
> >>>     static SaImmOiHandleT imm_appl_hdl = 0;
> >>>     static SaSelectionObjectT imm_appl_selobj = 0;
> >>>
> >>> @@ -953,8 +949,7 @@ static void *applier_thread(void *info_i
> >>>       /* Initiate applier */
> >>>       th_state_set(TH_STARTING);
> >>>
> >>> -    rc = applier_init(&imm_appl_hdl, &imm_appl_selobj);
> >>> -    if (rc == -1) {
> >>> +    if (applier_init(&imm_appl_hdl, &imm_appl_selobj) == -1) {
> >>>         /* Some error handling */
> >>>         LOG_WA("applier_init Fail. Exit the appiler thread");
> >>>         return NULL;
> >>> @@ -962,8 +957,7 @@ static void *applier_thread(void *info_i
> >>>
> >>>       nfds = FDA_IMM + 1; /* IMM selection object is valid */
> >>>
> >>> -    rc = applier_set_name_class(imm_appl_hdl);
> >>> -    if (rc == -1) {
> >>> +    if (applier_set_name_class(imm_appl_hdl) == -1) {
> >>>         /* Some error handling */
> >>>         LOG_WA("applier_set_name_class Fail. Exit the appier thread");
> >>>         return NULL;
> >>> @@ -983,8 +977,7 @@ static void *applier_thread(void *info_i
> >>>       std::string tmp_networkname;
> >>>       tmp_networkname = lgs_get_networkname();
> >>>       if (tmp_networkname.empty() == true) {
> >>> -      rc = read_network_name();
> >>> -      if (rc == -1) {
> >>> +      if (read_network_name() == -1) {
> >>>           LOG_WA("read_network_name() Fail");
> >>>         }
> >>>       }
> >>> @@ -995,8 +988,7 @@ static void *applier_thread(void *info_i
> >>>
> >>>         if (fds[FDA_IMM].revents & POLLIN) {
> >>>           TRACE("%s: IMM event", __FUNCTION__);
> >>> -        ais_rc = saImmOiDispatch(imm_appl_hdl, SA_DISPATCH_ALL);
> >>> -        if (ais_rc == SA_AIS_ERR_BAD_HANDLE) {
> >>> +        if (saImmOiDispatch(imm_appl_hdl, SA_DISPATCH_ALL) ==
> >>> SA_AIS_ERR_BAD_HANDLE) {
> >>>             /* Handle is lost. We must initialize again */
> >>>             th_state_set(TH_STARTING);
> >>>             break;
> >>> @@ -1007,6 +999,7 @@ static void *applier_thread(void *info_i
> >>>           TRACE("%s: COM event", __FUNCTION__);
> >>>           /* Handle start and stop requests */
> >>>           char cmd_str[256] = {0};
> >>> +        int rc = 0;
> >>>           while (1) {
> >>>             rc = read(com_fd, cmd_str, 256);
> >>>             if ((rc == -1) && ((errno == EINTR) ||
> >>> diff --git a/src/log/logd/lgs_main.cc b/src/log/logd/lgs_main.cc
> >>> --- a/src/log/logd/lgs_main.cc
> >>> +++ b/src/log/logd/lgs_main.cc
> >>> @@ -318,7 +318,7 @@ static uint32_t log_initialize(void) {
> >>>     }
> >>>
> >>>     /* Attach mailbox to this thread */
> >>> -  if ((rc = m_NCS_IPC_ATTACH(&lgs_mbx) != NCSCC_RC_SUCCESS)) {
> >>> +  if ((rc = m_NCS_IPC_ATTACH(&lgs_mbx)) != NCSCC_RC_SUCCESS) {
> >>>       LOG_ER("m_NCS_IPC_ATTACH FAILED %d", rc);
> >>>       goto done;
> >>>     }
> >>> diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
> >>> --- a/src/log/logd/lgs_mbcsv.cc
> >>> +++ b/src/log/logd/lgs_mbcsv.cc
> >>> @@ -253,7 +253,7 @@ uint32_t lgs_mbcsv_init(lgs_cb_t *cb, Sa
> >>>     arg.info.open.i_pwe_hdl = (uint32_t)cb->mds_hdl;
> >>>     arg.info.open.i_client_hdl = 0;
> >>>
> >>> -  if ((rc = ncs_mbcsv_svc(&arg) != NCSCC_RC_SUCCESS)) {
> >>> +  if ((rc = ncs_mbcsv_svc(&arg)) != NCSCC_RC_SUCCESS) {
> >>>       LOG_ER("NCS_MBCSV_OP_OPEN FAILED");
> >>>       goto done;
> >>>     }
> >>> @@ -580,7 +580,6 @@ static uint32_t ckpt_encode_cbk_handler(
> >>>
> >>>
> **************************************************************
> >>> ***************/
> >>>
> >>>   static uint32_t ckpt_enc_cold_sync_data(lgs_cb_t *lgs_cb,
> >>> NCS_MBCSV_CB_ARG *cbk_arg, bool data_req) {
> >>> -  uint32_t rc = NCSCC_RC_SUCCESS;
> >>>     /* asynsc Update Count */
> >>>     uint8_t *async_upd_cnt = NULL;
> >>>
> >>> @@ -590,7 +589,7 @@ static uint32_t ckpt_enc_cold_sync_data(
> >>>      */
> >>>     TRACE_2("COLD SYNC ENCODE START........");
> >>>     /* Encode Registration list */
> >>> -  rc = edu_enc_reg_list(lgs_cb, &cbk_arg->info.encode.io_uba);
> >>> +  uint32_t rc = edu_enc_reg_list(lgs_cb,
> >>> &cbk_arg->info.encode.io_uba);
> >>>     if (rc != NCSCC_RC_SUCCESS) {
> >>>       TRACE("  edu_enc_reg_list FAILED");
> >>>       return NCSCC_RC_FAILURE;
> >>> @@ -735,14 +734,13 @@ static uint32_t edu_enc_reg_list(lgs_cb_
> >>>     void *ckpt_client_reg;
> >>>     EDU_ERR ederror;
> >>>     uint32_t rc = NCSCC_RC_SUCCESS, num_rec = 0;
> >>> -  uint8_t *pheader = NULL;
> >>>     lgsv_ckpt_header_t ckpt_hdr;
> >>>     EDU_PROG_HANDLER edp_function_reg = NULL;
> >>>
> >>>     TRACE_ENTER();
> >>>
> >>>     /*Reserve space for "Checkpoint Header" */
> >>> -  pheader = ncs_enc_reserve_space(uba, sizeof(lgsv_ckpt_header_t));
> >>> +  uint8_t *pheader = ncs_enc_reserve_space(uba,
> >>> sizeof(lgsv_ckpt_header_t));
> >>>     if (pheader == NULL) {
> >>>       TRACE("  ncs_enc_reserve_space FAILED");
> >>>       return (rc = EDU_ERR_MEM_FAIL);
> >>> @@ -750,9 +748,8 @@ static uint32_t edu_enc_reg_list(lgs_cb_
> >>>     ncs_enc_claim_space(uba, sizeof(lgsv_ckpt_header_t));
> >>>      /* Loop through Client DB */
> >>>     ClientMap *clientMap(reinterpret_cast<ClientMap *>(client_db));
> >>> -  ClientMap::iterator pos;
> >>> -  for (pos = clientMap->begin(); pos != clientMap->end(); pos++) {
> >>> -    client = pos->second;
> >>> +  for (const auto& value : *clientMap) {
> >>> +    client = value.second;
> >>>
> >>>       if (lgs_is_peer_v6()) {
> >>>         ckpt_reg_rec_v6.client_id = client->client_id;
> >>> @@ -978,10 +975,9 @@ static uint32_t ckpt_decode_log_struct(
> >>>       void *struct_ptr,               /* Checkpointed structure */
> >>>       EDU_PROG_HANDLER edp_function)  /* EDP function for decoding */
> >>>   {
> >>> -  uint32_t rc = NCSCC_RC_SUCCESS;
> >>>     EDU_ERR ederror;
> >>>
> >>> -  rc = m_NCS_EDU_EXEC(&cb->edu_hdl, edp_function, &cbk_arg-
> >>>> info.decode.i_uba,
> >>> +  uint32_t rc = m_NCS_EDU_EXEC(&cb->edu_hdl, edp_function,
> &cbk_arg-
> >>>> info.decode.i_uba,
> >>>                         EDP_OP_TYPE_DEC, &struct_ptr, &ederror);
> >>>
> >>>     if (rc != NCSCC_RC_SUCCESS) {
> >>> @@ -1174,7 +1170,6 @@ static uint32_t ckpt_decode_log_cfg(lgs_
> >>>   /* END ckpt_decode_async_update helper functions */
> >>>
> >>>   static uint32_t ckpt_decode_async_update(lgs_cb_t *cb,
> >>> NCS_MBCSV_CB_ARG *cbk_arg) {
> >>> -  uint32_t rc = NCSCC_RC_SUCCESS;
> >>>     EDU_ERR ederror;
> >>>     lgsv_ckpt_msg_v1_t msg_v1;
> >>>     lgsv_ckpt_msg_v1_t *ckpt_msg_v1 = &msg_v1;
> >>> @@ -1197,7 +1192,7 @@ static uint32_t ckpt_decode_async_update
> >>>     TRACE_ENTER();
> >>>
> >>>     /* Decode the message header */
> >>> -  rc = m_NCS_EDU_EXEC(&cb->edu_hdl, edp_ed_header_rec, &cbk_arg-
> >>>> info.decode.i_uba,
> >>> +  uint32_t rc = m_NCS_EDU_EXEC(&cb->edu_hdl, edp_ed_header_rec,
> >>> &cbk_arg->info.decode.i_uba,
> >>>                         EDP_OP_TYPE_DEC, &hdr_ptr, &ederror);
> >>>     if (rc != NCSCC_RC_SUCCESS) {
> >>>       m_NCS_EDU_PRINT_ERROR_STRING(ederror);
> >>> @@ -1924,7 +1919,7 @@ static uint32_t ckpt_proc_close_stream(l
> >>>
> >>>     TRACE("close stream %s, id: %u", stream->name.c_str(), stream-
> >>>> streamId);
> >>> -  if ((stream->numOpeners > 0) || (clientId < 0)){
> >>> +  if ((stream->numOpeners > 0) || (clientId == 0)) {
> >>>       /* No clients to remove if no openers or if closing a stream
> >>> opened
> >>>        * by log service itself
> >>>        */
> >>> diff --git a/src/log/logd/lgs_mds.cc b/src/log/logd/lgs_mds.cc
> >>> --- a/src/log/logd/lgs_mds.cc
> >>> +++ b/src/log/logd/lgs_mds.cc
> >>> @@ -1000,13 +1000,12 @@ static uint32_t mds_enc_flat(struct ncsm
> >>>
> >>>
> **************************************************************
> >>> ***************/
> >>>
> >>>   static uint32_t mds_dec_flat(struct ncsmds_callback_info *info) {
> >>> -  uint32_t rc = NCSCC_RC_SUCCESS;
> >>>     /* Retrieve info from the dec_flat */
> >>>     MDS_CALLBACK_DEC_INFO dec = info->info.dec_flat;
> >>>     /* Modify the MDS_INFO to populate dec */
> >>>     info->info.dec = dec;
> >>>     /* Invoke the regular mds_dec routine */
> >>> -  rc = mds_dec(info);
> >>> +  uint32_t rc = mds_dec(info);
> >>>     if (rc != NCSCC_RC_SUCCESS) {
> >>>       TRACE("mds_dec FAILED ");
> >>>     }
> >>> diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc
> >>> --- a/src/log/logd/lgs_stream.cc
> >>> +++ b/src/log/logd/lgs_stream.cc
> >>> @@ -418,7 +418,6 @@ void log_free_stream_resources(log_strea
> >>>       free(stream->logFileFormat);
> >>>
> >>>     delete stream;
> >>> -  stream = NULL;
> >>>   }
> >>>
> >>>   /**
> >>> @@ -666,11 +665,10 @@ SaAisErrorT lgs_create_rt_appstream(log_
> >>>    */
> >>>   log_stream_t *log_stream_new(const std::string &name, int
> >>> stream_id) {
> >>>     int rc = 0;
> >>> -  log_stream_t *stream = NULL;
> >>>
> >>>     TRACE_ENTER2("%s, l: %zu", name.c_str(), name.size());
> >>>
> >>> -  stream = new (std::nothrow) log_stream_t();
> >>> +  log_stream_t *stream = new (std::nothrow) log_stream_t();
> >>>     if (stream == NULL) {
> >>>       LOG_WA("calloc FAILED");
> >>>       goto done;
> >>> @@ -1339,7 +1337,7 @@ done:
> >>>   log_stream_t *log_stream_get_by_id(uint32_t id) {
> >>>     log_stream_t *stream = NULL;
> >>>
> >>> -  if (0 <= id && id < stream_array_size)
> >>> +  if (id < stream_array_size)
> >>>       stream = stream_array[id];
> >>>
> >>>     return stream;
> >>> diff --git a/src/log/logd/lgs_util.cc b/src/log/logd/lgs_util.cc
> >>> --- a/src/log/logd/lgs_util.cc
> >>> +++ b/src/log/logd/lgs_util.cc
> >>> @@ -359,9 +359,8 @@ bool lgs_lga_entry_valid(lgs_cb_t *cb, M
> >>>     /* Loop through Client DB */
> >>>     ClientMap *clientMap(reinterpret_cast<ClientMap *>
> >>>                            (client_db));
> >>> -  ClientMap::iterator pos;
> >>> -  for (pos = clientMap->begin(); pos != clientMap->end(); pos++) {
> >>> -    rp = pos->second;
> >>> +  for (const auto& value : *clientMap) {
> >>> +    rp = value.second;
> >>>       if (m_NCS_MDS_DEST_EQUAL(&rp->mds_dest, &mds_dest)) {
> >>>         return true;
> >>>       }
> >>> @@ -942,9 +941,8 @@ void lgs_send_severity_filter_to_clients
> >>>     /* Loop through Client DB */
> >>>     ClientMap *clientMap(reinterpret_cast<ClientMap *>
> >>>                            (client_db));
> >>> -  ClientMap::iterator pos;
> >>> -  for (pos = clientMap->begin(); pos != clientMap->end(); pos++) {
> >>> -    rp = pos->second;
> >>> +  for (const auto& value : *clientMap) {
> >>> +    rp = value.second;
> >>>       /* Do not send to all client. Send to clients that need filter
> >>>           callback and associate with this stream */
> >>>       stream = rp->stream_list_root;
> >>
> >>
> >
> 




------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to