[Fedora-directory-commits] ldapserver/lib/libsi18n getstrmem.h, 1.7, 1.8 gsslapd.h, 1.7, 1.8

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


Author: rmeggins

Update of /cvs/dirsec/ldapserver/lib/libsi18n
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26931/ldapserver/lib/libsi18n

Modified Files:
	getstrmem.h gsslapd.h 
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: getstrmem.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libsi18n/getstrmem.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- getstrmem.h	10 Nov 2006 23:46:05 -0000	1.7
+++ getstrmem.h	8 Oct 2008 17:29:05 -0000	1.8
@@ -53,7 +53,6 @@
 #define NUM_BUCKETS 32 /* must be a power of 2 */
 
 /* strings in library libadmin */
-static char* libadminid[] = {"$DBT: libadmin in memory  v1 $"};
 static char* libadmin[] = {
   "",
   "  Help  ",
@@ -89,7 +88,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library userforms */
-static char* userformsid[] = {"$DBT: userforms in memory  v1 $"};
 static char* userforms[] = {
   "",
   "Error: could not open servers list file.<p>\n",
@@ -113,7 +111,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library libaccess */
-static char* libaccessid[] = {"$DBT: libaccess in memory  v1 $"};
 static char* libaccess[] = {
   "",
   "basic-ncsa",
@@ -274,7 +271,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library frame */
-static char* frameid[] = {"$DBT: frame in memory  v1 $"};
 static char* frame[] = {
   "",
   "<TITLE>Not Found</TITLE><H1>Not Found</H1> The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. ",
@@ -465,7 +461,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library admserv */
-static char* admservid[] = {"$DBT: admserv in memory  v1 $"};
 static char* admserv[] = {
   "",
   "Unauthorized host",
@@ -477,7 +472,6 @@
   emptyString };
 
 /* strings in library libir */
-static char* libirid[] = {"$DBT: libadmin in memory  v1 $"};
 static char* libir[] = {
   "",
   "An I/O error occurred before all form data could be read.",
@@ -494,7 +488,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library httpdaemon */
-static char* httpdaemonid[] = {"$DBT: httpdaemon in memory  v1 $"};
 static char* httpdaemon[] = {
   "",
   "Error in ConvertThreadToFiber",
@@ -540,7 +533,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library dsgw */
-static char* dsgwid[] = {"$DBT: dsgw in memory  v1 $"};
 static char* dsgw[] = {
   "",
   "Unknown HTTP request method",
@@ -856,7 +848,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library base */
-static char* baseid[] = {"$DBT: base in memory  v1 $"};
 static char* base[] = {
   "",
   "insufficient memory to create hash table",
@@ -1072,7 +1063,6 @@
   {emptyString,NULL,0} };
 
 /* strings in library cgiadmin */
-static char* cgiadminid[] = {"$DBT: cgiadmin in memory  v1 $"};
 static char* cgiadmin[] = {
   "",
   "Missing REQUEST_METHOD",


Index: gsslapd.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/lib/libsi18n/gsslapd.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- gsslapd.h	27 Apr 2007 22:59:32 -0000	1.7
+++ gsslapd.h	8 Oct 2008 17:29:05 -0000	1.8
@@ -54,10 +54,10 @@
 #undef LIBRARY_NAME
 
 static RESOURCE_GLOBAL allxpstr[] = {
-  base,
-  libaccess,
-  libadmin,
-  0
+  {base},
+  {libaccess},
+  {libadmin},
+  {0}
 };
 
 #endif /* ifdef RESOURCE_STR */




More information about the Fedora-directory-commits mailing list