[Tux3] [PATCH] Clean up various compiler warnings

Shapor Naghibzadeh shapor at gmail.com
Wed Aug 6 19:50:45 PDT 2008


# HG changeset patch
# User shapor at yzf.shapor.com
# Date 1218077433 25200
# Node ID b166243fbd7665a838b8365526a19abd652bc7e6
# Parent  a4c7eb9d9b45e47609b4bc8269da6c7bd6e62fbe
Clean up various compiler warnings.

diff -r a4c7eb9d9b45 -r b166243fbd76 user/test/Makefile
--- a/user/test/Makefile	Wed Aug 06 18:58:06 2008 -0700
+++ b/user/test/Makefile	Wed Aug 06 19:50:33 2008 -0700
@@ -1,9 +1,9 @@ CC=gcc
 CC=gcc
-CFLAGS += -std=gnu99
+CFLAGS += -std=gnu99 -Wall
 VG=valgrind
 VGFLAGS=--error-exitcode=200
 
-all: fleaf ileaf
+all: fleaf ileaf btree
 tests: fleaftest ileaftest
 
 fleaf: fleaf.c tux3.h hexdump.c
diff -r a4c7eb9d9b45 -r b166243fbd76 user/test/btree.c
--- a/user/test/btree.c	Wed Aug 06 18:58:06 2008 -0700
+++ b/user/test/btree.c	Wed Aug 06 19:50:33 2008 -0700
@@ -541,7 +541,9 @@ int main(int argc, char *argv[])
 	flush_buffers();
 	char buf[100] = { };
 
-	int err = tuxread(&sb, 6, buf, 11);
+	if (!tuxread(&sb, 6, buf, 11))
+		return 1;
+		
 	hexdump(buf, 11);
 	return 0;
 }
diff -r a4c7eb9d9b45 -r b166243fbd76 user/test/fleaf.c
--- a/user/test/fleaf.c	Wed Aug 06 18:58:06 2008 -0700
+++ b/user/test/fleaf.c	Wed Aug 06 19:50:33 2008 -0700
@@ -90,9 +90,12 @@ typedef u64 tuxkey_t;
  *  12) fuzztest - started
  */
 
-struct fleaf *leaf_init(struct fleaf *leaf)
-{
+int leaf_init(struct fleaf *leaf)
+{
+	if (!leaf)
+		return -1;
 	*leaf = (struct fleaf){ .magic = 0x1eaf, .free = sizeof(struct fleaf), .used = blocksize };
+	return 0;
 }
 
 struct fleaf *leaf_create(void)
@@ -126,8 +129,7 @@ void leaf_dump(struct fleaf *leaf)
 
 	printf("%i entry groups:\n", leaf->groups);
 	for (struct group *group = groups; group > grbase; group--) {
-		printf("  %i:", groups - group);
-		printf("/%i", group->count);
+		printf("  %lu/%i:", groups - group, group->count);
 		//printf(" [%i]", extents - leaf->table);
 		struct entry *enbase = entry - group->count;
 		while (entry > enbase) {
@@ -238,7 +240,7 @@ target = target & 0xffffffffffffLL;
 	/* insert new group if no match  */
 	if (group == grbase || loghi < group->loghi || (entries - group->count)->limit == grouplim) {
 		int split = group != grbase && loghi == group->loghi;
-		printf("new group at %i\n", group - grbase);
+		printf("new group at %lu\n", group - grbase);
 		memmove(used - sizeof(*group), used, (void *)(group + 1) - used);
 		*group = (struct group){ .loghi = loghi, .count = 0 };
 		used -= sizeof(*group);
@@ -269,7 +271,7 @@ target = target & 0xffffffffffffLL;
 
 	/* insert new entry if no match  */
 	if (entry == enbase || loglo < entry->loglo) {
-		printf("insert 0x%Lx at %i in group %i\n", target, entries - entry, groups - group);
+		printf("insert 0x%Lx at %lu in group %lu\n", target, entries - entry, groups - group);
 		memmove(used - sizeof(*entry), used, (void *)(entry + 1) - used);
 		*entry = (struct entry){ .loglo = loglo, .limit = !group->count ? 0 : (entry + 1)->limit };
 		used -= sizeof(*entry);
@@ -439,7 +441,7 @@ int main(int argc, char *argv[])
 
 	struct fleaf *dest = leaf_create();
 	tuxkey_t key = leaf_split(leaf, dest, 0);
-	printf("split key 0x%x\n", key);
+	printf("split key 0x%Lx\n", key);
 	leaf_dump(leaf);
 	leaf_dump(dest);
 	leaf_check(leaf);

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list