[Xfce4-commits] <libxfce4menu:xfce-4.6> Fix make distcheck and compiler warnings.

Nick Schermer noreply at xfce.org
Wed May 12 22:04:03 CEST 2010


Updating branch refs/heads/xfce-4.6
         to dadfbe92b1cd0bb8edf9d78cac1771f1a1069a81 (commit)
       from 5642a199d6acf7116768251a9bf85c9716958d2f (commit)

commit dadfbe92b1cd0bb8edf9d78cac1771f1a1069a81
Author: Nick Schermer <nick at xfce.org>
Date:   Wed May 12 21:57:40 2010 +0200

    Fix make distcheck and compiler warnings.
    
    Same tdb code as in thunar master.

 docs/reference/Makefile.am |    3 +++
 libxfce4menu/Makefile.am   |    3 +++
 tdb/tdb.c                  |    6 +++---
 tdb/tdb.h                  |    2 ++
 tdb/tdbconfig.h.in         |    2 +-
 tdb/tdbspeed.c             |    8 ++++----
 tdb/tdbtool.c              |   40 ++++++++++++++++++++--------------------
 7 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 2ebe79f..62bfe9b 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -58,3 +58,6 @@ include $(top_srcdir)/gtk-doc.make
 # Other files to distribute
 EXTRA_DIST +=								\
 	version.xml.in
+
+# required for gtk-doc
+dist-hook: all
diff --git a/libxfce4menu/Makefile.am b/libxfce4menu/Makefile.am
index c6df320..2bf778c 100644
--- a/libxfce4menu/Makefile.am
+++ b/libxfce4menu/Makefile.am
@@ -87,3 +87,6 @@ EXTRA_DIST =								\
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libxfce4menu-0.1.pc
+
+# required for gtk-doc
+dist-hook: all
diff --git a/tdb/tdb.c b/tdb/tdb.c
index 3b9f988..898316a 100644
--- a/tdb/tdb.c
+++ b/tdb/tdb.c
@@ -368,7 +368,7 @@ static int tdb_oob(TDB_CONTEXT *tdb, tdb_off len, int probe)
 	if (fstat(tdb->fd, &st) == -1)
 		return TDB_ERRCODE(TDB_ERR_IO, -1);
 
-	if (st.st_size < (size_t)len) {
+	if (st.st_size < (off_t)len) {
 		if (!probe) {
 			/* Ensure ecode is set for log fn. */
 			tdb->ecode = TDB_ERR_IO;
@@ -577,7 +577,7 @@ static int tdb_dump_chain(TDB_CONTEXT *tdb, int i)
 
 void tdb_dump_all(TDB_CONTEXT *tdb)
 {
-	int i;
+	unsigned int i;
 	for (i=0;i<tdb->header.hash_size;i++) {
 		tdb_dump_chain(tdb, i);
 	}
@@ -745,7 +745,7 @@ update:
 static int expand_file(TDB_CONTEXT *tdb, tdb_off size, tdb_off addition)
 {
 	char buf[1024];
-#if HAVE_FTRUNCATE_EXTEND
+#ifdef HAVE_FTRUNCATE_EXTEND
 	if (ftruncate(tdb->fd, size+addition) != 0) {
 		TDB_LOG((tdb, 0, "expand_file ftruncate to %d failed (%s)\n", 
 			   size+addition, strerror(errno)));
diff --git a/tdb/tdb.h b/tdb/tdb.h
index 84b83dc..5567d4a 100644
--- a/tdb/tdb.h
+++ b/tdb/tdb.h
@@ -147,6 +147,8 @@ void tdb_unlockall(TDB_CONTEXT *tdb);
 void tdb_set_lock_alarm(sig_atomic_t *palarm);
 int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key);
 int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key);
+int tdb_chainlock_read(TDB_CONTEXT *tdb, TDB_DATA key);
+int tdb_chainunlock_read(TDB_CONTEXT *tdb, TDB_DATA key);
 
 /* Debug functions. Not used in production. */
 void tdb_dump_all(TDB_CONTEXT *tdb);
diff --git a/tdb/tdbconfig.h.in b/tdb/tdbconfig.h.in
index 8150346..91fcccd 100644
--- a/tdb/tdbconfig.h.in
+++ b/tdb/tdbconfig.h.in
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: tdbconfig.h.in 131 2005-11-04 15:15:34Z benny $ */
 /*-
  * Copyright (c) 2005 Benedikt Meurer <benny at xfce.org>
  *
diff --git a/tdb/tdbspeed.c b/tdb/tdbspeed.c
index 74b091d..f5e5255 100644
--- a/tdb/tdbspeed.c
+++ b/tdb/tdbspeed.c
@@ -75,12 +75,12 @@ static TDB_CONTEXT *db;
 
 struct timeval tp1,tp2;
 
-static void start_timer()
+static void start_timer(void)
 {
 	gettimeofday(&tp1,NULL);
 }
 
-static double end_timer()
+static double end_timer(void)
 {
 	gettimeofday(&tp2,NULL);
 	return((tp2.tv_sec - tp1.tv_sec) + 
@@ -162,8 +162,8 @@ struct tdb_flag {
 
 int main(int argc, char *argv[])
 {
-	int i, j, seed=0;
-	int k;
+	int seed=0;
+	unsigned int i, k, j;
 
 	/* Precook random buffers */
 	randdata = malloc(10000 * sizeof(randdata[0]));
diff --git a/tdb/tdbtool.c b/tdb/tdbtool.c
index d537dee..ab59474 100644
--- a/tdb/tdbtool.c
+++ b/tdb/tdbtool.c
@@ -100,7 +100,7 @@ static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
 
 static char *get_token(int startover)
 {
-        static char tmp[1024];
+  static char tmp[1024];
   static char *cont = NULL;
   char *insert, *start;
   char *k = strtok(NULL, " ");
@@ -129,7 +129,7 @@ static char *get_token(int startover)
   return start;
 }
 
-static int open_dump_file()
+static int open_dump_file(void)
 {
   int retval = 0;
   char *tok = get_token(0);
@@ -148,7 +148,7 @@ static int open_dump_file()
     return(retval);
 }
 
-static void close_dump_file()
+static void close_dump_file(void)
 {
   if(pDumpFile != NULL && pDumpFile != stdout) {
     fclose(pDumpFile);
@@ -340,7 +340,7 @@ static void delete_tdb(void)
   }
 }
 
-static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int print_rec(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf, void *state)
 {
   fprintf(pDumpFile,"\nkey %u bytes\n", (unsigned) key.dsize);
   print_asc((unsigned char*)key.dptr, key.dsize);
@@ -349,7 +349,7 @@ static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
   return 0;
 }
 
-static int print_key(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int print_key(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf, void *state)
 {
   print_asc((unsigned char*)key.dptr, key.dsize);
   printf("\n");
@@ -358,7 +358,7 @@ static int print_key(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
 
 static int total_bytes;
 
-static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int traverse_fn(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf, void *state)
 {
   total_bytes += dbuf.dsize;
   return 0;
@@ -387,39 +387,39 @@ static char *tdb_getline(char *prompt)
   return p?line:NULL;
 }
 
-static int do_delete_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf,
+static int do_delete_fn(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf,
                      void *state)
 {
-    return tdb_delete(tdb, key);
+    return tdb_delete(context, key);
 }
 
-static void first_record(TDB_CONTEXT *tdb, TDB_DATA *pkey)
+static void first_record(TDB_CONTEXT *context, TDB_DATA *pkey)
 {
   TDB_DATA dbuf;
-  *pkey = tdb_firstkey(tdb);
+  *pkey = tdb_firstkey(context);
   
-  dbuf = tdb_fetch(tdb, *pkey);
+  dbuf = tdb_fetch(context, *pkey);
   if (!dbuf.dptr) terror("fetch failed");
   /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */
-  print_rec(tdb, *pkey, dbuf, NULL);
+  print_rec(context, *pkey, dbuf, NULL);
 }
 
-static void next_record(TDB_CONTEXT *tdb, TDB_DATA *pkey)
+static void next_record(TDB_CONTEXT *context, TDB_DATA *pkey)
 {
   TDB_DATA dbuf;
-  *pkey = tdb_nextkey(tdb, *pkey);
+  *pkey = tdb_nextkey(context, *pkey);
   
-  dbuf = tdb_fetch(tdb, *pkey);
+  dbuf = tdb_fetch(context, *pkey);
   if (!dbuf.dptr) 
     terror("fetch failed");
   else
     /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */
-    print_rec(tdb, *pkey, dbuf, NULL);
+    print_rec(context, *pkey, dbuf, NULL);
 }
 
 int main(int argc, char *argv[])
 {
-    int bIterate = 0;
+    int bIterate = 0, ignore;
     char *line;
     char *tok;
   TDB_DATA iterate_kbuf;
@@ -436,7 +436,7 @@ int main(int argc, char *argv[])
         /* Shell command */
         
         if (line[0] == '!') {
-            system(line + 1);
+            ignore = system(line + 1);
             continue;
         }
         
@@ -482,9 +482,9 @@ int main(int argc, char *argv[])
             delete_tdb();
         } else if (strcmp(tok,"dump") == 0) {
             bIterate = 0;
-      if(open_dump_file() == 0) { //open file
+      if(open_dump_file() == 0) { /* open file */
         tdb_traverse(tdb, print_rec, NULL);
-        close_dump_file(); //close file
+        close_dump_file(); /* close file */
       }
       pDumpFile = stdout;
         } else if (strcmp(tok,"list") == 0) {



More information about the Xfce4-commits mailing list