Hi Canh,

Ack with comments, with [Vu].

Regards, Vu

> -----Original Message-----
> From: Canh Van Truong [mailto:canh.v.tru...@dektech.com.au]
> Sent: Thursday, July 20, 2017 1:31 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au;
> mahesh.va...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> <canh.v.tru...@dektech.com.au>
> Subject: [PATCH 1/1] log: fix cppcheck, cpplint and reorganize headers -
part
> 1 [#2445]
> 
>    Fix cppcheck, cpplint, replace nullptr for following files:
>     - lgs_amf.*, lgs_config.*, lgs_dest.*, lgs_evt.*, lgs_file.*,
>       lgs_filehdl.*, lgs_nildest.*, lgs_unixsock_dest.*
>       lgs_util.*, lgs_dest_test.*
> ---
>  src/log/logd/lgs_amf.cc          |  25 ++--
>  src/log/logd/lgs_config.cc       | 238
+++++++++++++++------------------------
>  src/log/logd/lgs_config.h        |   3 +-
>  src/log/logd/lgs_dest.cc         |   2 +-
>  src/log/logd/lgs_dest.h          |   6 +-
>  src/log/logd/lgs_evt.cc          | 111 +++++++++---------
>  src/log/logd/lgs_evt.h           |  17 ++-
>  src/log/logd/lgs_file.cc         |  56 +++++----
>  src/log/logd/lgs_filehdl.cc      |  84 +++++++-------
>  src/log/logd/lgs_nildest.h       |   6 +-
>  src/log/logd/lgs_recov.cc        |   4 +-
>  src/log/logd/lgs_stream.cc       |  16 +--
>  src/log/logd/lgs_unixsock_dest.h |   6 +-
>  src/log/logd/lgs_util.cc         |  58 +++++-----
>  src/log/logd/lgs_util.h          |   7 +-
>  src/log/tests/lgs_dest_test.cc   |   2 +-
>  16 files changed, 293 insertions(+), 348 deletions(-)
> 
> diff --git a/src/log/logd/lgs_amf.cc b/src/log/logd/lgs_amf.cc
> index 434d40861..6821cb859 100644
> --- a/src/log/logd/lgs_amf.cc
> +++ b/src/log/logd/lgs_amf.cc
> @@ -20,9 +20,9 @@
>   */
> 
>  #include "nid/agent/nid_start_util.h"
> -#include "log/logd/lgs.h"
> -#include "lgs_config.h"
>  #include "osaf/immutil/immutil.h"
> +#include "log/logd/lgs.h"
> +#include "log/logd/lgs_config.h"
> 
>  static void close_all_files() {
>    log_stream_t *stream;
> @@ -124,13 +124,11 @@ static SaAisErrorT
> amf_standby_state_handler(lgs_cb_t *cb,
> 
> **************************************************************
> ***************/
>  static SaAisErrorT amf_quiescing_state_handler(lgs_cb_t *cb,
>                                                 SaInvocationT invocation)
{
> -  SaAisErrorT ais_rc = SA_AIS_OK;
> -
>    TRACE_ENTER2("HA QUIESCING request");
>    close_all_files();
> 
>    /* Give up our IMM OI implementer role */
> -  ais_rc = immutil_saImmOiImplementerClear(cb->immOiHandle);
> +  SaAisErrorT ais_rc = immutil_saImmOiImplementerClear(cb-
> >immOiHandle);
>    if (ais_rc != SA_AIS_OK) {
>      LOG_WA("immutil_saImmOiImplementerClear failed: %s",
> saf_error(ais_rc));
>    }
> @@ -156,13 +154,11 @@ static SaAisErrorT
> amf_quiescing_state_handler(lgs_cb_t *cb,
>  static SaAisErrorT amf_quiesced_state_handler(lgs_cb_t *cb,
>                                                SaInvocationT invocation) {
>    V_DEST_RL mds_role;
> -  SaAisErrorT rc = SA_AIS_OK;
> -
>    TRACE_ENTER2("HA AMF QUIESCED STATE request");
>    close_all_files();
> 
>    /* Give up our IMM OI implementer role */
> -  rc = immutil_saImmOiImplementerClear(cb->immOiHandle);
> +  SaAisErrorT rc = immutil_saImmOiImplementerClear(cb->immOiHandle);
>    if (rc != SA_AIS_OK) {
>      LOG_WA("immutil_saImmOiImplementerClear failed: %s", saf_error(rc));
>    }
> @@ -410,12 +406,14 @@ static SaAisErrorT amf_healthcheck_start(lgs_cb_t
> *lgs_cb) {
>    memset(&healthy, 0, sizeof(healthy));
>    health_key = getenv("LGSV_ENV_HEALTHCHECK_KEY");
> 
> -  if (health_key == NULL)
> -    strcpy((char *)healthy.key, "F1B2");
> +  if (health_key == nullptr)
> +    snprintf(reinterpret_cast<char *>(healthy.key),
> +             SA_AMF_HEALTHCHECK_KEY_MAX, "F1B2");
>    else
> -    strcpy((char *)healthy.key, health_key);
> +    snprintf(reinterpret_cast<char *>(healthy.key),
> +             SA_AMF_HEALTHCHECK_KEY_MAX, "%s", health_key);
> 
> -  healthy.keyLen = strlen((char *)healthy.key);
> +  healthy.keyLen = strlen(reinterpret_cast<char *>(healthy.key));
> 
>    error = saAmfHealthcheckStart(lgs_cb->amf_hdl, &lgs_cb->comp_name,
> &healthy,
>                                  SA_AMF_HEALTHCHECK_AMF_INVOKED,
> @@ -485,7 +483,8 @@ SaAisErrorT lgs_amf_init(lgs_cb_t *cb) {
[Vu] `lgs_amf_init()` is public interface of lgs_amf.cc.
Consider to creating its own header file lgs_amf.h and move that function to
that file.
>    }
> 
>    /* Register component with AMF */
> -  error = saAmfComponentRegister(cb->amf_hdl, &cb->comp_name,
> (SaNameT *)NULL);
> +  error = saAmfComponentRegister(cb->amf_hdl, &cb->comp_name,
> +                                 reinterpret_cast<SaNameT *>(NULL));
[Vu] 
1) Use nullptr instread.
2) Why need to cast NULL pointer to SaNameT*? 

>    if (error != SA_AIS_OK) {
>      LOG_ER("saAmfComponentRegister() FAILED");
>      goto done;
> diff --git a/src/log/logd/lgs_config.cc b/src/log/logd/lgs_config.cc
> index 7b1ad56d6..141aaa2f8 100644
> --- a/src/log/logd/lgs_config.cc
> +++ b/src/log/logd/lgs_config.cc
> @@ -20,7 +20,7 @@
>  #define _GNU_SOURCE
>  #endif
> 
> -#include "lgs_config.h"
> +#include "log/logd/lgs_config.h"
> 
>  #include <stdio.h>
>  #include <stdlib.h>
> @@ -32,11 +32,11 @@
>  #include <vector>
>  #include <algorithm>
> 
> -#include "osaf/configmake.h"
>  #include "base/saf_error.h"
>  #include "base/osaf_secutil.h"
>  #include "base/osaf_utility.h"
>  #include "base/logtrace.h"
> +#include "osaf/configmake.h"
>  #include "osaf/immutil/immutil.h"
>  #include "log/logd/lgs_file.h"
>  #include "log/logd/lgs.h"
> @@ -159,8 +159,10 @@ typedef struct _lgs_conf_t {
>       * The following attributes cannot be configured in the config file
>       * Will be set to false if the attribute exists in the IMM config
object
>       */
> -    (void)strcpy(logDataGroupname, lgs_conf_def.logDataGroupname);
> -    (void)strcpy(logStreamFileFormat, lgs_conf_def.logStreamFileFormat);
> +    snprintf(logDataGroupname, UT_NAMESIZE, "%s",
> +             lgs_conf_def.logDataGroupname);
> +    snprintf(logStreamFileFormat, MAX_FIELD_SIZE, "%s",
> +             lgs_conf_def.logStreamFileFormat);
>      logMaxLogrecsize = lgs_conf_def.logMaxLogrecsize;
>      logStreamSystemHighLimit = lgs_conf_def.logStreamSystemHighLimit;
>      logStreamSystemLowLimit = lgs_conf_def.logStreamSystemLowLimit;
> @@ -179,37 +181,37 @@ 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;
> +  char *tmp_char_ptr = nullptr;
>    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;
>    char *cfg_param_str = static_cast<char *>(malloc(cfg_size));
> -  if (cfg_param_str == NULL) {
> +  if (cfg_param_str == nullptr) {
>      TRACE("%s: malloc Fail Aborted", __FUNCTION__);
>      osaf_abort(0);
>    }
> -  sprintf(cfg_param_str, "%s=%s", name_str, value_str);
> +  snprintf(cfg_param_str, cfg_size, "%s=%s", name_str, value_str);
> 
>    size_t alloc_size = strlen(cfg_param_str) + 1 + config_data-
> >ckpt_buffer_size;
> 
> -  if (config_data->ckpt_buffer_ptr == NULL) {
> +  if (config_data->ckpt_buffer_ptr == nullptr) {
>      /* Allocate memory for first chkpt data */
>      tmp_char_ptr = static_cast<char *>(malloc(alloc_size));
> -    if (tmp_char_ptr == NULL) {
> +    if (tmp_char_ptr == nullptr) {
>        TRACE("%s: malloc Fail Aborted", __FUNCTION__);
>        osaf_abort(0);
>      }
> 
>      config_data->ckpt_buffer_ptr = tmp_char_ptr;
>      config_data->ckpt_buffer_size = alloc_size;
> -    strcpy(tmp_char_ptr, cfg_param_str);
> +    snprintf(tmp_char_ptr, alloc_size, "%s", cfg_param_str);
>    } else {
>      /* Add memory for more data */
>      tmp_char_ptr =
>          static_cast<char *>(realloc(config_data->ckpt_buffer_ptr,
alloc_size));
> -    if (tmp_char_ptr == NULL) {
> +    if (tmp_char_ptr == nullptr) {
>        LOG_ER("%s: malloc Fail Aborted", __FUNCTION__);
>        osaf_abort(0);
>      }
> @@ -218,7 +220,8 @@ void lgs_cfgupd_list_create(const char *name_str,
> char *value_str,
>      config_data->ckpt_buffer_ptr = tmp_char_ptr;
>      config_data->ckpt_buffer_size = alloc_size;
>      /* Add config data directly after the previous data */
> -    strcpy(tmp_char_ptr + prev_size, cfg_param_str);
> +    snprintf(tmp_char_ptr + prev_size, alloc_size - prev_size, "%s",
> +             cfg_param_str);
>    }
> 
>    free(cfg_param_str);
> @@ -337,12 +340,12 @@ void lgs_cfgupd_mutival_replace(const std::string
> &attribute_name,
> 
>  char *lgs_cfgupd_list_read(char **name_str, char **value_str,
>                             char *next_param_ptr, lgs_config_chg_t
*cfgupd_ptr) {
> -  char *bufend_ptr = NULL;
> -  char *param_ptr = NULL;
> -  char *next_ptr = NULL;
> +  char *bufend_ptr = nullptr;
> +  char *param_ptr = nullptr;
> +  char *next_ptr = nullptr;
> 
> -  if (next_param_ptr == NULL) {
> -    TRACE("%s() called with next_param_ptr == NULL", __FUNCTION__);
> +  if (next_param_ptr == nullptr) {
> +    TRACE("%s() called with next_param_ptr == nullptr", __FUNCTION__);
>      goto done;
>    }
> 
> @@ -351,7 +354,7 @@ char *lgs_cfgupd_list_read(char **name_str, char
> **value_str,
>    next_ptr = strrchr(param_ptr, '\0') + 1;
> 
>    if (next_ptr >= bufend_ptr) {
> -    next_ptr = NULL;
> +    next_ptr = nullptr;
>    }
> 
>    /* Get name and value */
> @@ -364,20 +367,20 @@ done:
>  }
> 
>  int lgs_cfg_update(const lgs_config_chg_t *config_data) {
> -  char *bufend_ptr = NULL;
> -  char *allocmem_ptr = NULL;
> -  char *param_ptr = NULL;
> -  char *next_ptr = NULL;
> -  char *name_str = NULL;
> -  char *value_str = NULL;
> -  char *saveptr = NULL;
> +  char *bufend_ptr = nullptr;
> +  char *allocmem_ptr = nullptr;
> +  char *param_ptr = nullptr;
> +  char *next_ptr = nullptr;
> +  char *name_str = nullptr;
> +  char *value_str = nullptr;
> +  char *saveptr = nullptr;
>    int rc = 0;
>    bool logRecordDestinationConfiguration_list_clear = true;
>    bool logRecordDestinationStatus_list_clear = true;
> 
>    TRACE_ENTER();
>    /* Validate config_data */
> -  if ((config_data->ckpt_buffer_ptr == NULL) ||
> +  if ((config_data->ckpt_buffer_ptr == nullptr) ||
>        (config_data->ckpt_buffer_size == 0)) {
>      /* Note: Not considered as an error */
>      TRACE("%s: No config data", __FUNCTION__);
> @@ -410,8 +413,8 @@ int lgs_cfg_update(const lgs_config_chg_t
> *config_data) {
>      /* Get name and value */
>      name_str = strtok_r(param_ptr, "=", &saveptr);
>      value_str = strtok_r(NULL, "=", &saveptr);
[Vu] Is it OK to replace NULL by nullptr here?

Consider change following functions to static:
1) is_right_destination_fmt()
2) is_name_valid()
3) is_type_valid()
4) is_no_config_duplicated()
5) check_configuration_duplicated()


> -    if (value_str == NULL) {
> -      TRACE("%s: value_str is NULL", __FUNCTION__);
> +    if (value_str == nullptr) {
> +      TRACE("%s: value_str is nullptr", __FUNCTION__);
>        value_str = const_cast<char *>("");
>      }
> 
> @@ -506,7 +509,7 @@ done:
>   */
>  int lgs_cfg_verify_root_dir(const std::string &root_str_in) {
>    int rc = 0;
> -  log_stream_t *stream = NULL;
> +  log_stream_t *stream = nullptr;
>    size_t n = root_str_in.size();
>    SaBoolT endloop = SA_FALSE, jstart = SA_TRUE;
> 
> @@ -823,7 +826,7 @@ bool check_configuration_duplicated(const
> VectorString &vdest,
>   * @return -1 on error
>   */
>  int lgs_cfg_verify_log_record_destination_configuration(
> -    std::vector<std::string> &vdest, SaImmAttrModificationTypeT type) {
> +    const std::vector<std::string> &vdest, SaImmAttrModificationTypeT
type)
> {
>    // Allow deleting all destinations.
>    if (vdest.size() == 0) return true;
>    // It is important to keep the check in order
> @@ -878,13 +881,15 @@ static int verify_all_init() {
>    }
> 
>    if (lgs_cfg_verify_log_data_groupname(lgs_conf.logDataGroupname) == -
> 1) {
> -    strcpy(lgs_conf.logDataGroupname, lgs_conf_def.logDataGroupname);
> +    snprintf(lgs_conf.logDataGroupname, UT_NAMESIZE, "%s",
> +             lgs_conf_def.logDataGroupname);
>      lgs_conf.logDataGroupname_cnfflag = LGS_CNF_DEF;
>      rc = -1;
>    }
> 
>    if (lgs_cfg_verify_log_file_format(lgs_conf.logStreamFileFormat) == -1)
{
> -    strcpy(lgs_conf.logStreamFileFormat,
lgs_conf_def.logStreamFileFormat);
> +    snprintf(lgs_conf.logStreamFileFormat, MAX_FIELD_SIZE, "%s",
> +             lgs_conf_def.logStreamFileFormat);
>      lgs_conf.logStreamFileFormat_cnfflag = LGS_CNF_DEF;
>      rc = -1;
>    }
> @@ -970,7 +975,7 @@ static void read_logsv_config_obj_2() {
>    SaImmAttrValuesT_2 **attributes;
>    int i = 0;
>    int n;
> -  SaAisErrorT om_rc = SA_AIS_OK;
> +  SaAisErrorT om_rc;
> 
>    TRACE_ENTER();
> 
> @@ -1002,7 +1007,7 @@ static void read_logsv_config_obj_2() {
>      lgs_conf.OpenSafLogConfig_object_exist = true;
>    }
> 
> -  while ((attribute = attributes[i++]) != NULL) {
> +  while ((attribute = attributes[i++]) != nullptr) {
>      void *value;
> 
>      if (attribute->attrValuesNumber == 0) continue;
> @@ -1021,7 +1026,7 @@ static void read_logsv_config_obj_2() {
>        }
>      } else if (!strcmp(attribute->attrName, LOG_DATA_GROUPNAME)) {
>        n = snprintf(lgs_conf.logDataGroupname, UT_NAMESIZE, "%s",
> -                   *((char **)value));
> +                   *(reinterpret_cast<char **>(value)));
>        if (n >= UT_NAMESIZE) {
>          LOG_WA("LOG data group name read from config object is >
> UT_NAMESIZE");
>          lgs_conf.logDataGroupname[0] = '\0';
> @@ -1031,7 +1036,7 @@ static void read_logsv_config_obj_2() {
>        }
>      } else if (!strcmp(attribute->attrName, LOG_STREAM_FILE_FORMAT)) {
>        n = snprintf(lgs_conf.logStreamFileFormat, MAX_FIELD_SIZE, "%s",
> -                   *((char **)value));
> +                   *(reinterpret_cast<char **>(value)));
>        if (n >= MAX_FIELD_SIZE) {
>          /* The attribute has invalid value - use default value instead */
>          LOG_NO("Invalid logStreamFileFormat: %s",
> lgs_conf.logStreamFileFormat);
> @@ -1042,40 +1047,40 @@ static void read_logsv_config_obj_2() {
>                lgs_conf.logStreamFileFormat);
>        }
>      } else if (!strcmp(attribute->attrName, LOG_MAX_LOGRECSIZE)) {
> -      lgs_conf.logMaxLogrecsize = *((SaUint32T *)value);
> +      lgs_conf.logMaxLogrecsize = *reinterpret_cast<SaUint32T *>(value);
>        lgs_conf.logMaxLogrecsize_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logMaxLogrecsize: %u", lgs_conf.logMaxLogrecsize);
>      } else if (!strcmp(attribute->attrName,
> LOG_STREAM_SYSTEM_HIGH_LIMIT)) {
> -      lgs_conf.logStreamSystemHighLimit = *((SaUint32T *)value);
> +      lgs_conf.logStreamSystemHighLimit = *reinterpret_cast<SaUint32T
> *>(value);
>        lgs_conf.logStreamSystemHighLimit_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logStreamSystemHighLimit: %u",
>              lgs_conf.logStreamSystemHighLimit);
>      } else if (!strcmp(attribute->attrName,
> LOG_STREAM_SYSTEM_LOW_LIMIT)) {
> -      lgs_conf.logStreamSystemLowLimit = *((SaUint32T *)value);
> +      lgs_conf.logStreamSystemLowLimit = *reinterpret_cast<SaUint32T
> *>(value);
>        lgs_conf.logStreamSystemLowLimit_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logStreamSystemLowLimit: %u",
>              lgs_conf.logStreamSystemLowLimit);
>      } else if (!strcmp(attribute->attrName, LOG_STREAM_APP_HIGH_LIMIT)) {
> -      lgs_conf.logStreamAppHighLimit = *((SaUint32T *)value);
> +      lgs_conf.logStreamAppHighLimit = *reinterpret_cast<SaUint32T
> *>(value);
>        lgs_conf.logStreamAppHighLimit_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logStreamAppHighLimit: %u",
>              lgs_conf.logStreamAppHighLimit);
>      } else if (!strcmp(attribute->attrName, LOG_STREAM_APP_LOW_LIMIT)) {
> -      lgs_conf.logStreamAppLowLimit = *((SaUint32T *)value);
> +      lgs_conf.logStreamAppLowLimit = *reinterpret_cast<SaUint32T
> *>(value);
>        lgs_conf.logStreamAppLowLimit_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logStreamAppLowLimit: %u",
>              lgs_conf.logStreamAppLowLimit);
>      } else if (!strcmp(attribute->attrName,
> LOG_MAX_APPLICATION_STREAMS)) {
> -      lgs_conf.logMaxApplicationStreams = *((SaUint32T *)value);
> +      lgs_conf.logMaxApplicationStreams = *reinterpret_cast<SaUint32T
> *>(value);
>        lgs_conf.logMaxApplicationStreams_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logMaxApplicationStreams: %u",
>              lgs_conf.logMaxApplicationStreams);
>      } else if (!strcmp(attribute->attrName, LOG_FILE_IO_TIMEOUT)) {
> -      lgs_conf.logFileIoTimeout = *((SaUint32T *)value);
> +      lgs_conf.logFileIoTimeout = *reinterpret_cast<SaUint32T *>(value);
>        lgs_conf.logFileIoTimeout_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logFileIoTimeout: %u", lgs_conf.logFileIoTimeout);
>      } else if (!strcmp(attribute->attrName, LOG_FILE_SYS_CONFIG)) {
> -      lgs_conf.logFileSysConfig = *((SaUint32T *)value);
> +      lgs_conf.logFileSysConfig = *reinterpret_cast<SaUint32T *>(value);
>        lgs_conf.logFileSysConfig_cnfflag = LGS_CNF_OBJ;
>        TRACE("Conf obj; logFileSysConfig: %u", lgs_conf.logFileSysConfig);
>      } else if (!strcmp(attribute->attrName,
> @@ -1118,7 +1123,7 @@ done:
>   */
>  static void read_log_config_environ_var_2() {
>    char *val_str;
> -  unsigned long int val_uint;
> +  uint64_t val_uint;
> 
>    TRACE_ENTER();
> 
> @@ -1127,7 +1132,7 @@ static void read_log_config_environ_var_2() {
>     */
>    if (lgs_conf.logRootDirectory_cnfflag == LGS_CNF_DEF) {
>      /* Has not been set when reading config object */
> -    if ((val_str = getenv("LOGSV_ROOT_DIRECTORY")) != NULL) {
> +    if ((val_str = getenv("LOGSV_ROOT_DIRECTORY")) != nullptr) {
>        lgs_conf.logRootDirectory = val_str;
>        if (lgs_conf.logRootDirectory.size() > PATH_MAX) {
>          LOG_WA("LOG root dir read from config file is > PATH_MAX");
> @@ -1147,7 +1152,7 @@ static void read_log_config_environ_var_2() {
>     * Rule: Object has precedence
>     */
>    if (lgs_conf.logDataGroupname_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOGSV_DATA_GROUPNAME")) != NULL) {
> +    if ((val_str = getenv("LOGSV_DATA_GROUPNAME")) != nullptr) {
>        int n = snprintf(lgs_conf.logDataGroupname, UT_NAMESIZE, "%s",
> val_str);
>        if (n >= UT_NAMESIZE) {
>          /* Fail */
> @@ -1167,7 +1172,7 @@ static void read_log_config_environ_var_2() {
>     * Rule: Object has precedence
>     */
>    if (lgs_conf.logMaxLogrecsize_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOGSV_MAX_LOGRECSIZE")) != NULL) {
> +    if ((val_str = getenv("LOGSV_MAX_LOGRECSIZE")) != nullptr) {
>        /* errno = 0 is necessary as per the manpage of strtoul.
>         * Quoting here:
>         * NOTES:
> @@ -1198,7 +1203,7 @@ static void read_log_config_environ_var_2() {
>     */
>    /* logStreamSystemHighLimit */
>    if (lgs_conf.logStreamSystemHighLimit_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOG_STREAM_SYSTEM_HIGH_LIMIT")) != NULL) {
> +    if ((val_str = getenv("LOG_STREAM_SYSTEM_HIGH_LIMIT")) != nullptr) {
>        errno = 0;
>        val_uint = strtoul(val_str, NULL, 0);
>        if ((errno != 0) || (val_uint > UINT_MAX)) {
> @@ -1221,7 +1226,7 @@ static void read_log_config_environ_var_2() {
> 
>    /* logStreamSystemLowLimit */
>    if (lgs_conf.logStreamSystemLowLimit_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOG_STREAM_SYSTEM_LOW_LIMIT")) != NULL) {
> +    if ((val_str = getenv("LOG_STREAM_SYSTEM_LOW_LIMIT")) != nullptr) {
>        errno = 0;
>        val_uint = strtoul(val_str, NULL, 0);
>        if ((errno != 0) || (val_uint > UINT_MAX)) {
> @@ -1243,7 +1248,7 @@ static void read_log_config_environ_var_2() {
> 
>    /* logStreamAppHighLimit */
>    if (lgs_conf.logStreamAppHighLimit_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOG_STREAM_APP_HIGH_LIMIT")) != NULL) {
> +    if ((val_str = getenv("LOG_STREAM_APP_HIGH_LIMIT")) != nullptr) {
>        errno = 0;
>        val_uint = strtoul(val_str, NULL, 0);
>        if ((errno != 0) || (val_uint > UINT_MAX)) {
> @@ -1265,7 +1270,7 @@ static void read_log_config_environ_var_2() {
> 
>    /* logStreamAppLowLimit */
>    if (lgs_conf.logStreamAppLowLimit_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOG_STREAM_APP_LOW_LIMIT")) != NULL) {
> +    if ((val_str = getenv("LOG_STREAM_APP_LOW_LIMIT")) != nullptr) {
>        errno = 0;
>        val_uint = strtoul(val_str, NULL, 0);
>        if ((errno != 0) || (val_uint > UINT_MAX)) {
> @@ -1291,7 +1296,7 @@ static void read_log_config_environ_var_2() {
>     * Rule: Object has precedence
>     */
>    if (lgs_conf.logMaxApplicationStreams_cnfflag == LGS_CNF_DEF) {
> -    if ((val_str = getenv("LOG_MAX_APPLICATION_STREAMS")) != NULL) {
> +    if ((val_str = getenv("LOG_MAX_APPLICATION_STREAMS")) != nullptr) {
>        errno = 0;
>        val_uint = strtoul(val_str, NULL, 0);
>        if ((errno != 0) || (val_uint > UINT_MAX)) {
> @@ -1475,7 +1480,7 @@ bool lgs_path_is_writeable_dir_h(const std::string
> &pathname) {
>    apipar.data_in_size = params_in_size;
>    apipar.data_in = params_in_p;
>    apipar.data_out_size = 0;
> -  apipar.data_out = NULL;
> +  apipar.data_out = nullptr;
> 
>    api_rc = log_file_api(&apipar);
>    if (api_rc != LGSF_SUCESS) {
> @@ -1548,15 +1553,13 @@ void lgs_groupnameconf_set(const char
> *data_groupname_str) {
>   * @param immOiHandle[in]
>   */
>  void conf_runtime_obj_create(SaImmOiHandleT immOiHandle) {
> -  SaAisErrorT rc = SA_AIS_OK;
> -
>    TRACE_ENTER();
> 
>    /* Construct object with dn:
>     * logConfig=currentConfig,safApp=safLogService
>     */
>    char namestr[128];
> -  strcpy(namestr, "logConfig=currentConfig");
> +  snprintf(namestr, sizeof(namestr), "logConfig=currentConfig");
>    char *nameptr = namestr;
>    void *valarr[] = {&nameptr};
>    const SaImmAttrValuesT_2 attr_logConfig = {
> @@ -1571,7 +1574,7 @@ void conf_runtime_obj_create(SaImmOiHandleT
> immOiHandle) {
>    SaConstStringT parent_name = "safApp=safLogService";
>    osaf_extended_name_lend(parent_name, &parent_name_p);
> 
> -  rc = immutil_saImmOiRtObjectCreate_2(
> +  SaAisErrorT rc = immutil_saImmOiRtObjectCreate_2(
>        immOiHandle,
> const_cast<SaImmClassNameT>("OpenSafLogCurrentConfig"),
>        &parent_name_p, attrValues);
> 
> @@ -1586,31 +1589,6 @@ void conf_runtime_obj_create(SaImmOiHandleT
> immOiHandle) {
>  }
> 
>  /**
> - * Same as immutil_update_one_rattr() except that
> - *
> - * All parameters are input parameters
> - *
> - */
> -SaAisErrorT update_multival_rattr(SaImmOiHandleT immOiHandle, const
> char *dn,
> -                                  SaImmAttrNameT attributeName,
> -                                  SaImmValueTypeT attrValueType,
> -                                  SaUint32T attrValuesNumber, void
**values) {
> -  SaImmAttrModificationT_2 attrMod;
> -  const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, NULL};
> -  SaImmAttrValueT *attrValues = values;
> -  SaNameT objectName;
> -
> -  saAisNameLend(dn, &objectName);
> -
> -  attrMod.modType = SA_IMM_ATTR_VALUES_REPLACE;
> -  attrMod.modAttr.attrName = attributeName;
> -  attrMod.modAttr.attrValuesNumber = attrValuesNumber;
> -  attrMod.modAttr.attrValueType = attrValueType;
> -  attrMod.modAttr.attrValues = attrValues;
> -  return immutil_saImmOiRtObjectUpdate_2(immOiHandle, &objectName,
> attrMods);
> -}
> -
> -/**
>   * Creates a list of type void ** containing pointers to the
>   * strings in a C++ vector of strings
>   * Note: The attrValues C array is allocated and must be freed after use
> @@ -1626,12 +1604,13 @@ static SaUint32T
> vector_of_strings_to_attrValues(
> 
>    SaUint32T attrValuesNumber = strings_in->size();
> 
> -  char **values_array = (char **)calloc(attrValuesNumber, sizeof(void
**));
> +  char **values_array = reinterpret_cast<char **>(
> +                            calloc(attrValuesNumber, sizeof(void **)));
>    if (values_array == nullptr) {
>      LOG_ER("%s: calloc Fail, Aborted", __FUNCTION__);
>      osaf_abort(0);
>    }
> -  *attrValues_out = (void **)values_array;
> +  *attrValues_out = reinterpret_cast<void **>(values_array);
> 
>    SaUint32T i = 0;
>    for (auto &conf_string : *strings_in) {
> @@ -1664,7 +1643,8 @@ static SaAisErrorT update_runtime_attrValues(
>    SaNameT objectName;
>    SaAisErrorT ais_rc = SA_AIS_OK;
> 
> -  void **values_array = (void **)calloc(valuesNumber, sizeof(void *));
> +  void **values_array = reinterpret_cast<void **>(
> +                            calloc(valuesNumber, sizeof(void *)));
>    if (values_array == nullptr) {
>      LOG_ER("%s: calloc Fail, Aborted", __FUNCTION__);
>      osaf_abort(0);
> @@ -1731,65 +1711,76 @@ void conf_runtime_obj_hdl(SaImmOiHandleT
> immOiHandle,
>                            const SaImmAttrNameT *attributeNames) {
>    SaImmAttrNameT attributeName;
>    int i = 0;
> -  char *str_val = NULL;
> +  char *str_val = nullptr;
>    SaUint32T u32_val = 0;
>    SaAisErrorT ais_rc = SA_AIS_OK;
> 
>    TRACE_ENTER();
> 
> -  while ((attributeName = attributeNames[i++]) != NULL) {
> +  while ((attributeName = attributeNames[i++]) != nullptr) {
>      if (!strcmp(attributeName, LOG_ROOT_DIRECTORY)) {
> -      str_val = (char *)lgs_cfg_get(LGS_IMM_LOG_ROOT_DIRECTORY);
> +      str_val = const_cast<char *>(static_cast<const char *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_ROOT_DIRECTORY)));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SASTRINGT,
>                                          &str_val);
>      } else if (!strcmp(attributeName, LOG_DATA_GROUPNAME)) {
> -      str_val = (char *)lgs_cfg_get(LGS_IMM_DATA_GROUPNAME);
> +      str_val = const_cast<char *>(static_cast<const char *>(
> +                    lgs_cfg_get(LGS_IMM_DATA_GROUPNAME)));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SASTRINGT,
>                                          &str_val);
>      } else if (!strcmp(attributeName, LOG_STREAM_FILE_FORMAT)) {
> -      str_val = (char *)lgs_cfg_get(LGS_IMM_LOG_STREAM_FILE_FORMAT);
> +      str_val = const_cast<char *>(static_cast<const char *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_STREAM_FILE_FORMAT)));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SASTRINGT,
>                                          &str_val);
>      } else if (!strcmp(attributeName, LOG_MAX_LOGRECSIZE)) {
> -      u32_val = *(SaUint32T
> *)lgs_cfg_get(LGS_IMM_LOG_MAX_LOGRECSIZE);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_MAX_LOGRECSIZE));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_STREAM_SYSTEM_HIGH_LIMIT)) {
> -      u32_val = *(SaUint32T
> *)lgs_cfg_get(LGS_IMM_LOG_STREAM_SYSTEM_HIGH_LIMIT);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_STREAM_SYSTEM_HIGH_LIMIT));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_STREAM_SYSTEM_LOW_LIMIT)) {
> -      u32_val = *(SaUint32T
> *)lgs_cfg_get(LGS_IMM_LOG_STREAM_SYSTEM_LOW_LIMIT);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_STREAM_SYSTEM_LOW_LIMIT));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_STREAM_APP_HIGH_LIMIT)) {
> -      u32_val = *(SaUint32T
> *)lgs_cfg_get(LGS_IMM_LOG_STREAM_APP_HIGH_LIMIT);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_STREAM_APP_HIGH_LIMIT));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_STREAM_APP_LOW_LIMIT)) {
> -      u32_val = *(SaUint32T
> *)lgs_cfg_get(LGS_IMM_LOG_STREAM_APP_LOW_LIMIT);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_STREAM_APP_LOW_LIMIT));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_MAX_APPLICATION_STREAMS)) {
> -      u32_val = *(SaUint32T
> *)lgs_cfg_get(LGS_IMM_LOG_MAX_APPLICATION_STREAMS);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_MAX_APPLICATION_STREAMS));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_FILE_IO_TIMEOUT)) {
> -      u32_val = *(SaUint32T *)lgs_cfg_get(LGS_IMM_FILE_IO_TIMEOUT);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_FILE_IO_TIMEOUT));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
>      } else if (!strcmp(attributeName, LOG_FILE_SYS_CONFIG)) {
> -      u32_val = *(SaUint32T *)lgs_cfg_get(LGS_IMM_LOG_FILE_SYS_CONFIG);
> +      u32_val = *static_cast<const SaUint32T *>(
> +                    lgs_cfg_get(LGS_IMM_LOG_FILE_SYS_CONFIG));
>        ais_rc = immutil_update_one_rattr(immOiHandle,
> LGS_CFG_RUNTIME_OBJECT,
>                                          attributeName,
SA_IMM_ATTR_SAUINT32T,
>                                          &u32_val);
> @@ -1884,52 +1875,3 @@ void lgs_trace_config() {
>    /* Done reading */
>    osaf_mutex_unlock_ordie(&lgs_config_data_mutex);
>  }
> -
> -/**
> - * Print configuration values read using lgs_cfg_get()
> - */
> -void lgs_cfg_read_trace() {
> -  TRACE("##### LOG Configuration parameter read start #####");
> -  TRACE("logRootDirectory\t\t \"%s\"",
> -        static_cast<const char
> *>(lgs_cfg_get(LGS_IMM_LOG_ROOT_DIRECTORY)));
> -  TRACE("logDataGroupname\t\t \"%s\"",
> -        static_cast<const char
> *>(lgs_cfg_get(LGS_IMM_DATA_GROUPNAME)));
> -  TRACE("logStreamFileFormat\t\t \"%s\"",
> -        static_cast<const char
> *>(lgs_cfg_get(LGS_IMM_LOG_STREAM_FILE_FORMAT)));
> -  TRACE(
> -      "logMaxLogrecsize\t\t %u",
> -      *static_cast<const SaUint32T
> *>(lgs_cfg_get(LGS_IMM_LOG_MAX_LOGRECSIZE)));
> -  TRACE("logStreamSystemHighLimit\t %u",
> -        *static_cast<const SaUint32T *>(
> -            lgs_cfg_get(LGS_IMM_LOG_STREAM_SYSTEM_HIGH_LIMIT)));
> -  TRACE("logStreamSystemLowLimit\t %u",
> -        *static_cast<const SaUint32T *>(
> -            lgs_cfg_get(LGS_IMM_LOG_STREAM_SYSTEM_LOW_LIMIT)));
> -  TRACE("logStreamAppHighLimit\t %u",
> -        *static_cast<const SaUint32T *>(
> -            lgs_cfg_get(LGS_IMM_LOG_STREAM_APP_HIGH_LIMIT)));
> -  TRACE("logStreamAppLowLimit\t\t %u",
> -        *static_cast<const SaUint32T *>(
> -            lgs_cfg_get(LGS_IMM_LOG_STREAM_APP_LOW_LIMIT)));
> -  TRACE("logMaxApplicationStreams\t %u",
> -        *static_cast<const SaUint32T *>(
> -            lgs_cfg_get(LGS_IMM_LOG_MAX_APPLICATION_STREAMS)));
> -  TRACE("logFileIoTimeout\t\t %u",
> -        *static_cast<const SaUint32T
> *>(lgs_cfg_get(LGS_IMM_FILE_IO_TIMEOUT)));
> -  TRACE("logFileSysConfig\t\t %u", *static_cast<const SaUint32T
> *>(lgs_cfg_get(
> -                                       LGS_IMM_LOG_FILE_SYS_CONFIG)));
> -  // Multi value
> -  const std::vector<std::string> *dest_config =
> -      reinterpret_cast<const std::vector<std::string> *>(
> -
> lgs_cfg_get(LGS_IMM_LOG_RECORD_DESTINATION_CONFIGURATION));
> -  for (auto &conf_str : *dest_config) {
> -    TRACE("logRecordDestinationConfiguration '%s'", conf_str.c_str());
> -  }
> -  const std::vector<std::string> *dest_status =
> -      reinterpret_cast<const std::vector<std::string> *>(
> -          lgs_cfg_get(LGS_IMM_LOG_RECORD_DESTINATION_STATUS));
> -  for (auto &conf_str : *dest_status) {
> -    TRACE("logRecordDestinationStatus '%s'", conf_str.c_str());
> -  }
> -  TRACE("##### LOG Configuration parameter read done  #####");
> -}
> diff --git a/src/log/logd/lgs_config.h b/src/log/logd/lgs_config.h
> index 3af5bbabe..6885271a4 100644
> --- a/src/log/logd/lgs_config.h
> +++ b/src/log/logd/lgs_config.h
> @@ -304,7 +304,7 @@ int lgs_cfg_verify_mbox_limit(uint32_t high,
> uint32_t low);
>  int lgs_cfg_verify_max_application_streams(uint32_t max_app_streams);
>  int lgs_cfg_verify_file_io_timeout(uint32_t log_file_io_timeout);
>  int lgs_cfg_verify_log_record_destination_configuration(
> -    std::vector<std::string> &vdest, SaImmAttrModificationTypeT type);
> +    const std::vector<std::string> &vdest, SaImmAttrModificationTypeT
> type);
>  /*
>   * Functions for updating some parameters. Used to support check-point
> before
>   * version 5
> @@ -324,6 +324,5 @@ void conf_runtime_obj_hdl(SaImmOiHandleT
> immOiHandle,
>   *  Trace functions
>   */
>  void lgs_trace_config();
> -void lgs_cfg_read_trace();
> 
>  #endif  // LOG_LOGD_LGS_CONFIG_H_
> diff --git a/src/log/logd/lgs_dest.cc b/src/log/logd/lgs_dest.cc
> index 9f8be270f..0bd1fd3b0 100644
> --- a/src/log/logd/lgs_dest.cc
> +++ b/src/log/logd/lgs_dest.cc
> @@ -384,7 +384,7 @@ bool WriteToDestination(const RecordData& data,
> const VectorString& destnames) {
> 
>    // Origin is FQDN = <hostname>[.<networkname>]
>    // hostname = where the log record comes from (not active node)
> -  const std::string origin = std::string{data.hostname} + networkname;
> +  const std::string origin = std::string {data.hostname} + networkname;
> 
>    info.msgid = data.msgid;
>    info.log_record = data.logrec;
> diff --git a/src/log/logd/lgs_dest.h b/src/log/logd/lgs_dest.h
> index 0ae375c60..6fe7c1782 100644
> --- a/src/log/logd/lgs_dest.h
> +++ b/src/log/logd/lgs_dest.h
> @@ -15,8 +15,8 @@
>   *
>   */
> 
> -#ifndef SRC_LOG_LOGD_LGS_DEST_H_
> -#define SRC_LOG_LOGD_LGS_DEST_H_
> +#ifndef LOG_LOGD_LGS_DEST_H_
> +#define LOG_LOGD_LGS_DEST_H_
> 
>  #include <string>
>  #include <map>
> @@ -295,4 +295,4 @@ class DestinationHandler {
>    static DestinationHandler me_;
>  };
> 
> -#endif  // SRC_LOG_LOGD_LGS_DEST_H_
> +#endif  // LOG_LOGD_LGS_DEST_H_
> diff --git a/src/log/logd/lgs_evt.cc b/src/log/logd/lgs_evt.cc
> index 98ca5f71c..94a94b646 100644
> --- a/src/log/logd/lgs_evt.cc
> +++ b/src/log/logd/lgs_evt.cc
> @@ -16,20 +16,21 @@
>   *
>   */
> 
> +#include "log/logd/lgs_evt.h"
> +
>  #include <stdlib.h>
>  #include <cinttypes>
> -
> +#include <string>
>  #include "base/osaf_time.h"
> -#include "base/saf_error.h"
> -
> -#include "lgs_mbcsv_v1.h"
> -#include "lgs_mbcsv_v2.h"
> -#include "lgs_mbcsv_v6.h"
> -#include "lgs_recov.h"
> -#include "lgs_imm_gcfg.h"
>  #include "base/osaf_extended_name.h"
> -#include "lgs_clm.h"
> -#include "lgs_dest.h"
> +#include "base/saf_error.h"
> +#include "log/logd/lgs_mbcsv_v1.h"
> +#include "log/logd/lgs_mbcsv_v2.h"
> +#include "log/logd/lgs_mbcsv_v6.h"
> +#include "log/logd/lgs_recov.h"
> +#include "log/logd/lgs_imm_gcfg.h"
> +#include "log/logd/lgs_clm.h"
> +#include "log/logd/lgs_dest.h"
> 
>  void *client_db = nullptr; /* used for C++ STL map */
> 
> @@ -105,7 +106,7 @@ log_client_t *lgs_client_get_by_id(uint32_t
> client_id) {
>    } else {
>      TRACE("clm_node_id delete to map not exist failed : %x", client_id);
>    }
> -  if (NULL == rec) TRACE("client_id: %u lookup failed", client_id);
> +  if (nullptr == rec) TRACE("client_id: %u lookup failed", client_id);
> 
>    return rec;
>  }
> @@ -132,7 +133,7 @@ log_client_t *lgs_client_new(MDS_DEST mds_dest,
> uint32_t client_id,
> 
>    client = new log_client_t();
> 
> -  if (NULL == client) {
> +  if (nullptr == client) {
>      LOG_WA("lgs_client_new calloc FAILED");
>      goto done;
>    }
> @@ -153,7 +154,7 @@ log_client_t *lgs_client_new(MDS_DEST mds_dest,
> uint32_t client_id,
>        TRACE("unable to add clm node info map - the id %x already
existed",
>              client->client_id);
>        delete client;
> -      client = NULL;
> +      client = nullptr;
>      }
>    } else {
>      TRACE("can't find local sec map in lgs_clm_node_add");
> @@ -186,7 +187,7 @@ int lgs_client_delete(uint32_t client_id, time_t
> *closetime_ptr) {
>    /* Client DB */
>    ClientMap *clientMap(reinterpret_cast<ClientMap *>(client_db));
>    /* Initiate close time value if not provided via closetime_ptr */
> -  if (closetime_ptr == NULL) {
> +  if (closetime_ptr == nullptr) {
>      osaf_clock_gettime(CLOCK_REALTIME, &closetime_tspec);
>      closetime = closetime_tspec.tv_sec;
>    } else {
> @@ -194,18 +195,18 @@ int lgs_client_delete(uint32_t client_id, time_t
> *closetime_ptr) {
>    }
> 
>    /* Get client data */
> -  if ((client = lgs_client_get_by_id(client_id)) == NULL) {
> +  if ((client = lgs_client_get_by_id(client_id)) == nullptr) {
>      status = -1;
>      goto done;
>    }
> 
>    cur_rec = client->stream_list_root;
> -  while (NULL != cur_rec) {
> +  while (nullptr != cur_rec) {
>      lgs_stream_list_t *tmp_rec;
>      log_stream_t *stream = log_stream_get_by_id(cur_rec->stream_id);
>      TRACE_4("client_id: %u, REMOVE stream id: %u", client->client_id,
>              cur_rec->stream_id);
> -    if (stream != NULL) {
> +    if (stream != nullptr) {
>        log_stream_close(&stream, &closetime);
>      }
>      tmp_rec = cur_rec->next;
> @@ -248,13 +249,13 @@ int lgs_client_stream_add(uint32_t client_id,
> uint32_t stream_id) {
> 
>    TRACE_ENTER2("client_id %u, stream ID %u", client_id, stream_id);
> 
> -  if ((client = lgs_client_get_by_id(client_id)) == NULL) {
> +  if ((client = lgs_client_get_by_id(client_id)) == nullptr) {
>      rs = -1;
>      goto err_exit;
>    }
> 
>    stream = static_cast<lgs_stream_list_t
> *>(malloc(sizeof(lgs_stream_list_t)));
> -  if (stream == NULL) {
> +  if (stream == nullptr) {
>      LOG_WA("malloc FAILED");
>      rs = -1;
>      goto err_exit;
> @@ -284,12 +285,12 @@ int lgs_client_stream_rmv(uint32_t client_id,
> uint32_t stream_id) {
> 
>    TRACE_ENTER2("client_id %u, stream ID %u", client_id, stream_id);
> 
> -  if ((client = lgs_client_get_by_id(client_id)) == NULL) {
> +  if ((client = lgs_client_get_by_id(client_id)) == nullptr) {
>      rc = -1;
>      goto done;
>    }
> 
> -  if (NULL == client->stream_list_root) {
> +  if (nullptr == client->stream_list_root) {
>      rc = -2;
>      goto done;
>    }
> @@ -309,7 +310,7 @@ int lgs_client_stream_rmv(uint32_t client_id,
> uint32_t stream_id) {
>      }
>      last_rec = cur_rec;
>      cur_rec = last_rec->next;
> -  } while (NULL != cur_rec);
> +  } while (nullptr != cur_rec);
> 
>  done:
>    TRACE_LEAVE();
> @@ -327,7 +328,7 @@ done:
>   */
>  int lgs_client_delete_by_mds_dest(MDS_DEST mds_dest, time_t
> *closetime_ptr) {
>    uint32_t rc = 0;
> -  log_client_t *rp = NULL;
> +  log_client_t *rp = nullptr;
> 
>    TRACE_ENTER2("mds_dest %" PRIx64, mds_dest);
>    /* Loop through Client DB */
> @@ -356,28 +357,28 @@ int lgs_client_delete_by_mds_dest(MDS_DEST
> mds_dest, time_t *closetime_ptr) {
> 
> **************************************************************
> **************/
>  uint32_t lgs_remove_lga_down_rec(lgs_cb_t *cb, MDS_DEST mds_dest) {
>    LGA_DOWN_LIST *lga_down_rec = cb->lga_down_list_head;
> -  LGA_DOWN_LIST *prev = NULL;
> +  LGA_DOWN_LIST *prev = nullptr;
>    while (lga_down_rec) {
>      if (m_NCS_MDS_DEST_EQUAL(&lga_down_rec->mds_dest, &mds_dest)) {
>        /* Remove the LGA entry */
>        /* Reset pointers */
>        if (lga_down_rec == cb->lga_down_list_head) { /* 1st in the list?
*/
> -        if (lga_down_rec->next == NULL) {           /* Only one in the
list? */
> -          cb->lga_down_list_head = NULL; /* Clear head sublist pointer */
> -          cb->lga_down_list_tail = NULL; /* Clear tail sublist pointer */
> +        if (lga_down_rec->next == nullptr) {        /* Only one in the
list? */
> +          cb->lga_down_list_head = nullptr; /* Clear head sublist pointer
*/
> +          cb->lga_down_list_tail = nullptr; /* Clear tail sublist pointer
*/
>          } else {                         /* 1st but not only one */
>            cb->lga_down_list_head = lga_down_rec->next; /* Move next one
up
> */
>          }
>        } else { /* Not 1st in the list */
>          if (prev) {
> -          if (lga_down_rec->next == NULL) cb->lga_down_list_tail = prev;
> +          if (lga_down_rec->next == nullptr) cb->lga_down_list_tail =
prev;
>            prev->next = lga_down_rec->next; /* Link previous to next */
>          }
>        }
> 
>        /* Free the EDA_DOWN_REC */
>        free(lga_down_rec);
> -      lga_down_rec = NULL;
> +      lga_down_rec = nullptr;
>        break;
>      }
>      prev = lga_down_rec;               /* Remember address of this entry
*/
> @@ -445,18 +446,18 @@ static uint32_t
> proc_lga_updn_mds_msg(lgsv_lgs_evt_t *evt) {
>            }
>          }
>        } else if (lgs_cb->ha_state == SA_AMF_HA_STANDBY) {
> -        LGA_DOWN_LIST *lga_down_rec = NULL;
> +        LGA_DOWN_LIST *lga_down_rec = nullptr;
>          if (lgs_lga_entry_valid(lgs_cb, evt->fr_dest)) {
>            lga_down_rec =
>                static_cast<LGA_DOWN_LIST
*>(malloc(sizeof(LGA_DOWN_LIST)));
> -          if (NULL == lga_down_rec) {
> +          if (nullptr == lga_down_rec) {
>              /* Log it */
>              LOG_WA("memory allocation for the LGA_DOWN_LIST failed");
>              break;
>            }
>            memset(lga_down_rec, 0, sizeof(LGA_DOWN_LIST));
>            lga_down_rec->mds_dest = evt->fr_dest;
> -          if (lgs_cb->lga_down_list_head == NULL) {
> +          if (lgs_cb->lga_down_list_head == nullptr) {
>              lgs_cb->lga_down_list_head = lga_down_rec;
>            } else {
>              if (lgs_cb->lga_down_list_tail)
> @@ -502,8 +503,9 @@ static uint32_t
> proc_mds_quiesced_ack_msg(lgsv_lgs_evt_t *evt) {
> 
>      /* Finally respond to AMF */
>      saAmfResponse(lgs_cb->amf_hdl, lgs_cb->amf_invocation_id,
> SA_AIS_OK);
> -  } else
> +  } else {
>      LOG_ER("Received LGSV_EVT_QUIESCED_ACK message but
> is_quiesced_set==false");
> +  }
> 
>    TRACE_LEAVE();
>    return NCSCC_RC_SUCCESS;
> @@ -516,7 +518,7 @@ static uint32_t
> proc_mds_quiesced_ack_msg(lgsv_lgs_evt_t *evt) {
>  static void lgs_process_lga_down_list() {
>    struct timespec closetime_tspec;
>    if (lgs_cb->ha_state == SA_AMF_HA_ACTIVE) {
> -    LGA_DOWN_LIST *temp_lga_down_rec = NULL;
> +    LGA_DOWN_LIST *temp_lga_down_rec = nullptr;
>      osaf_clock_gettime(CLOCK_REALTIME, &closetime_tspec);
>      time_t closetime = closetime_tspec.tv_sec;
> 
> @@ -530,8 +532,8 @@ static void lgs_process_lga_down_list() {
>        lga_down_rec = lga_down_rec->next;
>        free(temp_lga_down_rec);
>      }
> -    lgs_cb->lga_down_list_head = NULL;
> -    lgs_cb->lga_down_list_tail = NULL;
> +    lgs_cb->lga_down_list_head = nullptr;
> +    lgs_cb->lga_down_list_tail = nullptr;
>    }
>  }
> 
> @@ -653,8 +655,8 @@ static uint32_t lgs_ckpt_initialized_client(lgs_cb_t
> *cb, MDS_DEST mds_dest,
>    uint32_t async_rc = NCSCC_RC_SUCCESS;
>    lgsv_ckpt_msg_v1_t ckpt_v1;
>    lgsv_ckpt_msg_v6_t ckpt_v6;
> -  void *ckpt_ptr = NULL;
> -  lgsv_ckpt_header_t *header_ptr = NULL;
> +  void *ckpt_ptr = nullptr;
> +  lgsv_ckpt_header_t *header_ptr = nullptr;
> 
>    TRACE_ENTER();
> 
> @@ -705,7 +707,7 @@ static uint32_t proc_initialize_msg(lgs_cb_t *cb,
> lgsv_lgs_evt_t *evt) {
>    SaAisErrorT ais_rc = SA_AIS_OK;
>    SaVersionT *version;
>    lgsv_msg_t msg;
> -  log_client_t *client = NULL;
> +  log_client_t *client = nullptr;
> 
>    TRACE_ENTER2("dest %" PRIx64, evt->fr_dest);
> 
> @@ -730,7 +732,7 @@ static uint32_t proc_initialize_msg(lgs_cb_t *cb,
> lgsv_lgs_evt_t *evt) {
>      goto snd_rsp;
>    }
> 
> -  if ((client = lgs_client_new(evt->fr_dest, 0, NULL)) == NULL) {
> +  if ((client = lgs_client_new(evt->fr_dest, 0, nullptr)) == nullptr) {
>      ais_rc = SA_AIS_ERR_NO_MEMORY;
>      goto snd_rsp;
>    }
> @@ -863,7 +865,7 @@ SaAisErrorT
> create_new_app_stream(lgsv_stream_open_req_t *open_sync_param,
>      goto done;
>    }
> 
> -  if (open_sync_param->logFileFmt == NULL) {
> +  if (open_sync_param->logFileFmt == nullptr) {
>      TRACE("logFileFmt is NULL, use default one");
>      const char *logFileFormat =
>          static_cast<const char
> *>(lgs_cfg_get(LGS_IMM_LOG_STREAM_FILE_FORMAT));
> @@ -933,7 +935,7 @@ SaAisErrorT
> create_new_app_stream(lgsv_stream_open_req_t *open_sync_param,
>    }
> 
>    *o_stream = log_stream_new(str_name, STREAM_NEW);
> -  if (*o_stream == NULL) {
> +  if (*o_stream == nullptr) {
>      rc = SA_AIS_ERR_NO_MEMORY;
>      goto done;
>    }
> @@ -997,7 +999,7 @@ static SaAisErrorT
> file_attribute_cmp(lgsv_stream_open_req_t *open_sync_param,
>            open_sync_param->logFilePathName,
>            applicationStream->pathName.c_str());
>      rs = SA_AIS_ERR_EXIST;
> -  } else if ((open_sync_param->logFileFmt != NULL) &&
> +  } else if ((open_sync_param->logFileFmt != nullptr) &&
>               strcmp(applicationStream->logFileFormat,
>                      open_sync_param->logFileFmt) != 0) {
>      TRACE("logFile format differs, new: %s existing: %s",
> @@ -1048,7 +1050,7 @@ static uint32_t proc_stream_open_msg(lgs_cb_t
> *cb, lgsv_lgs_evt_t *evt) {
>    }
> 
>    logStream = log_stream_get_by_name(name);
> -  if (logStream != NULL) {
> +  if (logStream != nullptr) {
>      TRACE("existing stream - id %u", logStream->streamId);
>      if (logStream->streamType == STREAM_TYPE_APPLICATION) {
>        /* Verify the creation attributes for an existing appl. stream */
> @@ -1205,7 +1207,7 @@ static uint32_t proc_stream_close_msg(lgs_cb_t
> *cb, lgsv_lgs_evt_t *evt) {
>      goto snd_rsp;
>    }
> 
> -  if ((stream = log_stream_get_by_id(close_param->lstr_id)) == NULL) {
> +  if ((stream = log_stream_get_by_id(close_param->lstr_id)) == nullptr) {
>      TRACE("Bad stream ID");
>      ais_rc = SA_AIS_ERR_BAD_HANDLE;
>      goto snd_rsp;
> @@ -1279,9 +1281,9 @@ snd_rsp:
>  static uint32_t proc_write_log_async_msg(lgs_cb_t *cb, lgsv_lgs_evt_t
> *evt) {
>    lgsv_write_log_async_req_t *param =
>        &(evt->info.msg.info.api_info.param).write_log_async;
> -  log_stream_t *stream = NULL;
> +  log_stream_t *stream = nullptr;
>    SaAisErrorT error = SA_AIS_OK;
> -  SaStringT logOutputString = NULL;
> +  SaStringT logOutputString = nullptr;
>    SaUint32T buf_size;
>    int n, rc = 0;
>    lgsv_ckpt_msg_v1_t ckpt_v1;
> @@ -1305,13 +1307,13 @@ static uint32_t
> proc_write_log_async_msg(lgs_cb_t *cb, lgsv_lgs_evt_t *evt) {
>      goto done;
>    }
> 
> -  if (lgs_client_get_by_id(param->client_id) == NULL) {
> +  if (lgs_client_get_by_id(param->client_id) == nullptr) {
>      TRACE("Bad client ID: %u", param->client_id);
>      error = SA_AIS_ERR_BAD_HANDLE;
>      goto done;
>    }
> 
> -  if ((stream = log_stream_get_by_id(param->lstr_id)) == NULL) {
> +  if ((stream = log_stream_get_by_id(param->lstr_id)) == nullptr) {
>      TRACE("Bad stream ID: %u", param->lstr_id);
>      error = SA_AIS_ERR_BAD_HANDLE;
>      goto done;
> @@ -1336,7 +1338,7 @@ static uint32_t
> proc_write_log_async_msg(lgs_cb_t *cb, lgsv_lgs_evt_t *evt) {
>                                               :
stream->fixedLogRecordSize;
>    logOutputString = static_cast<char *>(
>        calloc(1, buf_size + 1)); /* Make room for a '\0' termination */
> -  if (logOutputString == NULL) {
> +  if (logOutputString == nullptr) {
>      LOG_ER("Could not allocate %d bytes", stream->fixedLogRecordSize +
1);
>      error = SA_AIS_ERR_NO_MEMORY;
>      goto done;
> @@ -1447,9 +1449,9 @@ done:
> 
>      Other cases, the allocator frees it.
>    */
> -  if ((rc != -2) && (logOutputString != NULL)) {
> +  if ((rc != -2) && (logOutputString != nullptr)) {
>      free(logOutputString);
> -    logOutputString = NULL;
> +    logOutputString = nullptr;
>    }
> 
>    if (param->ack_flags == SA_LOG_RECORD_WRITE_ACK)
> @@ -1543,7 +1545,7 @@ void lgs_process_mbx(SYSF_MBX *mbx) {
[Vu] lgs_evt.cc has two public interfaces, but is not included in its header
file lgs_evt.h
1) lgs_cb_init()
2) lgs_process_mbx()

Consider to put them in correct places.

>    lgsv_lgs_evt_t *msg;
> 
>    msg = reinterpret_cast<lgsv_lgs_evt_t
> *>(m_NCS_IPC_NON_BLK_RECEIVE(mbx, msg));
> -  if (msg != NULL) {
> +  if (msg != nullptr) {
>      if (lgs_cb->ha_state == SA_AMF_HA_ACTIVE) {
>        if (msg->evt_type <= LGSV_LGS_EVT_LGA_DOWN) {
>          lgs_lgsv_top_level_evt_dispatch_tbl[msg->evt_type](msg);
> @@ -1553,8 +1555,9 @@ void lgs_process_mbx(SYSF_MBX *mbx) {
>          TRACE("Jolted the main thread so it picks up the new IMM FD");
>        } else if (msg->evt_type == LGSV_EVT_RDA) {
>          TRACE("ignoring RDA message for role %u", msg-
> >info.rda_info.io_role);
> -      } else
> +      } else {
>          LOG_ER("message type invalid");
> +      }
>      } else {
>        if (msg->evt_type == LGSV_LGS_EVT_LGA_DOWN) {
>          lgs_lgsv_top_level_evt_dispatch_tbl[msg->evt_type](msg);
> diff --git a/src/log/logd/lgs_evt.h b/src/log/logd/lgs_evt.h
> index 24542293d..156dd8a08 100644
> --- a/src/log/logd/lgs_evt.h
> +++ b/src/log/logd/lgs_evt.h
> @@ -23,8 +23,7 @@
>  #include "rde/agent/rda_papi.h"
>  #include "mds/mds_papi.h"
>  #include "log/common/lgsv_msg.h"
> -
> -#include "lgs_cb.h"
> +#include "log/logd/lgs_cb.h"
> 
>  typedef enum lgsv_lgs_evt_type {
>    LGSV_LGS_LGSV_MSG = 0,
> @@ -47,13 +46,13 @@ typedef struct lgsv_lgs_evt {
>    struct lgsv_lgs_evt *next;
>    struct timespec entered_at;
>    uint32_t cb_hdl;
> -  MDS_SYNC_SND_CTXT mds_ctxt; /* Relevant when this event has to be
> responded to
> -                               * in a synchronous fashion.
> -                               */
> +  // Relevant when this event has to be responded to
> +  // in a synchronous fashion.
> +  MDS_SYNC_SND_CTXT mds_ctxt;
>    MDS_DEST fr_dest;
>    NODE_ID fr_node_id;
>    char node_name[_POSIX_HOST_NAME_MAX];
> -  MDS_SEND_PRIORITY_TYPE rcvd_prio; /* Priority of the recvd evt */
> +  MDS_SEND_PRIORITY_TYPE rcvd_prio;  // Priority of the recvd evt
>    LGSV_LGS_EVT_TYPE evt_type;
>    union {
>      lgsv_msg_t msg;
> @@ -62,11 +61,11 @@ typedef struct lgsv_lgs_evt {
>    } info;
>  } lgsv_lgs_evt_t;
> 
> -/* Client DB */
> -extern void *client_db; /* used for C++ STL map */
> +// Client DB
> +extern void *client_db;  // used for C++ STL map
>  typedef std::map<NODE_ID, log_client_t *> ClientMap;
> 
> -/* These are the function prototypes for event handling */
> +// These are the function prototypes for event handling
>  typedef uint32_t (*LGSV_LGS_LGA_API_MSG_HANDLER)(lgs_cb_t *,
>                                                   lgsv_lgs_evt_t *evt);
>  typedef uint32_t (*LGSV_LGS_EVT_HANDLER)(lgsv_lgs_evt_t *evt);
> diff --git a/src/log/logd/lgs_file.cc b/src/log/logd/lgs_file.cc
> index 678ebbd77..dbb29cf82 100644
> --- a/src/log/logd/lgs_file.cc
> +++ b/src/log/logd/lgs_file.cc
> @@ -16,26 +16,24 @@
>   */
> 
>  #include "log/logd/lgs_file.h"
> -#include "log/logd/lgs_filehdl.h"
> 
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <stdbool.h>
>  #include <stdint.h>
>  #include <string.h>
> -
>  #include <unistd.h>
> -
> -#include "base/logtrace.h"
>  #include <errno.h>
>  #include <pthread.h>
>  #include <time.h>
> -#include "base/ncsgl_defs.h"
> 
> -#include "log/logd/lgs.h"
> +#include "base/ncsgl_defs.h"
> +#include "base/logtrace.h"
>  #include "base/osaf_utility.h"
>  #include "base/osaf_time.h"
> -#include "lgs_config.h"
> +#include "log/logd/lgs.h"
> +#include "log/logd/lgs_config.h"
> +#include "log/logd/lgs_filehdl.h"
> 
>  pthread_mutex_t lgs_ftcom_mutex;  /* For locking communication */
>  static pthread_cond_t request_cv; /* File thread waiting for request */
> @@ -57,9 +55,9 @@ struct file_communicate {
>          timeout_f(false),
>          request_code(LGSF_NOREQ),
>          return_code(LGSF_NORETC),
> -        indata_ptr(NULL),
> +        indata_ptr(nullptr),
>          outdata_size(0),
> -        outdata_ptr(NULL) {}
> +        outdata_ptr(nullptr) {}
>  };
> 
>  /* Used for synchronizing and transfer of data ownership between main
> thread
> @@ -255,7 +253,7 @@ static int start_file_thread() {
>    /* Create thread.
>     */
>    rc = pthread_create(&file_thread_id, NULL, file_hndl_thread,
> -                      (void *)&tbd_inpar);
> +                      static_cast<void *>(&tbd_inpar));
[Vu] Is it necessary to have cast from int* to void*?

>    if (rc != 0) {
>      LOG_ER("pthread_create fail %s", strerror(errno));
>      goto done;
> @@ -294,8 +292,8 @@ typedef struct fd_list {
>    int32_t fd;
>  } fd_list_t;
> 
> -static fd_list_t *fd_first_p = NULL;
> -static fd_list_t *fd_last_p = NULL;
> +static fd_list_t *fd_first_p = nullptr;
> +static fd_list_t *fd_last_p = nullptr;
> 
>  /**
>   * Add stream file descriptor to list
> @@ -309,7 +307,7 @@ void lgs_fd_list_add(int32_t fd) {
>    fd_new_p = static_cast<fd_list_t *>(malloc(sizeof(fd_list_t)));
>    osafassert(fd_new_p);
> 
> -  if (fd_first_p == NULL) {
> +  if (fd_first_p == nullptr) {
>      /* First in list */
>      fd_first_p = fd_new_p;
>      fd_last_p = fd_new_p;
> @@ -319,7 +317,7 @@ void lgs_fd_list_add(int32_t fd) {
>    }
> 
>    fd_new_p->fd = fd;
> -  fd_new_p->fd_next_p = NULL;
> +  fd_new_p->fd_next_p = nullptr;
> 
>    TRACE_LEAVE();
>  }
> @@ -332,7 +330,7 @@ int32_t lgs_fd_list_get() {
>    int32_t r_fp;
>    fd_list_t *fd_rem_p;
> 
> -  if (fd_first_p == NULL) {
> +  if (fd_first_p == nullptr) {
>      /* List empty */
>      return -1;
>    }
> @@ -340,9 +338,9 @@ int32_t lgs_fd_list_get() {
>    r_fp = fd_first_p->fd; /* fd to return */
>    fd_rem_p = fd_first_p;
>    fd_first_p = fd_rem_p->fd_next_p;
> -  if (fd_first_p == NULL) {
> +  if (fd_first_p == nullptr) {
>      /* List is empty */
> -    fd_last_p = NULL;
> +    fd_last_p = nullptr;
>    }
> 
>    free(fd_rem_p);
> @@ -385,27 +383,27 @@ lgsf_retcode_t log_file_api(lgsf_apipar_t
> *apipar_in) {
>            apipar_in->req_code_in);
>      apipar_in->req_code_in = LGSF_FILECLOSE;
>      apipar_in->data_in_size = sizeof(int);
> -    apipar_in->data_in = (void *)&fd;
> +    apipar_in->data_in = static_cast<void *>(&fd);
[Vu]  Don't need to cast int* to void*. I think it is ok to use: data_in =
&fd;

>      apipar_in->data_out_size = 0;
> -    apipar_in->data_out = NULL;
> +    apipar_in->data_out = nullptr;
>      busy_close_flag = true;
>    }
> 
>    /* Free request data before allocating new memeory */
> -  if (lgs_com_data.indata_ptr != NULL) {
> +  if (lgs_com_data.indata_ptr != nullptr) {
>      free(lgs_com_data.indata_ptr);
> -    lgs_com_data.indata_ptr = NULL;
> +    lgs_com_data.indata_ptr = nullptr;
>    }
> -  if (lgs_com_data.outdata_ptr != NULL) {
> +  if (lgs_com_data.outdata_ptr != nullptr) {
>      free(lgs_com_data.outdata_ptr);
> -    lgs_com_data.outdata_ptr = NULL;
> +    lgs_com_data.outdata_ptr = nullptr;
>    }
> 
>    /* Allocate memory and enter data for a request */
>    lgs_com_data.request_code = apipar_in->req_code_in;
>    if (apipar_in->data_in_size != 0) {
>      lgs_com_data.indata_ptr = malloc(apipar_in->data_in_size);
> -    if (lgs_com_data.indata_ptr == NULL) {
> +    if (lgs_com_data.indata_ptr == nullptr) {
>        LOG_ER("%s Could not allocate memory for in data", __FUNCTION__);
>        api_rc = LGSF_FAIL;
>        goto api_exit;
> @@ -413,19 +411,19 @@ lgsf_retcode_t log_file_api(lgsf_apipar_t
> *apipar_in) {
>      memcpy(lgs_com_data.indata_ptr, apipar_in->data_in,
>             apipar_in->data_in_size);
>    } else {
> -    lgs_com_data.indata_ptr = NULL;
> +    lgs_com_data.indata_ptr = nullptr;
>    }
> 
>    if (apipar_in->data_out_size != 0) {
>      lgs_com_data.outdata_ptr = malloc(apipar_in->data_out_size);
> -    if (lgs_com_data.outdata_ptr == NULL) {
> +    if (lgs_com_data.outdata_ptr == nullptr) {
>        LOG_ER("%s Could not allocate memory for out data", __FUNCTION__);
>        api_rc = LGSF_FAIL;
>        goto api_exit;
>      }
> -    *(char *)lgs_com_data.outdata_ptr = '\0';
> +    *static_cast<char *>(lgs_com_data.outdata_ptr) = '\0';
>    } else {
> -    lgs_com_data.outdata_ptr = NULL;
> +    lgs_com_data.outdata_ptr = nullptr;
>    }
>    lgs_com_data.outdata_size = apipar_in->data_out_size;
> 
> @@ -498,7 +496,7 @@ char *lgsf_retcode_str(lgsf_retcode_t rc) {
>      case LGSF_FAIL:
>        return const_cast<char *>("LGSF_FAIL");
>      default:
> -      sprintf(errstr, "Unknown lgsf_retcode %d", rc);
> +      snprintf(errstr, sizeof(errstr),  "Unknown lgsf_retcode %d", rc);
>        return errstr;
>    }
>  }
> diff --git a/src/log/logd/lgs_filehdl.cc b/src/log/logd/lgs_filehdl.cc
> index 2f22c4657..be2b95e1f 100644
> --- a/src/log/logd/lgs_filehdl.cc
> +++ b/src/log/logd/lgs_filehdl.cc
> @@ -25,10 +25,10 @@
>  #include <fcntl.h>
>  #include <sys/stat.h>
>  #include <unistd.h>
> +#include <string>
> 
>  #include "base/logtrace.h"
>  #include "base/osaf_time.h"
> -
>  #include "log/logd/lgs.h"
> 
>  extern pthread_mutex_t lgs_ftcom_mutex; /* For locking communication */
> @@ -51,7 +51,7 @@ int path_is_writeable_dir_hdl(void *indata, void
> *outdata, size_t max_outsize) {
>    int is_writeable_dir = 0;
>    struct stat pathstat;
> 
> -  char *pathname = (char *)indata;
> +  char *pathname = static_cast<char *>(indata);
> 
>    TRACE_ENTER();
> 
> @@ -97,7 +97,7 @@ done:
>   */
>  int check_path_exists_hdl(void *indata, void *outdata, size_t
max_outsize) {
>    struct stat pathstat;
> -  char *path_str = (char *)indata;
> +  char *path_str = static_cast<char *>(indata);
>    int rc = 0;
> 
>    osaf_mutex_unlock_ordie(&lgs_ftcom_mutex); /* UNLOCK  Critical section
> */
> @@ -162,9 +162,9 @@ int create_config_file_hdl(void *indata, void
> *outdata, size_t max_outsize) {
> 
>    /* Create the config file */
>    do {
> -    if ((filp = fopen(file_path, "w")) != NULL) break;
> +    if ((filp = fopen(file_path, "w")) != nullptr) break;
>    } while (errno == EINTR);
> -  if (filp == NULL) {
> +  if (filp == nullptr) {
>      LOG_NO("Could not open '%s' - %s", file_path, strerror(errno));
>      rc = -1;
>      goto done;
> @@ -305,9 +305,9 @@ done:
>      But consider it as a trade-off to have a better performance of LOGsv
>      as time-out occurs very rarely.
>    */
> -  if ((*timeout_f == true) && (logrecord != NULL)) {
> +  if ((*timeout_f == true) && (logrecord != nullptr)) {
>      free(logrecord);
> -    logrecord = NULL;
> +    logrecord = nullptr;
>    }
> 
>    TRACE_LEAVE2("rc = %d", rc);
> @@ -337,8 +337,8 @@ int make_log_dir_hdl(void *indata, void *outdata,
> size_t max_outsize) {
>    std::string rootpath = params_in->root_dir;
>    std::string dir_to_make;
>    std::string mpath;
> -  const char *spath_p = NULL;
> -  const char *epath_p = NULL;
> +  const char *spath_p = nullptr;
> +  const char *epath_p = nullptr;
>    int path_len = 0;
> 
>    TRACE_ENTER();
> @@ -372,7 +372,7 @@ int make_log_dir_hdl(void *indata, void *outdata,
> size_t max_outsize) {
> 
>    /* Create the path */
>    spath_p = epath_p = dir_to_make.c_str();
> -  while ((epath_p = strchr(epath_p, '/')) != NULL) {
> +  while ((epath_p = strchr(epath_p, '/')) != nullptr) {
>      if (epath_p == spath_p) {
>        epath_p++;
>        continue; /* Don't try to create path "/" */
> @@ -796,9 +796,9 @@ int get_number_of_cfg_files_hdl(void *indata, void
> *outdata,
> 
>      if ((old_ind != -1) && (cfg_old_date == log_old_date) &&
>          (cfg_old_time <= log_old_time)) {
> -      TRACE_1(
> -          " (cfg_old_date:%d == log_old_date:%d) && (cfg_old_time:%d <=
> log_old_time:%d )",
> -          cfg_old_date, log_old_date, cfg_old_time, log_old_time);
> +      TRACE_1(" (cfg_old_date:%d == log_old_date:%d) &&"
> +              " (cfg_old_time:%d <= log_old_time:%d )",
> +              cfg_old_date, log_old_date, cfg_old_time, log_old_time);
>        TRACE_1("oldest: %s", cfg_namelist[old_ind]->d_name);
>        n = snprintf(oldest_file, max_outsize, "%s/%s", path.c_str(),
>                     cfg_namelist[old_ind]->d_name);
> @@ -924,7 +924,7 @@ done_exit:
>  static int chr_cnt_b(char *str, char c, int lim) {
>    int cnt = 0;
> 
> -  if ((str == NULL) || (*str == '\0')) {
> +  if ((str == nullptr) || (*str == '\0')) {
>      TRACE("%s: Parameter error", __FUNCTION__);
>      return 0;
>    }
> @@ -954,13 +954,13 @@ static int chr_cnt_b(char *str, char c, int lim) {
>  /* Filename prefix (no timestamps or extension */
>  static std::string file_name_find_g;
>  static int filter_logfile_name(const struct dirent *finfo) {
> -  bool name_found = false, ext_found = false;
> +  int found = 0;
> 
> -  if (strstr(finfo->d_name, file_name_find_g.c_str()) != NULL)
> -    name_found = true;
> -  if (strstr(finfo->d_name, ".log") != NULL) ext_found = true;
> +  if ((strstr(finfo->d_name, file_name_find_g.c_str()) != nullptr) &&
> +      (strstr(finfo->d_name, ".log") != nullptr))
> +    found = 1;
> 
> -  return (int)(name_found && ext_found);
> +  return found;
>  }
> 
>  /**
> @@ -976,7 +976,7 @@ static int filter_logfile_name(const struct dirent
> *finfo) {
>   * @return -1 on error filename_o is not valid
>   */
>  static int filename_get(char *filepath_i, char *filename_i,
> -                        std::string &filename_o, std::string &curname_o,
> +                        std::string *filename_o, std::string *curname_o,
>                          uint32_t *fsize) {
>    int rc = 0;
>    int num_files = 0;
> @@ -985,7 +985,7 @@ static int filename_get(char *filepath_i, char
> *filename_i,
>    struct stat statbuf;
>    std::string file_path;
>    double time_tmp;
> -  char *str_p = NULL;
> +  char *str_p = nullptr;
>    int len = 0;
>    /* Time newest file */
>    double time_new = 0;
> @@ -997,8 +997,8 @@ static int filename_get(char *filepath_i, char
> *filename_i,
>    TRACE_ENTER();
> 
>    // /* Initiate out data */
> -  filename_o.clear();
> -  curname_o.clear();
> +  filename_o->clear();
> +  curname_o->clear();
>    *fsize = 0;
> 
>    /* Create a list of all .log files that has
> @@ -1029,7 +1029,7 @@ static int filename_get(char *filepath_i, char
> *filename_i,
>      }
> 
>      /* Save found file name */
> -    filename_o = namelist[0]->d_name;
> +    *filename_o = namelist[0]->d_name;
> 
>      /* Handle current log file output */
>      goto done_hdl_cur;
> @@ -1068,15 +1068,15 @@ static int filename_get(char *filepath_i, char
> *filename_i,
>    *fsize = 0;
>    if (empty_flg_new == false) {
>      /* Give the newest filename and its size. File is not empty */
> -    filename_o = namelist[name_ix_new]->d_name;
> +    *filename_o = namelist[name_ix_new]->d_name;
>      *fsize = statbuf.st_size;
>    } else if (empty_flg_prv == false) {
>      /* Give the second newest filename. File is not empty */
> -    filename_o = namelist[name_ix_prv]->d_name;
> +    *filename_o = namelist[name_ix_prv]->d_name;
>    } else {
>      /* Both files are empty. This is an error */
>      TRACE("%s: Both newest and second newest are empy", __FUNCTION__);
> -    filename_o.clear();
> +    filename_o->clear();
>      rc = -1;
>    }
> 
> @@ -1086,7 +1086,7 @@ done_hdl_cur:
>    str_p = namelist[name_ix_new]->d_name + len;
>    if (chr_cnt_b(str_p, '_', 4) == 2) {
>      /* Newest is current log file */
> -    curname_o = namelist[name_ix_new]->d_name;
> +    *curname_o = namelist[name_ix_new]->d_name;
>    }
> 
>  done_free:
> @@ -1111,13 +1111,13 @@ done:
>   * @return record Id or -1 on error. Set to 0 if no error but no Id is
found
>   */
>  static int record_id_get(const char *file_path) {
> -  FILE *fd = NULL;
> +  FILE *fd = nullptr;
>    int id_rc = 0;
>    int i;
>    int c;
> -  long endpos;
> +  int64_t endpos;
> 
> -  char *read_line = NULL;
> +  char *read_line = nullptr;
>    size_t dummy_n = 0;
>    ssize_t line_len;
> 
> @@ -1126,7 +1126,7 @@ static int record_id_get(const char *file_path) {
>    /* Open the file */
>    while (1) {
>      fd = fopen(file_path, "r");
> -    if (fd != NULL) {
> +    if (fd != nullptr) {
>        break;
>      } else if (errno != EINTR) {
>        TRACE("%s fopen Fail %s", __FUNCTION__, strerror(errno));
> @@ -1192,7 +1192,7 @@ done_free:
>    free(read_line);
> 
>  done:
> -  if (fd != NULL) fclose(fd);
> +  if (fd != nullptr) fclose(fd);
> 
>    TRACE_LEAVE();
>    return id_rc;
> @@ -1210,8 +1210,8 @@ done:
>   *                                         Id = 1, rc = OK
>   * - If current log file empty is rotated: Name = cur log file, Size = 0,
>   *                                         Id = fr last rotated, rc = OK
> - * - If no log file at all:  Name = NULL, Size = 0, Id = 1, rc = OK
> - * - If only rotated log file: Name = NULL, Size = 0, Id = fr rotated
file,
> + * - If no log file at all:  Name = nullptr, Size = 0, Id = 1, rc = OK
> + * - If only rotated log file: Name = nullptr, Size = 0, Id = fr rotated
file,
>   *                             rc = OK
>   *
>   * NOTE: This function allocates memory pointed to by par_out-
> >curFileName.
> @@ -1247,14 +1247,14 @@ int lgs_get_file_params_hdl(void *indata, void
> *outdata, size_t max_outsize) {
>    osaf_mutex_unlock_ordie(&lgs_ftcom_mutex); /* UNLOCK  Critical section
> */
> 
>    /* Initialize out parameters */
> -  par_out->curFileName = NULL;
> +  par_out->curFileName = nullptr;
>    par_out->curFileSize = 0;
>    par_out->logRecordId = 0;
> 
>    TRACE("file_path = %s, file_name = %s", par_in->file_path, par_in-
> >file_name);
>    /* Get log file to get info from and its size */
> -  int_rc = filename_get(par_in->file_path, par_in->file_name, file_name,
> -                        file_name_cur, &file_size);
> +  int_rc = filename_get(par_in->file_path, par_in->file_name, &file_name,
> +                        &file_name_cur, &file_size);
>    if (int_rc == -1) {
>      TRACE("%s: filename_get Fail", __FUNCTION__);
>      rc = -1;
> @@ -1285,19 +1285,19 @@ int lgs_get_file_params_hdl(void *indata, void
> *outdata, size_t max_outsize) {
>      // This allocated memory will be freed by the caller
>      par_out->curFileName =
>          static_cast<char *>(calloc(1, file_name_cur.size() + 1));
> -    if (par_out->curFileName == NULL) {
> +    if (par_out->curFileName == nullptr) {
>        LOG_ER("%s Failed to allocate memory", __FUNCTION__);
>        rc = -1;
>        goto done;
>      }
> 
> -    strcpy(par_out->curFileName, file_name_cur.c_str());
> +    strncpy(par_out->curFileName, file_name_cur.c_str(),
> file_name_cur.size());
>      /* Remove extension */
>      ptr_str = strstr(par_out->curFileName, ".log");
> -    if (ptr_str == NULL) {
> +    if (ptr_str == nullptr) {
>        TRACE("%s: Could not find .log extension Fail", __FUNCTION__);
>        free(par_out->curFileName);
> -      par_out->curFileName = NULL;
> +      par_out->curFileName = nullptr;
>        rc = -1;
>        goto done;
>      }
> diff --git a/src/log/logd/lgs_nildest.h b/src/log/logd/lgs_nildest.h
> index 52ccf08a1..73716f24b 100644
> --- a/src/log/logd/lgs_nildest.h
> +++ b/src/log/logd/lgs_nildest.h
> @@ -15,8 +15,8 @@
>   *
>   */
> 
> -#ifndef SRC_LOG_LOGD_LGS_NILDEST_H_
> -#define SRC_LOG_LOGD_LGS_NILDEST_H_
> +#ifndef LOG_LOGD_LGS_NILDEST_H_
> +#define LOG_LOGD_LGS_NILDEST_H_
> 
>  #include <string>
> 
> @@ -69,4 +69,4 @@ class NilDestType {
>    DELETE_COPY_AND_MOVE_OPERATORS(NilDestType);
>  };
> 
> -#endif  // SRC_LOG_LOGD_LGS_NILDEST_H_
> +#endif  // LOG_LOGD_LGS_NILDEST_H_
> diff --git a/src/log/logd/lgs_recov.cc b/src/log/logd/lgs_recov.cc
> index 8f9f33ccb..45665326e 100644
> --- a/src/log/logd/lgs_recov.cc
> +++ b/src/log/logd/lgs_recov.cc
[Vu] Replace all NULL to nullptr. I see lot of NULL still be there.

> @@ -843,14 +843,14 @@ int log_close_rtstream_files(const std::string
> &stream_name) {
>    }
> 
>    int_rc = lgs_file_rename_h(rootPath, pathName_bk, par_out.curFileName,
> -                             current_time, LGS_LOG_FILE_EXT, emptyStr);
> +                             current_time, LGS_LOG_FILE_EXT, &emptyStr);
>    if (int_rc == -1) {
>      LOG_WA("Failed to rename log file (%s) for stream (%s)",
>             par_out.curFileName, stream_name.c_str());
>    }
> 
>    int_rc = lgs_file_rename_h(rootPath, pathName_bk, fileName,
> current_time,
> -                             LGS_LOG_FILE_CONFIG_EXT, emptyStr);
> +                             LGS_LOG_FILE_CONFIG_EXT, &emptyStr);
> 
>    if (int_rc == -1) {
>      LOG_WA("Failed to rename configuration file (%s) for stream (%s)",
> diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc
> index 68f6deb59..65689d658 100644
> --- a/src/log/logd/lgs_stream.cc
> +++ b/src/log/logd/lgs_stream.cc
> @@ -833,12 +833,12 @@ void log_stream_close(log_stream_t **s, time_t
> *close_time_ptr) {
> 
>        /* Rename stream log file */
>        rc = lgs_file_rename_h(root_path, stream->pathName, file_to_rename,
> -                             timeString, LGS_LOG_FILE_EXT, emptyStr);
> +                             timeString, LGS_LOG_FILE_EXT, &emptyStr);
>        while ((rc == -1) && (msecs_waited < max_waiting_time)) {
>          usleep(sleep_delay_ms * 1000);
>          msecs_waited += sleep_delay_ms;
>          rc = lgs_file_rename_h(root_path, stream->pathName,
file_to_rename,
> -                               timeString, LGS_LOG_FILE_EXT, emptyStr);
> +                               timeString, LGS_LOG_FILE_EXT, &emptyStr);
>        }
> 
>        if (rc == -1) {
> @@ -848,12 +848,12 @@ void log_stream_close(log_stream_t **s, time_t
> *close_time_ptr) {
> 
>        /* Rename stream config file */
>        rc = lgs_file_rename_h(root_path, stream->pathName, stream-
> >fileName,
> -                             timeString, LGS_LOG_FILE_CONFIG_EXT,
emptyStr);
> +                             timeString, LGS_LOG_FILE_CONFIG_EXT,
&emptyStr);
>        while ((rc == -1) && (msecs_waited < max_waiting_time)) {
>          usleep(sleep_delay_ms * 1000);
>          msecs_waited += sleep_delay_ms;
>          rc = lgs_file_rename_h(root_path, stream->pathName, stream-
> >fileName,
> -                               timeString, LGS_LOG_FILE_CONFIG_EXT,
emptyStr);
> +                               timeString, LGS_LOG_FILE_CONFIG_EXT,
&emptyStr);
>        }
>        if (rc == -1) {
>          LOG_WA("Could not rename config file: %s", strerror(errno));
> @@ -1074,7 +1074,7 @@ static int log_rotation_stb(log_stream_t *stream,
> size_t count) {
>      /* Rename file to give it the "close timestamp" */
>      rc = lgs_file_rename_h(root_path, stream->pathName,
>                             stream->stb_logFileCurrent, current_time_str,
> -                           LGS_LOG_FILE_EXT, emptyStr);
> +                           LGS_LOG_FILE_EXT, &emptyStr);
>      if (rc == -1) goto done;
> 
>      /* Remove oldest file if needed */
> @@ -1139,7 +1139,7 @@ static int log_rotation_act(log_stream_t *stream,
> size_t count) {
> 
>      /* Rename file to give it the "close timestamp" */
>      rc = lgs_file_rename_h(root_path, stream->pathName, stream-
> >logFileCurrent,
> -                           current_time, LGS_LOG_FILE_EXT, emptyStr);
> +                           current_time, LGS_LOG_FILE_EXT, &emptyStr);
>      if (rc == -1) goto done;
> 
>      /* Save time when logFileCurrent was closed */
> @@ -1491,7 +1491,7 @@ int log_stream_config_change(bool
> create_files_f, const std::string &root_path,
>      *stream->p_fd = -1;
> 
>      rc = lgs_file_rename_h(root_path, stream->pathName,
> current_logfile_name,
> -                           current_time, LGS_LOG_FILE_EXT, emptyStr);
> +                           current_time, LGS_LOG_FILE_EXT, &emptyStr);
>      if (rc == -1) {
>        LOG_WA("log file (%s) is renamed  FAILED: %d",
>               current_logfile_name.c_str(), rc);
> @@ -1499,7 +1499,7 @@ int log_stream_config_change(bool
> create_files_f, const std::string &root_path,
>      }
> 
>      rc = lgs_file_rename_h(root_path, stream->pathName, stream-
> >fileName,
> -                           current_time, LGS_LOG_FILE_CONFIG_EXT,
emptyStr);
> +                           current_time, LGS_LOG_FILE_CONFIG_EXT,
&emptyStr);
>      if (rc == -1) {
>        LOG_WA("cfg file (%s) is renamed  FAILED: %d", stream-
> >fileName.c_str(),
>               rc);
> diff --git a/src/log/logd/lgs_unixsock_dest.h
> b/src/log/logd/lgs_unixsock_dest.h
> index fd175ee37..3b88feefc 100644
> --- a/src/log/logd/lgs_unixsock_dest.h
> +++ b/src/log/logd/lgs_unixsock_dest.h
> @@ -15,8 +15,8 @@
>   *
>   */
> 
> -#ifndef SRC_LOG_LOGD_LGS_UNIXSOCK_DEST_H_
> -#define SRC_LOG_LOGD_LGS_UNIXSOCK_DEST_H_
> +#ifndef LOG_LOGD_LGS_UNIXSOCK_DEST_H_
> +#define LOG_LOGD_LGS_UNIXSOCK_DEST_H_
> 
>  #include <string>
>  #include <map>
> @@ -241,4 +241,4 @@ class UnixSocketType {
>    DELETE_COPY_AND_MOVE_OPERATORS(UnixSocketType);
>  };
> 
> -#endif  // SRC_LOG_LOGD_LGS_UNIXSOCK_DEST_H_
> +#endif  // LOG_LOGD_LGS_UNIXSOCK_DEST_H_
> diff --git a/src/log/logd/lgs_util.cc b/src/log/logd/lgs_util.cc
> index 5ba6257a2..de643ecbd 100644
> --- a/src/log/logd/lgs_util.cc
> +++ b/src/log/logd/lgs_util.cc
> @@ -26,18 +26,17 @@
>   * lgs_file.h, lgs_file.c, lgs_filendl.c and lgs_filehdl.h
>   * Examples can be found in file lgs_stream.c, e.g. function
fileopen(...)
>   */
> -
> -#include <cinttypes>
>  #include "log/logd/lgs_util.h"
> 
>  #include <stdlib.h>
>  #include <grp.h>
> -#include "base/osaf_time.h"
> +#include <cinttypes>
> 
> +#include "base/osaf_time.h"
> +#include "base/osaf_timerfd.h"
>  #include "log/logd/lgs.h"
>  #include "log/logd/lgs_file.h"
>  #include "log/logd/lgs_filehdl.h"
> -#include "base/osaf_timerfd.h"
> 
>  #define ALARM_STREAM_ENV_PREFIX "ALARM"
>  #define NOTIFICATION_STREAM_ENV_PREFIX "NOTIFICATION"
> @@ -61,7 +60,7 @@ int lgs_create_config_file_h(const std::string
> &root_path,
>                               log_stream_t *stream) {
>    lgsf_apipar_t apipar;
>    lgsf_retcode_t api_rc;
> -  void *params_in = NULL;
> +  void *params_in = nullptr;
>    ccfh_t *header_in_p;
>    size_t params_in_size;
>    char *logFileFormat_p;
> @@ -154,7 +153,7 @@ int lgs_create_config_file_h(const std::string
> &root_path,
>    apipar.data_in_size = params_in_size;
>    apipar.data_in = params_in;
>    apipar.data_out_size = 0;
> -  apipar.data_out = NULL;
> +  apipar.data_out = nullptr;
> 
>    api_rc = log_file_api(&apipar);
>    if (api_rc != LGSF_SUCESS) {
> @@ -178,7 +177,7 @@ done:
>   *
>   * @param time_in
>   *        Time to format.
> - *        If NULL time is fetched using osaf_clock_gettime()
> + *        If nullptr time is fetched using osaf_clock_gettime()
>   * @return char*
>   */
>  char *lgs_get_time(time_t *time_in) {
> @@ -189,7 +188,7 @@ char *lgs_get_time(time_t *time_in) {
>    time_t testTime;
>    struct timespec testime_tspec;
> 
> -  if (time_in == NULL) {
> +  if (time_in == nullptr) {
>      osaf_clock_gettime(CLOCK_REALTIME, &testime_tspec);
>      testTime = testime_tspec.tv_sec;
>    } else {
> @@ -257,13 +256,13 @@ SaTimeT lgs_get_SaTime() {
>  int lgs_file_rename_h(const std::string &root_path, const std::string
> &rel_path,
>                        const std::string &old_name,
>                        const std::string &time_stamp, const std::string
&suffix,
> -                      std::string &new_name) {
> +                      std::string *new_name) {
>    int rc;
>    std::string oldpath;
>    std::string newpath;
>    std::string new_name_loc;
>    lgsf_apipar_t apipar;
> -  void *params_in_p = NULL;
> +  void *params_in_p = nullptr;
>    size_t params_in_size;
>    lgsf_retcode_t api_rc;
>    char *oldpath_in_p;
> @@ -284,7 +283,7 @@ int lgs_file_rename_h(const std::string &root_path,
> const std::string &rel_path,
>    if (time_stamp.empty() == false) {
>      new_name_loc = old_name + "_" + time_stamp + suffix;
>    } else {
> -    new_name_loc = new_name + suffix;
> +    new_name_loc = *new_name + suffix;
>    }
> 
>    newpath = root_path + "/" + rel_path + "/" + new_name_loc;
> @@ -294,8 +293,8 @@ int lgs_file_rename_h(const std::string &root_path,
> const std::string &rel_path,
>      goto done;
>    }
> 
> -  if (new_name.empty() == false) {
> -    new_name = new_name_loc;
> +  if (new_name->empty() == false) {
> +    *new_name = new_name_loc;
>    }
> 
>    TRACE_4("Rename file from %s", oldpath.c_str());
> @@ -323,7 +322,7 @@ int lgs_file_rename_h(const std::string &root_path,
> const std::string &rel_path,
>    apipar.data_in_size = params_in_size;
>    apipar.data_in = params_in_p;
>    apipar.data_out_size = 0;
> -  apipar.data_out = NULL;
> +  apipar.data_out = nullptr;
> 
>    api_rc = log_file_api(&apipar);
>    if (api_rc != LGSF_SUCESS) {
> @@ -359,7 +358,7 @@ void lgs_exit(const char *msg,
> SaAmfRecommendedRecoveryT rec_rcvr) {
>   *
> 
> **************************************************************
> **************/
>  bool lgs_lga_entry_valid(lgs_cb_t *cb, MDS_DEST mds_dest) {
> -  log_client_t *rp = NULL;
> +  log_client_t *rp = nullptr;
>    /* Loop through Client DB */
>    ClientMap *clientMap(reinterpret_cast<ClientMap *>(client_db));
>    for (const auto &value : *clientMap) {
> @@ -423,7 +422,8 @@ void lgs_free_write_log(const
> lgsv_write_log_async_req_t *param) {
>      free(param->logRecord->logBuffer);
>      free(genLogH->notificationClassId);
>      osaf_extended_name_free(const_cast<SaNameT *>(genLogH-
> >logSvcUsrName));
> -    free((void *)genLogH->logSvcUsrName);
> +    free(reinterpret_cast<void *>(
> +        const_cast<SaNameT *>(genLogH->logSvcUsrName)));
[Vu] Why double cast here? I think it can work with free(const_cast<SaNameT
*>(genLogH->logSvcUsrName))

And see NULL still be there in this file.
int lgs_init_timer(time_t timeout_s) {
        osaf_timerfd_settime(fd, 0, &lgs_cltimer, NULL);
}

>      free(param->logRecord);
>    } else {
>      SaLogNtfLogHeaderT *ntfLogH = &param->logRecord->logHeader.ntfHdr;
> @@ -501,7 +501,7 @@ int lgs_make_reldir_h(const std::string &path) {
>    apipar.data_in_size = sizeof(mld_in_t);
>    apipar.data_in = &params_in;
>    apipar.data_out_size = 0;
> -  apipar.data_out = NULL;
> +  apipar.data_out = nullptr;
>    api_rc = log_file_api(&apipar);
>    if (api_rc != LGSF_SUCESS) {
>      TRACE("%s - API error %s", __FUNCTION__, lgsf_retcode_str(api_rc));
> @@ -540,7 +540,7 @@ int lgs_check_path_exists_h(const char
> *path_to_check) {
>    apipar.data_in_size = params_in_size;
>    apipar.data_in = params_in_p;
>    apipar.data_out_size = 0;
> -  apipar.data_out = NULL;
> +  apipar.data_out = nullptr;
> 
>    api_rc = log_file_api(&apipar);
>    if (api_rc != LGSF_SUCESS) {
> @@ -561,14 +561,18 @@ int lgs_check_path_exists_h(const char
> *path_to_check) {
>   *          gid of data group if set.
>   */
>  gid_t lgs_get_data_gid(char *groupname) {
> -  osafassert(groupname != NULL);
> +  osafassert(groupname != nullptr);
> 
>    if (strcmp(groupname, "") == 0) {
>      return -1;
>    } else {
> -    struct group *gr = getgrnam(groupname);
> -    if (gr) {
> -      return gr->gr_gid;
> +    char grp_buf[4096];
> +    struct group grp;
> +    struct group * tmp_grp_ptr;
> +    int rc = getgrnam_r(groupname, &grp, grp_buf,
> +                        sizeof (grp_buf), &tmp_grp_ptr);
> +    if (rc == 0) {
> +      return grp.gr_gid;
>      } else {
>        LOG_ER("Could not get group struct for %s, %s", groupname,
>               strerror(errno));
> @@ -620,7 +624,7 @@ int lgs_own_log_files_h(log_stream_t *stream,
> const char *groupname) {
>    apipar.data_in_size = sizeof(olfbgh_t);
>    apipar.data_in = data_in;
>    apipar.data_out_size = 0;
> -  apipar.data_out = NULL;
> +  apipar.data_out = nullptr;
> 
>    api_rc = log_file_api(&apipar);
>    if (api_rc != LGSF_SUCESS) {
> @@ -750,7 +754,7 @@ static size_t lgs_pathconf() {
>    }
> 
>    errno = 0;
> -  long max = pathconf(dir_path.c_str(), _PC_NAME_MAX);
> +  int64_t max = pathconf(dir_path.c_str(), _PC_NAME_MAX);
> 
>    /* Get default value if the limit is not defined, or error */
>    if (max == -1) {
> @@ -826,7 +830,7 @@ bool lgs_is_valid_pathlength(const std::string &path,
>   * Check if the name is valid or not.
>   */
>  bool lgs_is_extended_name_valid(const SaNameT *name) {
> -  if (name == NULL) return false;
> +  if (name == nullptr) return false;
>    if (osaf_is_extended_name_valid(name) == false) return false;
> 
>    SaConstStringT str = osaf_extended_name_borrow(name);
> @@ -935,7 +939,7 @@ static void lgs_send_filter_msg(uint32_t client_id,
> uint32_t stream_id,
>   */
>  void lgs_send_severity_filter_to_clients(uint32_t stream_id,
>                                           SaLogSeverityFlagsT
severity_filter) {
> -  log_client_t *rp = NULL;
> +  log_client_t *rp = nullptr;
>    lgs_stream_list_t *stream;
> 
>    TRACE_ENTER();
> @@ -949,7 +953,7 @@ void lgs_send_severity_filter_to_clients(uint32_t
> stream_id,
>          callback and associate with this stream */
>      stream = rp->stream_list_root;
>      if (is_filter_supported(rp->client_ver)) {
> -      while (stream != NULL) {
> +      while (stream != nullptr) {
>          if (stream->stream_id == stream_id) {
>            lgs_send_filter_msg(rp->client_id, stream_id, severity_filter,
>                                rp->mds_dest);
> diff --git a/src/log/logd/lgs_util.h b/src/log/logd/lgs_util.h
> index 63d3229a3..11a934fc4 100644
> --- a/src/log/logd/lgs_util.h
> +++ b/src/log/logd/lgs_util.h
> @@ -28,8 +28,9 @@
>  #include <saAis.h>
>  #include <saAmf.h>
>  #include <vector>
> -#include "lgs_stream.h"
> -#include "lgs_evt.h"
> +#include <string>
> +#include "log/logd/lgs_stream.h"
> +#include "log/logd/lgs_evt.h"
> 
>  /*
> ==============================================================
> ==========
>   *   DEFINITIONS
> @@ -60,7 +61,7 @@ extern int lgs_file_rename_h(const std::string
> &root_path,
>                               const std::string &rel_path,
>                               const std::string &old_name,
>                               const std::string &time_stamp,
> -                             const std::string &suffix, std::string
&new_name);
> +                             const std::string &suffix, std::string
*new_name);
>  // extern uint32_t lgs_create_known_streams(lgs_cb_t *lgs_cb); /* Not
> used, no
>  // code */
>  extern void lgs_exit(const char *msg, SaAmfRecommendedRecoveryT
> rec_rcvr);
> diff --git a/src/log/tests/lgs_dest_test.cc
b/src/log/tests/lgs_dest_test.cc
> index 5b56c64da..869911323 100644
> --- a/src/log/tests/lgs_dest_test.cc
> +++ b/src/log/tests/lgs_dest_test.cc
> @@ -247,7 +247,7 @@ TEST(WriteToDestination,
> HaveDestNameAndDestCfg) {
>                 : "";
> 
>    // Origin is FQDN = <hostname>[.<networkname>]
> -  origin = std::string{data.hostname} + nkname;
> +  origin = std::string {data.hostname} + nkname;
> 
>    info.msgid = data.msgid;
>    info.log_record = data.logrec;
> --
> 2.13.0



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to