[kaffe] CVS kaffe (doogie): Various gcc and sparse fixes all over the board.

Kaffe CVS cvs-commits at kaffe.org
Mon Dec 20 22:28:44 PST 2004


PatchSet 5692 
Date: 2004/12/21 05:49:52
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Various gcc and sparse fixes all over the board.

Members: 
	ChangeLog:1.3238->1.3239 
	kaffe/kaffevm/classMethod.c:1.128->1.129 
	kaffe/kaffevm/classMethod.h:1.71->1.72 
	kaffe/kaffevm/external.c:1.72->1.73 
	kaffe/kaffevm/itypes.c:1.33->1.34 
	kaffe/kaffevm/kaffe.def:1.36->1.37 
	kaffe/kaffevm/soft.c:1.72->1.73 
	kaffe/kaffevm/thread.c:1.86->1.87 
	kaffe/kaffevm/jit/methodcalls.c:1.4->1.5 
	kaffe/kaffevm/jit3/icode.c:1.49->1.50 
	kaffe/kaffevm/jit3/machine.c:1.63->1.64 
	kaffe/kaffevm/jit3/registers.c:1.17->1.18 
	kaffe/kaffevm/jit3/slots.c:1.11->1.12 
	kaffe/kaffevm/jit3/slots.h:1.4->1.5 
	kaffe/kaffevm/kaffe-gc/gc-mem.c:1.21->1.22 
	kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.126->1.127 
	kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.64->1.65 
	kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.61->1.62 
	kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.26->1.27 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c:1.6->1.7 
	libraries/clib/native/ByteToCharIconv.c:1.11->1.12 
	libraries/clib/native/CharToByteIconv.c:1.9->1.10 
	libraries/clib/native/Class.c:1.76->1.77 
	libraries/clib/native/Float.c:1.15->1.16 
	libraries/clib/native/NativeLibrary.c:1.5->1.6 
	libraries/clib/native/Object.c:1.12->1.13 
	libraries/clib/native/System.c:1.62->1.63 
	libraries/clib/net/PlainDatagramSocketImpl.c:1.50->1.51 
	libraries/clib/security/kaffe_md5.c:1.1->1.2 
	libraries/clib/security/sha-1.c:1.1->1.2 
	replace/getaddrinfo.c:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3238 kaffe/ChangeLog:1.3239
--- kaffe/ChangeLog:1.3238	Tue Dec 21 04:47:12 2004
+++ kaffe/ChangeLog	Tue Dec 21 05:49:52 2004
@@ -1,5 +1,31 @@
 2004-12-20  Adam Heath  <doogie at brainfood.com>
 
+	* kaffe/kaffevm/classMethod.c, kaffe/kaffevm/classMethod.h,
+	  kaffe/kaffevm/external.c, kaffe/kaffevm/itypes.c,
+	  kaffe/kaffevm/kaffe.def, kaffe/kaffevm/soft.c,
+	  kaffe/kaffevm/thread.c, kaffe/kaffevm/jit/methodcalls.c,
+	  kaffe/kaffevm/jit3/icode.c, kaffe/kaffevm/jit3/machine.c,
+	  kaffe/kaffevm/jit3/registers.c, kaffe/kaffevm/jit3/slots.c,
+	  kaffe/kaffevm/jit3/slots.h, kaffe/kaffevm/kaffe-gc/gc-mem.c,
+	  kaffe/kaffevm/systems/unix-jthreads/jthread.c,
+	  kaffe/kaffevm/systems/unix-jthreads/jthread.h,
+	  kaffe/kaffevm/systems/unix-pthreads/thread-impl.c,
+	  kaffe/kaffevm/systems/unix-pthreads/thread-internal.h,
+	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
+	  libraries/clib/native/ByteToCharIconv.c,
+	  libraries/clib/native/CharToByteIconv.c,
+	  libraries/clib/native/Class.c,
+	  libraries/clib/native/Float.c,
+	  libraries/clib/native/NativeLibrary.c,
+	  libraries/clib/native/Object.c,
+	  libraries/clib/native/System.c,
+	  libraries/clib/net/PlainDatagramSocketImpl.c,
+	  libraries/clib/security/kaffe_md5.c,
+	  libraries/clib/security/sha-1.c, replace/getaddrinfo.c:
+	  Various gcc and sparse fixes all over the board.
+
+2004-12-20  Adam Heath  <doogie at brainfood.com>
+
 	* libltdl/ltdl.c:
 	  Dalibor's last checkin included an older version of this file by
 	  mistake, reverting.
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.128 kaffe/kaffe/kaffevm/classMethod.c:1.129
--- kaffe/kaffe/kaffevm/classMethod.c:1.128	Sun Dec 19 06:25:07 2004
+++ kaffe/kaffe/kaffevm/classMethod.c	Tue Dec 21 05:49:59 2004
@@ -621,7 +621,7 @@
 		    !xProfFlag &&
 #endif
 		    1) {
-			METHOD_NATIVECODE(meth) = 0;
+			_SET_METHOD_NATIVECODE(meth, NULL);
 			KFREE(meth->c.ncode.ncode_start);
 			meth->c.ncode.ncode_start = NULL;
 			meth->c.ncode.ncode_end = NULL;
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.71 kaffe/kaffe/kaffevm/classMethod.h:1.72
--- kaffe/kaffe/kaffevm/classMethod.h:1.71	Tue Dec 21 00:15:30 2004
+++ kaffe/kaffe/kaffevm/classMethod.h	Tue Dec 21 05:49:59 2004
@@ -200,9 +200,16 @@
 		&((M)->class->vtable->method[(M)->idx]))
 
 #define	METHOD_CODE_START(M)		((M)->c.ncode.ncode_start)
-#define	SET_METHOD_NATIVECODE(M, C)	METHOD_NATIVECODE(M) = (C); \
+#define	_SET_METHOD_NATIVECODE(M, C)	do {\
+	if ((M)->idx == -1) {\
+		(M)->ncode = (C);\
+	} else { \
+		(M)->class->vtable->method[(M)->idx] = (C);\
+	} \
+} while (0)
+#define	SET_METHOD_NATIVECODE(M, C)	_SET_METHOD_NATIVECODE(M, C); \
 					(M)->accflags |= ACC_TRANSLATED
-#define	SET_METHOD_JITCODE(M, C)	METHOD_NATIVECODE(M) = (C); \
+#define	SET_METHOD_JITCODE(M, C)	_SET_METHOD_NATIVECODE(M, C); \
 					(M)->accflags |= ACC_TRANSLATED|ACC_JITTED
 
 /*
Index: kaffe/kaffe/kaffevm/external.c
diff -u kaffe/kaffe/kaffevm/external.c:1.72 kaffe/kaffe/kaffevm/external.c:1.73
--- kaffe/kaffe/kaffevm/external.c:1.72	Sun Dec 19 22:13:07 2004
+++ kaffe/kaffe/kaffevm/external.c	Tue Dec 21 05:49:59 2004
@@ -101,13 +101,13 @@
   return ptr;
 }
 
-static char *libraryPath = "";
+static char *libraryPath = NULL;
 
 extern JavaVM Kaffe_JavaVM;
 
 #ifdef ENABLE_BINRELOC
 static
-const char *discoverLibraryHome()
+const char *discoverLibraryHome(void)
 {
   static char libraryHome[MAXPATHLEN];
   char *entryPoint;
@@ -135,18 +135,18 @@
 initNative(void)
 {
 	char lib[MAXLIBPATH];
-	char* lpath;
+	const char* lpath;
 	char* nptr;
 	char* ptr;
 	unsigned int len;
 
 	DBG(INIT, dprintf("initNative()\n"); );
 
-	lpath = (char*)Kaffe_JavaVMArgs.libraryhome;
-	if (lpath == 0) {
+	lpath = (const char*)Kaffe_JavaVMArgs.libraryhome;
+	if (lpath == NULL) {
 		lpath = getenv(LIBRARYPATH);
 #ifdef ENABLE_BINRELOC
-		if (lpath == 0) {
+		if (lpath == NULL) {
 			lpath = discoverLibraryHome();
 		}
 #endif
@@ -157,7 +157,7 @@
 #endif
 
 	len = 0;
-	if (lpath != 0) {
+	if (lpath != NULL) {
 		len += strlen(lpath);
 	}
 
@@ -171,7 +171,7 @@
 	 */
 	libraryPath = gc_malloc(len+1, KGC_ALLOC_NATIVELIB);
 	addToCounter(&ltmem, "vmmem-libltdl", 1, GCSIZEOF(libraryPath));
-	if (lpath != 0) {
+	if (lpath != NULL) {
 		strcat(libraryPath, lpath);
 	}
 
Index: kaffe/kaffe/kaffevm/itypes.c
diff -u kaffe/kaffe/kaffevm/itypes.c:1.33 kaffe/kaffe/kaffevm/itypes.c:1.34
--- kaffe/kaffe/kaffevm/itypes.c:1.33	Sun Dec 19 22:13:07 2004
+++ kaffe/kaffe/kaffevm/itypes.c	Tue Dec 21 05:49:59 2004
@@ -209,7 +209,7 @@
 	Hjava_lang_Class *cls = classFromSig(&sig, loader, einfo);
 
 	/* name must consume all characters in string */
-	if (cls != NULL && *sig == NULL) {
+	if (cls != NULL && *sig == '\0') {
 		return (cls);
 	}
 	/* 
Index: kaffe/kaffe/kaffevm/kaffe.def
diff -u kaffe/kaffe/kaffevm/kaffe.def:1.36 kaffe/kaffe/kaffevm/kaffe.def:1.37
--- kaffe/kaffe/kaffevm/kaffe.def:1.36	Sun Dec 19 23:12:21 2004
+++ kaffe/kaffe/kaffevm/kaffe.def	Tue Dec 21 05:49:59 2004
@@ -9,7 +9,7 @@
  * See the file "license.terms" for information on usage and redistribution 
  * of this file. 
  */
-#define trace_jcode(x,...)	DBG(MOREJIT, dprintf ("@%ld:\t", (long) pc); dprintf(x))
+#define trace_jcode(x...)	DBG(MOREJIT, dprintf ("@%ld:\t", (long) pc); dprintf(x))
 
 define_insn(NOP)
 {
Index: kaffe/kaffe/kaffevm/soft.c
diff -u kaffe/kaffe/kaffevm/soft.c:1.72 kaffe/kaffe/kaffevm/soft.c:1.73
--- kaffe/kaffe/kaffevm/soft.c:1.72	Mon Dec 20 02:12:53 2004
+++ kaffe/kaffe/kaffevm/soft.c	Tue Dec 21 05:49:59 2004
@@ -400,14 +400,16 @@
 		if (c->loader != OBJECT_CLASS(o)->loader) {
 			const char *toloader = c->loader?CLASS_CNAME(OBJECT_CLASS((Hjava_lang_Object *)c->loader)):"bootstrap";
 			const char *fromloader = OBJECT_CLASS(o)->loader?CLASS_CNAME(OBJECT_CLASS((Hjava_lang_Object *)OBJECT_CLASS(o)->loader)):"bootstrap";
-			const char *format = "can't cast `%s' (%s@%p) to `%s' (%s@%p)";
+#define _FORMAT "can't cast `%s' (%s@%p) to `%s' (%s@%p)"
 			buf = checkPtr(KMALLOC(strlen(fromtype) + 12 + strlen(fromloader)+
-				+ strlen(totype) + 12 + strlen(toloader) + strlen(format)));
-			sprintf(buf, format, fromtype, fromloader, OBJECT_CLASS(o)->loader, totype, toloader, c->loader);
+				+ strlen(totype) + 12 + strlen(toloader) + strlen(_FORMAT)));
+			sprintf(buf, _FORMAT, fromtype, fromloader, OBJECT_CLASS(o)->loader, totype, toloader, c->loader);
+#undef _FORMAT
 		} else {
-			const char* format = "can't cast `%s' to `%s'";
-			buf = checkPtr(KMALLOC(strlen(fromtype)+strlen(totype)+strlen(format)));
-			sprintf(buf, format, fromtype, totype);
+#define _FORMAT "can't cast `%s' to `%s'"
+			buf = checkPtr(KMALLOC(strlen(fromtype)+strlen(totype)+strlen(_FORMAT)));
+			sprintf(buf, _FORMAT, fromtype, totype);
+#undef _FORMAT
 		}
 
 		ccexc = ClassCastException(buf);	
@@ -585,12 +587,13 @@
 {
 	if (obj != NULL && soft_instanceof(CLASS_ELEMENT_TYPE(OBJECT_CLASS(array)), obj) == 0) {
 		Hjava_lang_Throwable* asexc;
-		const char* f = "can't store `%s' in `%s'";
 		const char *otype = CLASS_CNAME(OBJECT_CLASS(obj));
 		const char *atype = CLASS_CNAME(OBJECT_CLASS(array));
 		char *b;
-		b = checkPtr(KMALLOC(strlen(otype)+strlen(atype)+strlen(f)));
-		sprintf(b, f, otype, atype);
+#define _FORMAT "can't store `%s' in `%s'"
+		b = checkPtr(KMALLOC(strlen(otype)+strlen(atype)+strlen(_FORMAT)));
+		sprintf(b, _FORMAT, otype, atype);
+#undef _FORMAT
 		asexc = ArrayStoreException(b);
 		KFREE(b);
 		throwException(asexc);
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.86 kaffe/kaffe/kaffevm/thread.c:1.87
--- kaffe/kaffe/kaffevm/thread.c:1.86	Mon Dec 20 02:12:53 2004
+++ kaffe/kaffe/kaffevm/thread.c	Tue Dec 21 05:49:59 2004
@@ -79,7 +79,7 @@
  * the threading implementation before a thread is destroyed or reused.
  */
 void
-KaffeVM_unlinkNativeAndJavaThread()
+KaffeVM_unlinkNativeAndJavaThread(void)
 {
 	jthread_t thread = KTHREAD(current)();
 	threadData *thread_data = KTHREAD(get_data)(thread);
@@ -319,7 +319,7 @@
 DBG(VMTHREAD,	dprintf("createDaemon %s\n", nm);	);
   
   /* Keep daemon threads as root objects */
-  vmtid = (Hjava_lang_Thread*)newObject(VMThreadClass);
+  vmtid = (Hjava_lang_VMThread*)newObject(VMThreadClass);
   assert(vmtid != NULL);
   
   name = stringC2Java(nm);
@@ -345,7 +345,7 @@
   specialArgument[2] = KTHREAD(current)();
   
   nativeTid = 
-    KTHREAD(create)(((unsigned char)unhand(tid)->priority),
+    KTHREAD(create)((unhand(tid)->priority),
 		   startSpecialThread,
 		   true,
 		   specialArgument,
@@ -694,8 +694,8 @@
 #else
 	stackSize = MAINSTACKSIZE;
 #endif
-	DBG(INIT, dprintf("Detected stackSize %lu\n", stackSize); );
-	KTHREAD(createfirst)(stackSize, (unsigned char)java_lang_Thread_NORM_PRIORITY, NULL);
+	DBG(INIT, dprintf("Detected stackSize %zu\n", (size_t)stackSize); );
+	KTHREAD(createfirst)((size_t)stackSize, (unsigned char)java_lang_Thread_NORM_PRIORITY, NULL);
 
 	/*
 	 * initialize some things that are absolutely necessary:
Index: kaffe/kaffe/kaffevm/jit/methodcalls.c
diff -u kaffe/kaffe/kaffevm/jit/methodcalls.c:1.4 kaffe/kaffe/kaffevm/jit/methodcalls.c:1.5
--- kaffe/kaffe/kaffevm/jit/methodcalls.c:1.4	Sun Dec 19 22:13:08 2004
+++ kaffe/kaffe/kaffevm/jit/methodcalls.c	Tue Dec 21 05:50:00 2004
@@ -160,7 +160,7 @@
 	if (methodNeedsTrampoline(meth)) {
 		/* XXX don't forget to pick those up at class gc time */
 		tramp = (methodTrampoline*)gc_malloc(sizeof(methodTrampoline), KGC_ALLOC_TRAMPOLINE);
-		if (tramp == 0) {
+		if (tramp == NULL) {
 			postOutOfMemory(einfo);
 			return (NULL);
 		}
@@ -178,15 +178,15 @@
 		if (!(CLASS_GCJ((meth)->class)
 			&& (meth->accflags & ACC_NATIVE)))
 		{
-			assert(*where == 0 ||
+			assert(*where == NULL ||
 				!!!"Cannot override trampoline anchor");
 		}
 		ret = tramp;
 	} else {
 		if (CLASS_GCJ((meth)->class)) {
-			METHOD_NATIVECODE(meth) = meth->ncode;
+			_SET_METHOD_NATIVECODE(meth, meth->ncode);
 		}
-		assert(METHOD_NATIVECODE(meth) != 0);
+		assert(METHOD_NATIVECODE(meth) != NULL);
 		ret = METHOD_NATIVECODE(meth);
 	}
 	*where = ret;
Index: kaffe/kaffe/kaffevm/jit3/icode.c
diff -u kaffe/kaffe/kaffevm/jit3/icode.c:1.49 kaffe/kaffe/kaffevm/jit3/icode.c:1.50
--- kaffe/kaffe/kaffevm/jit3/icode.c:1.49	Fri Dec 17 17:47:35 2004
+++ kaffe/kaffe/kaffevm/jit3/icode.c	Tue Dec 21 05:50:00 2004
@@ -4411,7 +4411,7 @@
 /*									   */
 
 void
-softcall_breakpoint()
+softcall_breakpoint(void)
 {
 	ABORT();
 }
Index: kaffe/kaffe/kaffevm/jit3/machine.c
diff -u kaffe/kaffe/kaffevm/jit3/machine.c:1.63 kaffe/kaffe/kaffevm/jit3/machine.c:1.64
--- kaffe/kaffe/kaffevm/jit3/machine.c:1.63	Tue Dec 21 00:15:32 2004
+++ kaffe/kaffe/kaffevm/jit3/machine.c	Tue Dec 21 05:50:00 2004
@@ -1375,9 +1375,9 @@
 initFakeCalls(void)
 {
 	*lastFake = redundantFake;
-	redundantFake = 0;
+	redundantFake = NULL;
 	fakePool = firstFake;
-	firstFake = 0;
+	firstFake = NULL;
 	lastFake = &firstFake;
 }
 
@@ -1386,7 +1386,7 @@
 fakeCall *
 findFakeCall(void *func)
 {
-	fakeCall *fc, *retval = 0;
+	fakeCall *fc, *retval = NULL;
 
 	for( fc = firstFake; fc && !retval; fc = fc->next )
 	{
@@ -1424,7 +1424,7 @@
 	{
 		fc = fakePool;
 		fakePool = fakePool->next;
-		fc->next = 0;
+		fc->next = NULL;
 	}
 	else
 	{
Index: kaffe/kaffe/kaffevm/jit3/registers.c
diff -u kaffe/kaffe/kaffevm/jit3/registers.c:1.17 kaffe/kaffe/kaffevm/jit3/registers.c:1.18
--- kaffe/kaffe/kaffevm/jit3/registers.c:1.17	Sun Dec 19 06:25:09 2004
+++ kaffe/kaffe/kaffevm/jit3/registers.c	Tue Dec 21 05:50:01 2004
@@ -42,7 +42,7 @@
  */
 kregs reginfo[] = {
 	REGISTER_SET
-	{ /* BAD */	0, 0, 0, 0, 0, 0, 0 }
+	{ /* BAD */	NULL, 0, 0, 0, 0, 0, 0 }
 };
 
 /**
@@ -633,10 +633,10 @@
 			regi->used = 0;
 		}
 		else {
-			for (ptr = &regi->slot; *ptr != 0; ptr = &(*ptr)->rnext) {
+			for (ptr = &regi->slot; *ptr != NULL; ptr = &(*ptr)->rnext) {
 				if (*ptr == sdata) {
 					*ptr = sdata->rnext;
-					sdata->rnext = 0;
+					sdata->rnext = NULL;
 					goto found;
 				}
 			}
Index: kaffe/kaffe/kaffevm/jit3/slots.c
diff -u kaffe/kaffe/kaffevm/jit3/slots.c:1.11 kaffe/kaffe/kaffevm/jit3/slots.c:1.12
--- kaffe/kaffe/kaffevm/jit3/slots.c:1.11	Sat Jul 17 07:57:29 2004
+++ kaffe/kaffe/kaffevm/jit3/slots.c	Tue Dec 21 05:50:01 2004
@@ -100,9 +100,9 @@
 		basicslots[i].slot = &basicdatas[i];
 		basicdatas[i].regno = NOREG;
 		basicdatas[i].modified = 0;
-		basicdatas[i].rnext = 0;
-		basicdatas[i].rseq = 0;
-		basicdatas[i].wseq = 0;
+		basicdatas[i].rnext = NULL;
+		basicdatas[i].rseq = NULL;
+		basicdatas[i].wseq = NULL;
 		basicdatas[i].offset = SLOT2FRAMEOFFSET(&basicslots[i]);
 		basicdatas[i].global = GL_NOGLOBAL;
         }
@@ -112,9 +112,9 @@
 	stack_limit->slot = &stack_limit_data;
 	stack_limit_data.regno = NOREG;
 	stack_limit_data.modified = 0;
-	stack_limit_data.rnext = 0;
-	stack_limit_data.rseq = 0;
-	stack_limit_data.wseq = 0;
+	stack_limit_data.rnext = NULL;
+	stack_limit_data.rseq = NULL;
+	stack_limit_data.wseq = NULL;
 	stack_limit_data.offset = SLOT2FRAMEOFFSET(stack_limit);
 	stack_limit_data.global = GL_NOGLOBAL;
 #endif
@@ -133,14 +133,14 @@
 
 	for (i = 0; i < maxslot; i++) {
 		sdata = slotinfo[i].slot;
-		sdata->rseq = 0;
-		sdata->wseq = 0;
+		sdata->rseq = NULL;
+		sdata->wseq = NULL;
 	}
 
 #if defined(STACK_LIMIT)
 	sdata = stack_limit->slot;
-	sdata->rseq = 0;
-	sdata->wseq = 0;
+	sdata->rseq = NULL;
+	sdata->wseq = NULL;
 #endif
 }
 
@@ -157,10 +157,10 @@
 
 	for (; nr > 0; nr--, data++) {
 		sdata = data->slot;
-		if (sdata->rseq != 0 && !isGlobal(sdata)) {
+		if (sdata->rseq != NULL && !isGlobal(sdata)) {
 			sdata->rseq->lastuse |= 1 << sdata->rseqslot;
 		}
-		sdata->wseq = 0;
-		sdata->rseq = 0;
+		sdata->wseq = NULL;
+		sdata->rseq = NULL;
 	}
 }
Index: kaffe/kaffe/kaffevm/jit3/slots.h
diff -u kaffe/kaffe/kaffevm/jit3/slots.h:1.4 kaffe/kaffe/kaffevm/jit3/slots.h:1.5
--- kaffe/kaffe/kaffevm/jit3/slots.h:1.4	Mon May 12 21:13:30 2003
+++ kaffe/kaffe/kaffevm/jit3/slots.h	Tue Dec 21 05:50:01 2004
@@ -19,7 +19,7 @@
 #define	Tstore			4
 #define	Tload			5
 
-#define	NOSLOT			0
+#define	NOSLOT			NULL
 
 #define	MAXTEMPS		16
 
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.21 kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.22
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c:1.21	Mon Dec 20 01:39:21 2004
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-mem.c	Tue Dec 21 05:50:02 2004
@@ -235,7 +235,7 @@
 #ifndef gc_pgsize
 	gc_pgsize = getpagesize();
 	for (gc_pgbits = 0;
-	     (1 << gc_pgbits) != gc_pgsize && gc_pgbits < 64;
+	     (size_t)(1 << gc_pgbits) != gc_pgsize && gc_pgbits < 64;
 	     gc_pgbits++)
 		;
 	assert(gc_pgbits < 64);
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.126 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.127
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.126	Tue Dec 21 02:35:45 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c	Tue Dec 21 05:50:02 2004
@@ -1388,7 +1388,7 @@
 }
 
 jthread_t
-jthread_createfirst(size_t mainThreadStackSize, unsigned char prio, void* jlThread)
+jthread_createfirst(size_t mainThreadStackSize, unsigned int prio, void* jlThread)
 {
         jthread *jtid; 
 
@@ -1516,7 +1516,7 @@
  * create a new jthread
  */
 jthread *
-jthread_create(unsigned char pri, void (*func)(void *), int isDaemon,
+jthread_create(unsigned int pri, void (*func)(void *), int isDaemon,
         void *jlThread, size_t threadStackSize)
 {
         KaffeNodeQueue *liveQ;
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.64 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.65
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.64	Sun Oct 31 14:35:37 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.h	Tue Dec 21 05:50:03 2004
@@ -149,13 +149,13 @@
  */
 jthread_t
 jthread_createfirst(size_t mainThreadStackSize,
-	unsigned char prio, void* jlThread);
+	unsigned int prio, void* jlThread);
 
 /*
  * create a thread with a given priority
  */
 jthread_t
-jthread_create(unsigned char pri, 	/* initial priority */
+jthread_create(unsigned int pri, 	/* initial priority */
 	void (*func)(void *), 		/* start function */
 	int isDaemon, 			/* is this thread a daemon? */
 	void *jlThread, 		/* cookie for this thread */
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.61 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.62
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.61	Mon Dec 20 02:29:52 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c	Tue Dec 21 05:50:03 2004
@@ -558,7 +558,7 @@
 }
 
 jthread_t
-jthread_createfirst(size_t mainThreadStackSize, UNUSED unsigned char pri, void* jlThread)
+jthread_createfirst(size_t mainThreadStackSize, UNUSED unsigned int pri, void* jlThread)
 {
   jthread_t      nt;
   int            oldCancelType;
@@ -821,7 +821,7 @@
  */
 
 jthread_t
-jthread_create ( unsigned char pri, void* func, int isDaemon, void* jlThread, size_t threadStackSize )
+jthread_create ( unsigned int pri, void* func, int isDaemon, void* jlThread, size_t threadStackSize )
 {
   jthread_t		cur = jthread_current();
   jthread_t		nt;
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.26 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.27
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h:1.26	Mon Dec  6 21:23:54 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-internal.h	Tue Dec 21 05:50:03 2004
@@ -316,13 +316,13 @@
  * Bind the main thread of the vm to a java.lang.Thread instance.
  *
  */
-jthread_t jthread_createfirst(size_t, unsigned char, void*);
+jthread_t jthread_createfirst(size_t, unsigned int, void*);
 
 /**
  * Create a new native thread.
  *
  */
-jthread_t jthread_create (unsigned char pri, void* func, int is_daemon,
+jthread_t jthread_create (unsigned int pri, void* func, int is_daemon,
 			  void* jlThread, size_t threadStackSize );
 
 
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c:1.6 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c:1.7
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c:1.6	Fri Nov  5 13:52:46 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c	Tue Dec 21 05:49:57 2004
@@ -271,7 +271,7 @@
    See: http://mail.gnome.org/archives/gtk-i18n-list/2003-August/msg00001.html
    for details. */
 static void
-init_dpi_conversion_factor ()
+init_dpi_conversion_factor (void)
 {
   GtkSettings *settings = gtk_settings_get_default ();
   GObjectClass *klass;
Index: kaffe/libraries/clib/native/ByteToCharIconv.c
diff -u kaffe/libraries/clib/native/ByteToCharIconv.c:1.11 kaffe/libraries/clib/native/ByteToCharIconv.c:1.12
--- kaffe/libraries/clib/native/ByteToCharIconv.c:1.11	Mon Dec 20 03:40:03 2004
+++ kaffe/libraries/clib/native/ByteToCharIconv.c	Tue Dec 21 05:49:58 2004
@@ -46,9 +46,9 @@
 
     str = (*env)->GetStringUTFChars(env, enc, NULL);
 #ifdef WORDS_BIGENDIAN
-    cd = iconv_open ("UCS-2BE", (char *)str);
+    cd = iconv_open ("UCS-2BE", str);
 #else
-    cd = iconv_open ("UCS-2LE", (char *)str);
+    cd = iconv_open ("UCS-2LE", str);
 #endif
     (*env)->ReleaseStringUTFChars(env, enc, str);
     if (cd != (iconv_t)-1) {
Index: kaffe/libraries/clib/native/CharToByteIconv.c
diff -u kaffe/libraries/clib/native/CharToByteIconv.c:1.9 kaffe/libraries/clib/native/CharToByteIconv.c:1.10
--- kaffe/libraries/clib/native/CharToByteIconv.c:1.9	Mon Dec 20 03:40:03 2004
+++ kaffe/libraries/clib/native/CharToByteIconv.c	Tue Dec 21 05:49:58 2004
@@ -44,9 +44,9 @@
 
     str = (*env)->GetStringUTFChars(env, enc, NULL);
 #ifdef WORDS_BIGENDIAN
-    cd = iconv_open ((char *)str, "UCS-2BE");
+    cd = iconv_open (str, "UCS-2BE");
 #else
-    cd = iconv_open ((char *)str, "UCS-2LE");
+    cd = iconv_open (str, "UCS-2LE");
 #endif
     (*env)->ReleaseStringUTFChars(env, enc, str);
     if (cd != (iconv_t)-1) {
Index: kaffe/libraries/clib/native/Class.c
diff -u kaffe/libraries/clib/native/Class.c:1.76 kaffe/libraries/clib/native/Class.c:1.77
--- kaffe/libraries/clib/native/Class.c:1.76	Mon Dec 20 03:40:03 2004
+++ kaffe/libraries/clib/native/Class.c	Tue Dec 21 05:49:58 2004
@@ -583,7 +583,7 @@
 int
 checkParameters(Method* mth, HArrayOfObject* argtypes)
 {
-	unsigned int i;
+	ssize_t i;
 	errorInfo info;
 
 	/* The JDK doc says and experimentation shows that a null second
@@ -606,7 +606,7 @@
 	for (i = 0; i < ARRAY_SIZE(argtypes); i++) {
 		Hjava_lang_Class* sigclass;
 		sigclass = getClassFromSignaturePart(METHOD_ARG_TYPE(mth, i), mth->class->loader, &info);
-		if (sigclass == 0) {
+		if (sigclass == NULL) {
 			discardErrorInfo(&info);
 			return 0;
 		}
@@ -811,7 +811,7 @@
 	ptr = (Hjava_lang_Class**)&unhand_array(array)->body[0];
 
 	for (i = clazz->nr_inner_classes, ic = clazz->inner_classes; i-- > 0; ic++) {
-		if (ic->inner_class == NULL || ic->outer_class == NULL) {
+		if (ic->inner_class == 0 || ic->outer_class == 0) {
 			continue;
 		}
 #if 0
Index: kaffe/libraries/clib/native/Float.c
diff -u kaffe/libraries/clib/native/Float.c:1.15 kaffe/libraries/clib/native/Float.c:1.16
--- kaffe/libraries/clib/native/Float.c:1.15	Fri Oct 22 19:32:27 2004
+++ kaffe/libraries/clib/native/Float.c	Tue Dec 21 05:49:58 2004
@@ -120,7 +120,7 @@
 	float value;
 	char* startbuf;
 	char* endbuf;
-	char* msg = "Bad float/double format";
+	const char* msg = "Bad float/double format";
 #if defined(STRTOD_m0_BROKEN)
 	int negate;
 #endif
Index: kaffe/libraries/clib/native/NativeLibrary.c
diff -u kaffe/libraries/clib/native/NativeLibrary.c:1.5 kaffe/libraries/clib/native/NativeLibrary.c:1.6
--- kaffe/libraries/clib/native/NativeLibrary.c:1.5	Sat Dec 11 07:00:52 2004
+++ kaffe/libraries/clib/native/NativeLibrary.c	Tue Dec 21 05:49:58 2004
@@ -37,7 +37,7 @@
  * Return prefix to prepend to library names
  */
 struct Hjava_lang_String*
-java_lang_NativeLibrary_getLibPrefix()
+java_lang_NativeLibrary_getLibPrefix(void)
 {
 	return checkPtr(stringC2Java(LIBRARYPREFIX));
 }
@@ -46,7 +46,7 @@
  * Return suffix to append to library names
  */
 struct Hjava_lang_String*
-java_lang_NativeLibrary_getLibSuffix()
+java_lang_NativeLibrary_getLibSuffix(void)
 {
 	return checkPtr(stringC2Java(LIBRARYSUFFIX));
 }
Index: kaffe/libraries/clib/native/Object.c
diff -u kaffe/libraries/clib/native/Object.c:1.12 kaffe/libraries/clib/native/Object.c:1.13
--- kaffe/libraries/clib/native/Object.c:1.12	Sun Dec 19 06:25:12 2004
+++ kaffe/libraries/clib/native/Object.c	Tue Dec 21 05:49:58 2004
@@ -99,7 +99,7 @@
       throwException(InterruptedException);
     }
 
-DBG(VMTHREAD, dprintf ("%p (%p) waiting for %p, %d\n",
+DBG(VMTHREAD, dprintf ("%p (%p) waiting for %p, %lli\n",
 			cur, KTHREAD(get_data)(cur)->jlThread,
 			o, timeout); );
 
Index: kaffe/libraries/clib/native/System.c
diff -u kaffe/libraries/clib/native/System.c:1.62 kaffe/libraries/clib/native/System.c:1.63
--- kaffe/libraries/clib/native/System.c:1.62	Mon Dec 20 03:40:03 2004
+++ kaffe/libraries/clib/native/System.c	Tue Dec 21 05:49:58 2004
@@ -176,11 +176,12 @@
 	/* Must be arrays */ 	 
 	if (!CLASS_IS_ARRAY(sclass)) {
 		Hjava_lang_Throwable* asexc;
-		const char* f = "source not an array `%s'";
 		const char *type = CLASS_CNAME(sclass);
 		char *b;
-		b = checkPtr(KMALLOC(strlen(type)+strlen(f)));
-		sprintf(b, f, type);
+#define _FORMAT "source not an array `%s'"
+		b = checkPtr(KMALLOC(strlen(type)+strlen(_FORMAT)));
+		sprintf(b, _FORMAT, type);
+#undef _FORMAT
 		asexc = ArrayStoreException(b);
 		KFREE(b);
 		throwException(asexc);
@@ -188,11 +189,12 @@
 
 	if(!CLASS_IS_ARRAY(dclass)) { 	 
 		Hjava_lang_Throwable* asexc;
-		const char* f = "destination not an array `%s'";
 		const char *type = CLASS_CNAME(dclass);
 		char *b;
-		b = checkPtr(KMALLOC(strlen(type)+strlen(f)));
-		sprintf(b, f, type);
+#define _FORMAT "destination not an array `%s'"
+		b = checkPtr(KMALLOC(strlen(type)+strlen(_FORMAT)));
+		sprintf(b, _FORMAT, type);
+#undef _FORMAT
 		asexc = ArrayStoreException(b);
 		KFREE(b);
 		throwException(asexc);
@@ -243,12 +245,13 @@
 	} else {
 		if (CLASS_IS_PRIMITIVE(sclass) || CLASS_IS_PRIMITIVE(dclass)) {
 		  Hjava_lang_Throwable* asexc;
-		  const char* f = "incompatible array types `%s' and `%s'";
 		  const char *stype = CLASS_CNAME(sclass);
 		  const char *dtype = CLASS_CNAME(dclass);
 		  char *b;
-		  b = checkPtr(KMALLOC(strlen(stype)+strlen(dtype)+strlen(f)));
-		  sprintf(b, f, stype, dtype);
+#define _FORMAT "incompatible array types `%s' and `%s'"
+		  b = checkPtr(KMALLOC(strlen(stype)+strlen(dtype)+strlen(_FORMAT)));
+		  sprintf(b, _FORMAT, stype, dtype);
+#undef _FORMAT
 		  asexc = ArrayStoreException(b);
 		  KFREE(b);
 		  throwException(asexc);
@@ -258,12 +261,13 @@
 			Hjava_lang_Object* val = *(Hjava_lang_Object**)in; 	 
 			if (val != 0 && !instanceof(dclass, OBJECT_CLASS(val))) { 	 
 			  Hjava_lang_Throwable* asexc;
-			  const char* f = "can't store `%s' in array of type `%s'";
 			  const char *vtype = CLASS_CNAME(OBJECT_CLASS(val));
 			  const char *atype = CLASS_CNAME(dclass);
 			  char *b;
-			  b = checkPtr(KMALLOC(strlen(vtype)+strlen(atype)+strlen(f)));
-			  sprintf(b, f, vtype, atype);
+#define _FORMAT "can't store `%s' in array of type `%s'"
+			  b = checkPtr(KMALLOC(strlen(vtype)+strlen(atype)+strlen(_FORMAT)));
+			  sprintf(b, _FORMAT, vtype, atype);
+#undef _FORMAT
 			  asexc = ArrayStoreException(b);
 			  KFREE(b);
 			  throwException(asexc);
Index: kaffe/libraries/clib/net/PlainDatagramSocketImpl.c
diff -u kaffe/libraries/clib/net/PlainDatagramSocketImpl.c:1.50 kaffe/libraries/clib/net/PlainDatagramSocketImpl.c:1.51
--- kaffe/libraries/clib/net/PlainDatagramSocketImpl.c:1.50	Mon Dec 20 03:40:04 2004
+++ kaffe/libraries/clib/net/PlainDatagramSocketImpl.c	Tue Dec 21 05:49:58 2004
@@ -79,17 +79,7 @@
 	int i, count;
 
 	for (count=0,i=0;i<16;i++) {
-	    char *format;
-	    
-	    if (i == 0 && addr->s6_addr[i] != 0)
-	      format = "%x";
-	    else if (addr->s6_addr[i] != 0)
-	      format = "%x:";
-	    else if (i != 0)
-	      format = ":";
-	    else
-	      format = "";
-	    count += sprintf(&addrbuf[count], format, addr->s6_addr[i]);
+	    count += sprintf(&addrbuf[count], i == 0 && addr->s6_addr[i] != 0 ? "%x" : addr->s6_addr[i] != 0 ? "%x:" : i != 0 ? ":" : "", addr->s6_addr[i]);
 	}
 	return addrbuf;
 }
Index: kaffe/libraries/clib/security/kaffe_md5.c
diff -u kaffe/libraries/clib/security/kaffe_md5.c:1.1 kaffe/libraries/clib/security/kaffe_md5.c:1.2
--- kaffe/libraries/clib/security/kaffe_md5.c:1.1	Wed Oct 13 18:43:24 1999
+++ kaffe/libraries/clib/security/kaffe_md5.c	Tue Dec 21 05:49:58 2004
@@ -72,8 +72,7 @@
 /* Initialize structure containing state of computation.
    (RFC 1321, 3.3: Step 3)  */
 void
-md5_init_ctx (ctx)
-     struct md5_ctx *ctx;
+md5_init_ctx (struct md5_ctx *ctx)
 {
   ctx->A = 0x67452301;
   ctx->B = 0xefcdab89;
@@ -90,9 +89,7 @@
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
 void *
-md5_read_ctx (ctx, resbuf)
-     const struct md5_ctx *ctx;
-     void *resbuf;
+md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
 {
   ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
   ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -108,9 +105,7 @@
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
 void *
-md5_finish_ctx (ctx, resbuf)
-     struct md5_ctx *ctx;
-     void *resbuf;
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
 {
   /* Take yet unprocessed bytes into account.  */
   md5_uint32 bytes = ctx->buflen;
@@ -139,9 +134,7 @@
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
 int
-md5_stream (stream, resblock)
-     FILE *stream;
-     void *resblock;
+md5_stream (FILE *stream, void *resblock)
 {
   /* Important: BLOCKSIZE must be a multiple of 64.  */
 #define BLOCKSIZE 4096
@@ -196,10 +189,7 @@
    output yields to the wanted ASCII representation of the message
    digest.  */
 void *
-md5_buffer (buffer, len, resblock)
-     const char *buffer;
-     size_t len;
-     void *resblock;
+md5_buffer (const char *buffer, size_t len, void *resblock)
 {
   struct md5_ctx ctx;
 
@@ -215,10 +205,7 @@
 
 
 void
-md5_process_bytes (buffer, len, ctx)
-     const void *buffer;
-     size_t len;
-     struct md5_ctx *ctx;
+md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
 {
   /* When we already have some bits in our internal buffer concatenate
      both inputs first.  */
@@ -273,10 +260,7 @@
    It is assumed that LEN % 64 == 0.  */
 
 void
-md5_process_block (buffer, len, ctx)
-     const void *buffer;
-     size_t len;
-     struct md5_ctx *ctx;
+md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
 {
   md5_uint32 correct_words[16];
   const md5_uint32 *words = buffer;
Index: kaffe/libraries/clib/security/sha-1.c
diff -u kaffe/libraries/clib/security/sha-1.c:1.1 kaffe/libraries/clib/security/sha-1.c:1.2
--- kaffe/libraries/clib/security/sha-1.c:1.1	Mon May 24 18:02:54 2004
+++ kaffe/libraries/clib/security/sha-1.c	Tue Dec 21 05:49:58 2004
@@ -68,8 +68,7 @@
 
 static void sha1_block(SHA1_CTX *c, register unsigned long *p);
 
-void SHA1Init(c)
-SHA1_CTX *c;
+void SHA1Init(SHA1_CTX *c)
 	{
 	c->h0=INIT_DATA_h0;
 	c->h1=INIT_DATA_h1;
@@ -81,10 +80,7 @@
 	c->num=0;
 	}
 
-void SHA1Update(c, data, len)
-SHA1_CTX *c;
-register const unsigned char *data;
-unsigned long len;
+void SHA1Update(SHA1_CTX *c, register const unsigned char *data, unsigned long len)
 	{
 	register ULONG *p;
 	int ew,ec,sw,sc;
@@ -190,9 +186,7 @@
 	p[sw]=l;
 	}
 
-static void sha1_block(c, X)
-SHA1_CTX *c;
-register unsigned long *X;
+static void sha1_block(SHA1_CTX *c, register unsigned long *X)
 	{
 	register ULONG A,B,C,D,E,T;
 
@@ -293,9 +287,7 @@
 	c->h4=(c->h4+C)&0xffffffff;
 	}
 
-void SHA1Final(md, c)
-unsigned char *md;
-SHA1_CTX *c;
+void SHA1Final(unsigned char *md, SHA1_CTX *c)
 	{
 	register int i,j;
 	register ULONG l;
Index: kaffe/replace/getaddrinfo.c
diff -u kaffe/replace/getaddrinfo.c:1.6 kaffe/replace/getaddrinfo.c:1.7
--- kaffe/replace/getaddrinfo.c:1.6	Fri Dec 10 20:54:40 2004
+++ kaffe/replace/getaddrinfo.c	Tue Dec 21 05:49:57 2004
@@ -212,8 +212,7 @@
  * gai_strerror().
  */
 const char *
-gai_strerror(ecode)
-    int ecode;
+gai_strerror(int ecode)
 {
     if (ecode < 0 || ecode > EAI_SYSTEM)
 	return _("Unknown error");
@@ -225,8 +224,7 @@
  * freeaddrinfo().
  */
 void
-freeaddrinfo(ai)
-    struct addrinfo *ai;
+freeaddrinfo(struct addrinfo *ai)
 {
     struct addrinfo *next_ai;
 
@@ -245,8 +243,7 @@
  * Return 1 if the string `s' represents an integer.
  */
 static int
-is_integer(s)
-    const char *s;
+is_integer(const char *s)
 {
     if (*s == '-' || *s == '+')
 	s++;
@@ -266,8 +263,7 @@
  * as "192.168".
  */
 static int
-is_address(s)
-    const char *s;
+is_address(const char *s)
 {
     static const char delimiters[] = {'.', '.', '.', '\0'};
     int i, j;
@@ -291,8 +287,7 @@
  * sprintf(s, "%d", n).
  */
 static int
-itoa_length(n)
-    int n;
+itoa_length(int n)
 {
     int result = 1;
 
@@ -313,11 +308,7 @@
  * getaddrinfo().
  */
 int
-getaddrinfo(nodename, servname, hints, res)
-    const char *nodename;
-    const char *servname;
-    const struct addrinfo *hints;
-    struct addrinfo **res;
+getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
 {
     struct addrinfo *head_res = NULL;
     struct addrinfo *tail_res = NULL;
@@ -502,14 +493,7 @@
  * getnameinfo().
  */
 int
-getnameinfo(sa, salen, node, nodelen, serv, servlen, flags)
-    const struct sockaddr *sa;
-    socklen_t UNUSED salen;
-    char *node;
-    socklen_t nodelen;
-    char *serv;
-    socklen_t servlen;
-    int flags;
+getnameinfo(const struct sockaddr *sa, socklen_t UNUSED salen, char *node, socklen_t nodelen, char *serv, socklen_t servlen, int flags)
 {
     const struct sockaddr_in *sa_in = (const struct sockaddr_in *)sa;
     struct hostent *hostent;



More information about the kaffe mailing list