Преглед на файлове

fix recent compiler warnings

Reviewed by: mareynold (Thanks!)
../ds.git/ldap/servers/slapd/entry.c: In function 'slapi_entry_get_nrdn_const':
../ds.git/ldap/servers/slapd/entry.c:2193: warning: passing argument 1 of 'slapi_rdn_init_all_dn' discards qualifiers from pointer target type
../ds.git/ldap/servers/slapd/slapi-plugin.h:2873: note: expected 'struct Slapi_RDN *' but argument is of type 'const struct slapi_rdn *'

../ds.git/ldap/servers/slapd/pw.c: In function 'slapi_pwpolicy_is_expired':
../ds.git/ldap/servers/slapd/pw.c:2193: warning: unused variable 'now'

../ds.git/ldap/servers/slapd/uniqueid.c:56: warning: 'str2Byte' declared 'static' but never defined

../ds.git/lib/base/rwlock.cpp: In function 'void rwlock_Unlock(void*)':
../ds.git/lib/base/rwlock.cpp:146: warning: suggest explicit braces to avoid ambiguous 'else'

../ds.git/ldap/servers/slapd/auth.c: In function ‘slapu_search_s’:
../ds.git/ldap/servers/slapd/auth.c:85: warning: initialization discards qualifiers from pointer target type

../ds.git/ldap/servers/slapd/back-ldbm/cache.c: In function 'dump_hash':
../ds.git/ldap/servers/slapd/back-ldbm/cache.c:305: warning: suggest parentheses around assignment used as truth value

../ds.git/ldap/servers/slapd/back-ldbm/idl_common.c: In function 'idl_append_extend':
../ds.git/ldap/servers/slapd/back-ldbm/idl_common.c:144: warning: unused variable 'x'
Rich Megginson преди 14 години
родител
ревизия
363987a5c7

+ 1 - 1
ldap/servers/slapd/auth.c

@@ -82,7 +82,7 @@ slapu_search_s( LDAP* ld, const char* rawbaseDN, int scope, const char* filter,
     Slapi_PBlock* pb = NULL;
     LDAPControl **ctrls;
     Slapi_DN *sdn = slapi_sdn_new_dn_byval(rawbaseDN);
-    char *baseDN = slapi_sdn_get_dn(sdn);
+    const char *baseDN = slapi_sdn_get_dn(sdn);
 
     if (ld != internal_ld) {
         err = ldap_search_ext_s(ld, baseDN, scope, filter, attrs, attrsonly,

+ 1 - 1
ldap/servers/slapd/back-ldbm/cache.c

@@ -302,7 +302,7 @@ dump_hash(Hashtable *ht)
             }
             PR_snprintf(p, ids_size, "%s:", ep_id);
             p += len + 1; ids_size -= len + 1;
-        } while (e = HASH_NEXT(ht, e));
+        } while ((e = HASH_NEXT(ht, e)));
     }
     if (p != ep_ids) {
         LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", ep_ids);

+ 0 - 1
ldap/servers/slapd/back-ldbm/idl_common.c

@@ -141,7 +141,6 @@ idl_append_extend(IDList **orig_idl, ID id)
 	}
 
 	if ( idl->b_nids == idl->b_nmax ) {
-		size_t x = 0;
 		/* No more room, need to extend */
 		/* Allocate new IDL with twice the space of this one */
 		IDList *idl_new = NULL;

+ 2 - 2
ldap/servers/slapd/back-ldbm/import-threads.c

@@ -1782,8 +1782,8 @@ upgradedn_producer(void *param)
             char ebuf[BUFSIZ];
             import_log_notice(job, "WARNING: skipping entry \"%s\"",
                     escape_string(slapi_entry_get_dn(e), ebuf));
-            import_log_notice(job, "REASON: entry too large (%u bytes) for "
-                    "the buffer size (%u bytes)", newesize, job->fifo.bsize);
+            import_log_notice(job, "REASON: entry too large (%lu bytes) for "
+                    "the buffer size (%lu bytes)", newesize, job->fifo.bsize);
             backentry_free(&ep);
             job->skipped++;
             continue;

+ 2 - 1
ldap/servers/slapd/entry.c

@@ -2190,7 +2190,8 @@ slapi_entry_get_nrdn_const( const Slapi_Entry *e )
 	if (NULL == nrdn) {
 		const char *dn = slapi_entry_get_dn_const(e);
 		if (dn) {
-			slapi_rdn_init_all_dn(&e->e_srdn, dn);
+			/* cast away const */
+			slapi_rdn_init_all_dn((Slapi_RDN *)&e->e_srdn, dn);
 			nrdn = slapi_rdn_get_nrdn(slapi_entry_get_srdn((Slapi_Entry *)e));
 		}
 	}

+ 0 - 1
ldap/servers/slapd/pw.c

@@ -2190,7 +2190,6 @@ int
 slapi_pwpolicy_is_expired(Slapi_PWPolicy *pwpolicy, Slapi_Entry *e, time_t *expire_time, int *remaining_grace)
 {
     int is_expired = 0;
-    time_t now = current_time();
 
     if (pwpolicy && e) {
         /* If password expiration is enabled in the policy,

+ 0 - 1
ldap/servers/slapd/uniqueid.c

@@ -53,7 +53,6 @@
 #define MODULE "uniqueid" /* for logging */
 
 static int isValidFormat (const char * buff);
-static PRUint8 str2Byte (const char *str);
 
 /* All functions that strat with slapi_ are exposed to the plugins */
 

+ 2 - 1
lib/base/rwlock.cpp

@@ -143,11 +143,12 @@ void rwlock_Unlock(RWLOCK lockP)
         rwLockP->write = 0;                              
     else                                                 
         rwLockP->numReaders--;                                 
-    if (rwLockP->numReaders == 0)                              
+    if (rwLockP->numReaders == 0) {
         if (rwLockP->numWriteWaiters != 0)                     
             condvar_notify(rwLockP->writeFree);             
         else                                             
             condvar_notifyAll(rwLockP->readFree);           
+    }
     crit_exit(rwLockP->crit);                 
 }