From 6881e0a5850ca452802654ece3ffab99634a10a3 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Apr 25 2016 20:42:37 +0000 Subject: Ticket #48802 - Compilation warnings from clang Description: Fixing the errors reported by clang. https://fedorahosted.org/389/ticket/48802 Reviewed by mreynolds@redhat.com (Thank you, Mark!!) --- diff --git a/ldap/servers/plugins/acctpolicy/acct_util.c b/ldap/servers/plugins/acctpolicy/acct_util.c index cff0176..319e61c 100644 --- a/ldap/servers/plugins/acctpolicy/acct_util.c +++ b/ldap/servers/plugins/acctpolicy/acct_util.c @@ -221,7 +221,7 @@ gentimeToEpochtime( char *gentimestr ) { /* Find the local offset from GMT */ cur_gm_time = (struct tm*)slapi_ch_calloc( 1, sizeof( struct tm ) ); - cur_local_epochtime = time( (time_t)0 ); + cur_local_epochtime = time( (time_t *)0 ); gmtime_r( &cur_local_epochtime, cur_gm_time ); cur_gm_epochtime = mktime( cur_gm_time ); free( cur_gm_time ); diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c index 829fd7d..be2b805 100644 --- a/ldap/servers/plugins/acl/acl.c +++ b/ldap/servers/plugins/acl/acl.c @@ -218,7 +218,7 @@ acl_access_allowed( int rv; int err; int ret_val; - const char *right; + const char *right = NULL; struct acl_pblock *aclpb = NULL; AclAttrEval *c_attrEval = NULL; int got_reader_locked = 0; @@ -2924,7 +2924,7 @@ acl__TestRights(Acl_PBlock *aclpb,int access, const char **right, const char ** acleval = aclpb->aclpb_acleval; testRights[0] = *right; - testRights[1] = '\0'; + testRights[1] = NULL; /* ** START PROCESSING DENY HANDLES @@ -4191,7 +4191,7 @@ acl__recompute_acl ( Acl_PBlock *aclpb, ACL_EvalSetACL(NULL, aclpb->aclpb_acleval, aci->aci_handle); testRight[0] = acl_access2str ( access ); - testRight[1] = '\0'; + testRight[1] = NULL; aclpb->aclpb_curr_aci = aci; result_status = ACL_EvalTestRights (NULL, aclpb->aclpb_acleval, testRight, ds_map_generic, &unused_str1, diff --git a/ldap/servers/plugins/acl/acleffectiverights.c b/ldap/servers/plugins/acl/acleffectiverights.c index 2b246c1..f3e00f0 100644 --- a/ldap/servers/plugins/acl/acleffectiverights.c +++ b/ldap/servers/plugins/acl/acleffectiverights.c @@ -1029,7 +1029,7 @@ acl_get_effective_rights ( int iscritical = 0; /* critical may be missing or false http://tools.ietf.org/html/draft-ietf-ldapext-acl-model-08 */ int rc = LDAP_SUCCESS; - *errbuf = '\0'; + *errbuf = NULL; if (NULL == e) /* create a template entry from SLAPI_SEARCH_GERATTRS */ { diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c index bb43b9b..3ef3f5f 100644 --- a/ldap/servers/plugins/replication/repl5_plugins.c +++ b/ldap/servers/plugins/replication/repl5_plugins.c @@ -647,7 +647,7 @@ multimaster_ruv_search(Slapi_PBlock *pb) static void purge_entry_state_information (Slapi_PBlock *pb) { - CSN *purge_csn; + CSN *purge_csn = NULL; Object *repl_obj; Replica *replica; diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index 150a008..c59d559 100644 --- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c +++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c @@ -1056,7 +1056,7 @@ bail: int ldbm_back_ldbm2ldif( Slapi_PBlock *pb ) { - backend *be; + backend *be = NULL; struct ldbminfo *li = NULL; DB *db = NULL; DBC *dbc = NULL; diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c index 0a630ac..00795c4 100644 --- a/ldap/servers/slapd/bind.c +++ b/ldap/servers/slapd/bind.c @@ -165,7 +165,7 @@ do_bind( Slapi_PBlock *pb ) slapi_sdn_free(&sdn); return; } - LDAPDebug( LDAP_DEBUG_TRACE, "BIND dn=\"%s\" method=%d version=%d\n", + LDAPDebug( LDAP_DEBUG_TRACE, "BIND dn=\"%s\" method=%" BERTAG_T " version=%d\n", dn?dn:"empty", method, version ); /* target spec is used to decide which plugins are applicable for the operation */ @@ -916,13 +916,13 @@ log_bind_access ( } else if (msg) { slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" " - "method=%ld version=%d, %s\n", + "method=%" BERTAG_T " version=%d, %s\n", pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, method, version, msg ); } else { slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" " - "method=%ld version=%d\n", + "method=%" BERTAG_T " version=%d\n", pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, method, version ); } diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c index 1c413d6..29fcd84 100644 --- a/ldap/servers/slapd/csngen.c +++ b/ldap/servers/slapd/csngen.c @@ -682,16 +682,16 @@ _csngen_adjust_local_time (CSNGen *gen, time_t cur_time) gen->state.remote_offset); } - if (!ignore_time_skew && (abs (time_diff) > CSN_MAX_TIME_ADJUST)) + if (!ignore_time_skew && (labs (time_diff) > CSN_MAX_TIME_ADJUST)) { slapi_log_error (SLAPI_LOG_FATAL, NULL, "_csngen_adjust_local_time: " - "adjustment limit exceeded; value - %d, limit - %d\n", - abs (time_diff), CSN_MAX_TIME_ADJUST); + "adjustment limit exceeded; value - %ld, limit - %d\n", + labs (time_diff), CSN_MAX_TIME_ADJUST); return CSN_LIMIT_EXCEEDED; } gen->state.sampled_time = cur_time; - gen->state.local_offset = MAX_VAL (gen->state.local_offset, abs (time_diff)); + gen->state.local_offset = MAX_VAL (gen->state.local_offset, labs (time_diff)); gen->state.seq_num = 0; if (slapi_is_loglevel_set(SLAPI_LOG_REPL)) { diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c index d63cac8..0c31bff 100644 --- a/ldap/servers/slapd/filter.c +++ b/ldap/servers/slapd/filter.c @@ -822,7 +822,7 @@ slapi_filter_join_ex( int ftype, struct slapi_filter *f1, struct slapi_filter *f struct slapi_filter *fjoin; struct slapi_filter *add_to; struct slapi_filter *add_this; - struct slapi_filter *return_this; + struct slapi_filter *return_this = NULL; int insert = 0; if ((NULL == f1) || (NULL == f2)) { diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c index 08d2da6..ed0b510 100644 --- a/ldap/servers/slapd/mapping_tree.c +++ b/ldap/servers/slapd/mapping_tree.c @@ -2657,7 +2657,7 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb, if (referral) { *referral = NULL; } - if ((target_node == mapping_tree_root) ){ + if (target_node == mapping_tree_root) { /* If we got here, then we couldn't find a matching node * for the target. We'll use the default backend. Once * we fully support the NULL suffix, we should do something more