Google
  Web www.spinics.net

[389-devel] Please review: fix recent compiler warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From 8d4fa6d412b0bf911c063b371ad23d9257df312f Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@xxxxxxxxxx>
Date: Wed, 18 Jan 2012 13:23:30 -0700
Subject: [PATCH] fix recent compiler warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

../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'
---
 ldap/servers/slapd/auth.c                     |    2 +-
 ldap/servers/slapd/back-ldbm/cache.c          |    2 +-
 ldap/servers/slapd/back-ldbm/idl_common.c     |    1 -
 ldap/servers/slapd/back-ldbm/import-threads.c |    4 ++--
 ldap/servers/slapd/entry.c                    |    3 ++-
 ldap/servers/slapd/pw.c                       |    1 -
 ldap/servers/slapd/uniqueid.c                 |    1 -
 lib/base/rwlock.cpp                           |    3 ++-
 8 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index 796ca7a..0631b15 100644
--- a/ldap/servers/slapd/auth.c
+++ b/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,
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index e2f1768..1ccfd29 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/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);
diff --git a/ldap/servers/slapd/back-ldbm/idl_common.c b/ldap/servers/slapd/back-ldbm/idl_common.c
index f04f8de..584bba5 100644
--- a/ldap/servers/slapd/back-ldbm/idl_common.c
+++ b/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;
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index ec8585d..458ead0 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/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;
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index cac7b85..5afba09 100644
--- a/ldap/servers/slapd/entry.c
+++ b/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));
 		}
 	}
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 58fce28..2a7b29b 100644
--- a/ldap/servers/slapd/pw.c
+++ b/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,
diff --git a/ldap/servers/slapd/uniqueid.c b/ldap/servers/slapd/uniqueid.c
index 979e06b..1d23e17 100644
--- a/ldap/servers/slapd/uniqueid.c
+++ b/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 */
 
diff --git a/lib/base/rwlock.cpp b/lib/base/rwlock.cpp
index 81d4e47..ec75344 100644
--- a/lib/base/rwlock.cpp
+++ b/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);                 
 }
                                                          
-- 
1.7.1

--
389-devel mailing list
389-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/389-devel

[Fedora Directory Announce]     [Older Fedora Users Mail]     [Home]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Maintainers]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [iPod Nano]     [ATA RAID]     [Fedora Bible]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Tux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Art]     [Fedora Docs]

Powered by Linux

Google
  Web www.spinics.net