[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication cl5_api.c, 1.21, 1.22 repl5_agmt.c, 1.12, 1.13 repl5_connection.c, 1.8, 1.9 repl5_protocol_util.c, 1.12, 1.13 repl5_replica.c, 1.17, 1.18 repl5_updatedn_list.c, 1.5, 1.6

Richard Allen Megginson rmeggins at fedoraproject.org
Wed Oct 8 17:29:05 UTC 2008


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26931/ldapserver/ldap/servers/plugins/replication

Modified Files:
	cl5_api.c repl5_agmt.c repl5_connection.c 
	repl5_protocol_util.c repl5_replica.c repl5_updatedn_list.c 
Log Message:
Bug Description: Need to address 64-bit compiler warnings - part 1
Reviewed by: nhosoi (Thanks!)
Fix Description: The intptr_t and uintptr_t are types which are defined as integer types that are the same size as the pointer (void *) type.  On the platforms we currently support, this is the same as long and unsigned long, respectively (ILP32 and LP64).  However, intptr_t and uintptr_t are more portable.  These can be used to assign a value passed as a void * to get an integer value, then "cast down" to an int or PRBool, and vice versa.  This seems to be a common idiom in other applications where values must be passed as void *.
For the printf/scanf formats, there is a standard header called inttypes.h which defines formats to use for various 64 bit quantities, so that you don't need to figure out if you have to use %lld or %ld for a 64-bit value - you just use PRId64 which is set to the correct value.  I also assumed that size_t is defined as the same size as a pointer so I used the PRIuPTR format macro for size_t.
I removed many unused variables and some unused functions.
I put parentheses around assignments in conditional expressions to tell the compiler not to complain about them.
I cleaned up some #defines that were defined more than once.
I commented out some unused goto labels.
Some of our header files shared among several source files define static variables.  I made it so that those variables are not defined unless a macro is set in the source file.  This avoids a lot of unused variable warnings.
I added some return values to functions that were declared as returning a value but did not return a value.  In all of these cases no one was checking the return value anyway.
I put explicit parentheses around cases like this: expr || expr && expr - the && has greater precedence than the ||.  The compiler complains because it wants you to make sure you mean expr || (expr && expr), not (expr || expr) && expr.
I cleaned up several places where the compiler was complaining about possible use of uninitialized variables.  There are still a lot of these cases remaining.
There are a lot of warnings like this:
lib/ldaputil/certmap.c:1279: warning: dereferencing type-punned pointer will break strict-aliasing rules
These are due to our use of void ** to pass in addresses of addresses of structures.  Many of these are calls to slapi_ch_free, but many are not - they are cases where we do not know what the type is going to be and may have to cast and modify the structure or pointer.  I started replacing the calls to slapi_ch_free with slapi_ch_free_string, but there are many many more that need to be fixed.
The dblayer code also contains a fix for https://bugzilla.redhat.com/show_bug.cgi?id=463991 - instead of checking for dbenv->foo_handle to see if a db "feature" is enabled, instead check the flags passed to open the dbenv.  This works for bdb 4.2 through bdb 4.7 and probably other releases as well.
Platforms tested: RHEL5 x86_64, Fedora 8 i386
Flag Day: no
Doc impact: no



Index: cl5_api.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/cl5_api.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- cl5_api.c	19 Nov 2007 17:23:50 -0000	1.21
+++ cl5_api.c	8 Oct 2008 17:29:02 -0000	1.22
@@ -3376,8 +3376,6 @@
  */
 static int _cl5Upgrade4_4(char *fromVersion, char *toVersion)
 {
-	PRDirEntry *entry = NULL;
-	DB *thisdb = NULL;
 	CL5OpenMode	backup;
 	int rc = 0;
 


Index: repl5_agmt.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_agmt.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- repl5_agmt.c	28 Sep 2007 22:41:09 -0000	1.12
+++ repl5_agmt.c	8 Oct 2008 17:29:02 -0000	1.13
@@ -1183,7 +1183,7 @@
 	{
 		char *this_attr = NULL;
 		int i = 0;
-		for (i = 0; this_attr = frac_attrs[i]; i++)
+		for (i = 0; (this_attr = frac_attrs[i]); i++)
 		{
 			if (charray_inlist(verbotten_attrs,this_attr)) {
 				int k = 0;


Index: repl5_connection.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_connection.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- repl5_connection.c	18 Oct 2007 00:08:31 -0000	1.8
+++ repl5_connection.c	8 Oct 2008 17:29:03 -0000	1.9
@@ -1728,7 +1728,7 @@
 	char msg[SLAPI_DSE_RETURNTEXT_SIZE];
 
 	if (eqctx && !*setlevel) {
-		int found = slapi_eq_cancel(eqctx);
+		(void)slapi_eq_cancel(eqctx);
 	}
 
 	if (s_debug_timeout && s_debug_level && *setlevel) {


Index: repl5_protocol_util.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_protocol_util.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- repl5_protocol_util.c	3 Mar 2008 18:35:11 -0000	1.12
+++ repl5_protocol_util.c	8 Oct 2008 17:29:03 -0000	1.13
@@ -417,7 +417,8 @@
 			}
 		}
 	}
-error:
+
+/* error: */
 	if (NULL != ruv_bervals)
 		ber_bvecfree(ruv_bervals);
 	if (NULL != replarea_sdn)


Index: repl5_replica.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_replica.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- repl5_replica.c	24 Jun 2008 22:22:09 -0000	1.17
+++ repl5_replica.c	8 Oct 2008 17:29:03 -0000	1.18
@@ -1076,7 +1076,7 @@
     rc = csngen_adjust_time (gen, csn);
     /* rc will be either CSN_SUCCESS (0) or clock skew */
 
-done:
+/* done: */
 
     PR_Unlock(r->repl_lock);
     if (csn != extracsn) /* do not free the given csn */


Index: repl5_updatedn_list.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_updatedn_list.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- repl5_updatedn_list.c	10 Nov 2006 23:45:17 -0000	1.5
+++ repl5_updatedn_list.c	8 Oct 2008 17:29:03 -0000	1.6
@@ -193,7 +193,7 @@
 
 	/* Bug 605169 - null ndn would cause core dump */
 	if ( ndn ) {
-		ret = (PRBool)PL_HashTableLookupConst(hash, ndn);
+		ret = (PRBool)((uintptr_t)PL_HashTableLookupConst(hash, ndn));
 	}
 
 	return ret;




More information about the Fedora-directory-commits mailing list