[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm dblayer.c, 1.30, 1.31 import-merge.c, 1.10, 1.11 import-threads.c, 1.17, 1.18 import.c, 1.13, 1.14 ldbm_config.c, 1.15, 1.16 ldif2ldbm.c, 1.19, 1.20 monitor.c, 1.9, 1.10 parents.c, 1.6, 1.7

Richard Allen Megginson rmeggins at fedoraproject.org
Fri Oct 17 16:54:49 UTC 2008


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16120/ldapserver/ldap/servers/slapd/back-ldbm

Modified Files:
	dblayer.c import-merge.c import-threads.c import.c 
	ldbm_config.c ldif2ldbm.c monitor.c parents.c 
Log Message:
Resolves: bug 454030 
Bug Description: Need to address 64-bit compiler warnings
Fix Description: As it turns out, there is no portable format specifier
for size_t that works on all of our supported platforms.  Afaict, %lu should
work everywhere.  C99 uses the "z" specifier, but alas not all of the compilers
we use support C99 and/or "z".
Platforms tested: RHEL5, Solaris
Flag Day: no
Doc impact: no



Index: dblayer.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/dblayer.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- dblayer.c	15 Oct 2008 06:30:06 -0000	1.30
+++ dblayer.c	17 Oct 2008 16:54:47 -0000	1.31
@@ -97,13 +97,6 @@
 #include "dblayer.h"
 #include <prrwlock.h>
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
 #define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)    \
 {                                                                              \
@@ -929,7 +922,7 @@
                 if (feof(f))
                     break;
                 if (strncmp(s, "VmSize:", 7) == 0) {
-                    sscanf(s+7, "%" PRIuPTR, procpages);
+                    sscanf(s+7, "%lu", procpages);
                     break;
                 }
             }


Index: import-merge.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/import-merge.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- import-merge.c	15 Oct 2008 06:30:07 -0000	1.10
+++ import-merge.c	17 Oct 2008 16:54:47 -0000	1.11
@@ -49,13 +49,6 @@
 #include "back-ldbm.h"
 #include "import.h"
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 struct _import_merge_thang
 {
 	int type;
@@ -674,7 +667,7 @@
     if (1 == job->number_indexers) {
 	import_log_notice(job, "Beginning %d-way merge of one file...", passes);
     } else {
-	import_log_notice(job, "Beginning %d-way merge of up to %" PRIuPTR " files...",
+	import_log_notice(job, "Beginning %d-way merge of up to %lu files...",
 			  passes, job->number_indexers);
     }
 


Index: import-threads.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/import-threads.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- import-threads.c	15 Oct 2008 06:30:07 -0000	1.17
+++ import-threads.c	17 Oct 2008 16:54:47 -0000	1.18
@@ -49,13 +49,6 @@
  * a wire import (aka "fast replica" import) won't have a producer thread.
  */
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 #include "back-ldbm.h"
 #include "vlv_srch.h"
 #include "import.h"
@@ -579,7 +572,7 @@
                     escape_string(slapi_entry_get_dn(e), ebuf),
                     curr_lineno, curr_filename);
             import_log_notice(job, "REASON: entry too large (%ld bytes) for "
-                    "the buffer size (%" PRIuPTR " bytes)", newesize, job->fifo.bsize);
+                    "the buffer size (%lu bytes)", newesize, job->fifo.bsize);
             backentry_free(&ep);
             job->skipped++;
             continue;
@@ -812,8 +805,8 @@
             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 (%" PRIuPTR " bytes) for "
-                    "the buffer size (%" PRIuPTR " 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;
@@ -1606,8 +1599,8 @@
         char ebuf[BUFSIZ];
         import_log_notice(job, "WARNING: skipping entry \"%s\"",
                     escape_string(slapi_entry_get_dn(ep->ep_entry), ebuf));
-        import_log_notice(job, "REASON: entry too large (%" PRIuPTR " bytes) for "
-                    "the import buffer size (%" PRIuPTR " bytes).   Try increasing nsslapd-cachememsize.", newesize, job->fifo.bsize);
+        import_log_notice(job, "REASON: entry too large (%lu bytes) for "
+                    "the import buffer size (%lu bytes).   Try increasing nsslapd-cachememsize.", newesize, job->fifo.bsize);
         backentry_clear_entry(ep);      /* entry is released in the frontend on failure*/
         backentry_free( &ep );          /* release the backend wrapper, here */
         PR_Unlock(job->wire_lock);


Index: import.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/import.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- import.c	15 Oct 2008 06:30:07 -0000	1.13
+++ import.c	17 Oct 2008 16:54:47 -0000	1.14
@@ -46,13 +46,6 @@
  * please make sure you use 4-space indentation on this file.
  */
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 #include "back-ldbm.h"
 #include "vlv_srch.h"
 #include "import.h"
@@ -1155,7 +1148,7 @@
                 import_log_notice(job, "Index buffering is disabled.");
         else
                 import_log_notice(job,
-                                "Index buffering enabled with bucket size %" PRIuPTR, 
+                                "Index buffering enabled with bucket size %lu", 
                                 job->job_index_buffer_suggestion);
 
         job->worker_list = producer;
@@ -1318,7 +1311,7 @@
         if (job->not_here_skipped)
         {
                 if (job->skipped)
-                        import_log_notice(job, "Import complete.  Processed %" PRIuPTR " entries "
+                        import_log_notice(job, "Import complete.  Processed %lu entries "
                               "(%d bad entries were skipped, "
                               "%d entries were skipped because they don't "
                                                           "belong to this database) in %d seconds. "
@@ -1326,7 +1319,7 @@
                               job->skipped, job->not_here_skipped,
                                                           seconds_to_import, entries_per_second);
                 else
-                        import_log_notice(job, "Import complete.  Processed %" PRIuPTR " entries "
+                        import_log_notice(job, "Import complete.  Processed %lu entries "
                               "(%d entries were skipped because they don't "
                                                           "belong to this database) "
                               "in %d seconds. (%.2f entries/sec)",
@@ -1336,13 +1329,13 @@
         else
         {
                 if (job->skipped)
-                        import_log_notice(job, "Import complete.  Processed %" PRIuPTR " entries "
+                        import_log_notice(job, "Import complete.  Processed %lu entries "
                               "(%d were skipped) in %d seconds. "
                               "(%.2f entries/sec)", entries_processed,
                               job->skipped, seconds_to_import,
                               entries_per_second);
                 else
-                        import_log_notice(job, "Import complete.  Processed %" PRIuPTR " entries "
+                        import_log_notice(job, "Import complete.  Processed %lu entries "
                               "in %d seconds. (%.2f entries/sec)",
                               entries_processed, seconds_to_import,
                               entries_per_second);


Index: ldbm_config.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldbm_config.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ldbm_config.c	8 Oct 2008 17:29:03 -0000	1.15
+++ ldbm_config.c	17 Oct 2008 16:54:47 -0000	1.16
@@ -42,13 +42,6 @@
 
 /* ldbm_config.c - Handles configuration information that is global to all ldbm instances. */
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 #include "back-ldbm.h"
 #include "dblayer.h"
 
@@ -1426,7 +1419,7 @@
         break;
     case CONFIG_TYPE_SIZE_T:
         val = (size_t) config->config_get_fn(arg);
-        sprintf(buf, "%" PRIuPTR, val);
+        sprintf(buf, "%lu", val);
         break;
     case CONFIG_TYPE_STRING:
         /* Remember the get function for strings returns memory


Index: ldif2ldbm.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ldif2ldbm.c	15 Oct 2008 06:30:08 -0000	1.19
+++ ldif2ldbm.c	17 Oct 2008 16:54:47 -0000	1.20
@@ -47,13 +47,6 @@
  * code for db2index (is this still in use?)
  */
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 #include "back-ldbm.h"
 #include "vlv_srch.h"
 #include "dblayer.h"
@@ -327,7 +320,7 @@
      * let's do it so we can reuse the modify routines) */
     cache_lock_entry( &inst->inst_cache, e );
     modify_init(&mc,e);
-    sprintf(value_buffer,"%" PRIuPTR,sub_count);
+    sprintf(value_buffer,"%lu",sub_count);
     /* attr numsubordinates could already exist in the entry,
        let's check whether it's already there or not */
     isreplace = (attrlist_find(e->ep_entry->e_attrs, numsubordinates) != NULL);


Index: monitor.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/monitor.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- monitor.c	15 Oct 2008 06:30:09 -0000	1.9
+++ monitor.c	17 Oct 2008 16:54:47 -0000	1.10
@@ -42,13 +42,6 @@
 
 /* monitor.c - ldbm backend monitor function */
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 #include "back-ldbm.h"
 #include "dblayer.h"	/* XXXmcs: not sure this is good to do... */
 #include <sys/stat.h>
@@ -124,9 +117,9 @@
     MSET("entryCacheTries");
     sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
     MSET("entryCacheHitRatio");
-    sprintf(buf, "%" PRIuPTR, size);
+    sprintf(buf, "%lu", size);
     MSET("currentEntryCacheSize");
-    sprintf(buf, "%" PRIuPTR, maxsize);
+    sprintf(buf, "%lu", maxsize);
     MSET("maxEntryCacheSize");
     sprintf(buf, "%ld", nentries);
     MSET("currentEntryCacheCount");


Index: parents.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/parents.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- parents.c	8 Oct 2008 17:29:04 -0000	1.6
+++ parents.c	17 Oct 2008 16:54:47 -0000	1.7
@@ -44,13 +44,6 @@
 
 #include "back-ldbm.h"
 
-/* Required to get portable printf/scanf format macros */
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#error Need to define portable format macros such as PRIu64
-#endif /* HAVE_INTTYPES_H */
-
 char *numsubordinates = "numsubordinates";
 char *hassubordinates = "hassubordinates";
 
@@ -137,7 +130,7 @@
 		else
 		{
         	char value_buffer[20]; /* enough digits for 2^64 children */
-        	sprintf(value_buffer,"%" PRIuPTR, current_sub_count);
+        	sprintf(value_buffer,"%lu", current_sub_count);
             slapi_mods_add(smods, mod_op | LDAP_MOD_BVALUES, numsubordinates, strlen(value_buffer), value_buffer);
 		}
     	ret = modify_apply_mods(mc,smods); /* smods passed in */




More information about the Fedora-directory-commits mailing list