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

Kaffe CVS cvs-commits at kaffe.org
Tue Dec 21 00:11:20 PST 2004


PatchSet 5694 
Date: 2004/12/21 08:06:31
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Various gcc and sparse fixes all over the board.

Members: 
	ChangeLog:1.3240->1.3241 
	kaffe/kaffevm/classMethod.c:1.129->1.130 
	kaffe/kaffevm/findInJar.c:1.62->1.63 
	kaffe/kaffevm/gc.h:1.29->1.30 
	kaffe/kaffevm/gcFuncs.c:1.60->1.61 
	kaffe/kaffevm/hashtab.c:1.14->1.15 
	kaffe/kaffevm/jar.c:1.33->1.34 
	kaffe/kaffevm/jar.h:1.8->1.9 
	kaffe/kaffevm/stackTrace.c:1.44->1.45 
	kaffe/kaffevm/string.c:1.38->1.39 
	kaffe/kaffevm/stringSupport.h:1.13->1.14 
	kaffe/kaffevm/jit3/machine.c:1.64->1.65 
	kaffe/kaffevm/jni/jni-string.c:1.5->1.6 
	kaffe/kaffevm/jni/jni.c:1.13->1.14 
	kaffe/kaffevm/jni/jni_funcs.h:1.4->1.5 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:1.3->1.4 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:1.4->1.5 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:1.4->1.5 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c:1.3->1.4 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c:1.4->1.5 
	libraries/clib/net/PlainSocketImpl.c:1.51->1.52 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3240 kaffe/ChangeLog:1.3241
--- kaffe/ChangeLog:1.3240	Tue Dec 21 07:45:15 2004
+++ kaffe/ChangeLog	Tue Dec 21 08:06:31 2004
@@ -1,3 +1,20 @@
+2004-12-21  Adam Heath  <doogie at brainfood.com>
+
+	* kaffe/kaffevm/classMethod.c, kaffe/kaffevm/findInJar.c,
+	  kaffe/kaffevm/gc.h, kaffe/kaffevm/gcFuncs.c,
+	  kaffe/kaffevm/hashtab.c, kaffe/kaffevm/jar.c, kaffe/kaffevm/jar.h,
+	  kaffe/kaffevm/stackTrace.c, kaffe/kaffevm/string.c,
+	  kaffe/kaffevm/stringSupport.h, kaffe/kaffevm/jit3/machine.c,
+	  kaffe/kaffevm/jni/jni-string.c, kaffe/kaffevm/jni/jni.c,
+	  kaffe/kaffevm/jni/jni_funcs.h,
+	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c,
+	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,
+	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,
+	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c,
+	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c,
+	  libraries/clib/net/PlainSocketImpl.c:
+	  Various gcc and sparse fixes all over the board.
+
 2004-12-21  Dalibor Topic  <robilad at kaffe.org>
 
 	* libraries/javalib/java/util/iso4217.properties:
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.129 kaffe/kaffe/kaffevm/classMethod.c:1.130
--- kaffe/kaffe/kaffevm/classMethod.c:1.129	Tue Dec 21 05:49:59 2004
+++ kaffe/kaffe/kaffevm/classMethod.c	Tue Dec 21 08:06:36 2004
@@ -885,7 +885,7 @@
  * @return True if the class name is in one of the packages, false otherwise.
  */
 static int
-inPackageSet(char **plist, Utf8Const *name)
+inPackageSet(const char **plist, Utf8Const *name)
 {
 	unsigned int name_len, lpc, retval = 0;
 	
@@ -908,7 +908,7 @@
  * The set of restricted packages that a user defined class loader can't add
  * classes to.
  */
-static char *restrictedPackages[] = {
+static const char *restrictedPackages[] = {
 	"java/",
 	"kaffe/",
 	NULL
Index: kaffe/kaffe/kaffevm/findInJar.c
diff -u kaffe/kaffe/kaffevm/findInJar.c:1.62 kaffe/kaffe/kaffevm/findInJar.c:1.63
--- kaffe/kaffe/kaffevm/findInJar.c:1.62	Sun Dec 19 22:13:07 2004
+++ kaffe/kaffe/kaffevm/findInJar.c	Tue Dec 21 08:06:36 2004
@@ -50,7 +50,7 @@
 
 classpathEntry* classpath;
 
-char* realClassPath;
+const char* realClassPath;
 char* realBootClassPath;
 
 void initClasspath(void);
@@ -66,7 +66,7 @@
 
 #if defined(HANDLE_MANIFEST_CLASSPATH)
 static int isEntryInClasspath(const char*);
-static uint8* getManifestMainAttribute(jarFile*, char*);
+static uint8* getManifestMainAttribute(jarFile*, const char*);
 static void handleManifestClassPath (classpathEntry *);
 #endif
 
@@ -134,9 +134,8 @@
 	case CP_DIR:
 	case CP_ZIPFILE:
 		class = newClass();
-		if (class == 0) {
+		if (class == NULL) {
 			postOutOfMemory(einfo);
-			KFREE(hand.base);
 			return (NULL);
 		}
 
@@ -144,14 +143,13 @@
 		class->centry = centry;
 		class = readClass(class, &hand, NULL, einfo);
 
-		if (hand.base != 0) {
+		if (hand.base != NULL) {
 #if defined(KAFFE_STATS)
 			if (hand.type == CP_ZIPFILE) {
 				addToCounter(&jarmem, "vmmem-jar files", 1,
 					-(jlong)GCSIZEOF(hand.base));
 			}
 #endif
-			KFREE(hand.base);
 		}
 		return (class);
 
@@ -345,17 +343,17 @@
 void
 initClasspath(void)
 {
-	char* cp;
-	char* hm;
+	const char* cp;
+	const char* hm;
 	size_t len;
 	classpathEntry* ptr;
 
 	DBG(INIT, dprintf("initClasspath()\n"); );
 
-	cp = (char*)Kaffe_JavaVMArgs.bootClasspath;
-	hm = (char*)Kaffe_JavaVMArgs.classhome;
+	cp = Kaffe_JavaVMArgs.bootClasspath;
+	hm = Kaffe_JavaVMArgs.classhome;
 
-	if (cp != 0 && cp[0] != '\0') {
+	if (cp != NULL && cp[0] != '\0') {
 		/* cp may reside in read-only memory, but
 		 * makeClasspath writes to it
 		 */
@@ -380,7 +378,7 @@
 
 	if (len == 0) {
 		/* Error on classpath will be reported latter */
-		realBootClassPath = "";
+		realBootClassPath = strdup("");
 		return;
 	}
 
@@ -393,7 +391,7 @@
 		strcat(realBootClassPath, ptr->path);
 	}
 	
-	realClassPath = (char *)Kaffe_JavaVMArgs.classpath;
+	realClassPath = Kaffe_JavaVMArgs.classpath;
 
 	DBG(INIT, dprintf("initClasspath() done, got %s\n", realBootClassPath); );
 }
@@ -610,13 +608,14 @@
 
 
 static uint8*
-getManifestMainAttribute(jarFile* file, char* attrName)
+getManifestMainAttribute(jarFile* file, const char* attrName)
 {
 	jarEntry* mf;
 	uint8* mfdata;
 	uint8* attrEntry;
 	uint8* ret;
-	int i, posAttrValue;
+	size_t i;
+	int posAttrValue;
 
 	/* Locate manifest entry in jar */
 	mf = lookupJarFile(file, "META-INF/MANIFEST.MF");
Index: kaffe/kaffe/kaffevm/gc.h
diff -u kaffe/kaffe/kaffevm/gc.h:1.29 kaffe/kaffe/kaffevm/gc.h:1.30
--- kaffe/kaffe/kaffevm/gc.h:1.29	Sun Dec 19 06:41:29 2004
+++ kaffe/kaffe/kaffevm/gc.h	Tue Dec 21 08:06:36 2004
@@ -226,5 +226,5 @@
 #define gc_enableGC()	    KGC_enableGC(main_collector)
 #define gc_disableGC()	    KGC_disableGC(main_collector)
 
-extern char* describeObject(const void* mem);
+extern const char* describeObject(const void* mem);
 #endif
Index: kaffe/kaffe/kaffevm/gcFuncs.c
diff -u kaffe/kaffe/kaffevm/gcFuncs.c:1.60 kaffe/kaffe/kaffevm/gcFuncs.c:1.61
--- kaffe/kaffe/kaffevm/gcFuncs.c:1.60	Sun Dec 19 22:13:07 2004
+++ kaffe/kaffe/kaffevm/gcFuncs.c	Tue Dec 21 08:06:36 2004
@@ -529,13 +529,13 @@
  * Print a description of an object at a given address.
  * Single-threaded.
  */
-char*
+const char*
 describeObject(const void* mem)
 {
 	static char buf[256];		/* BIG XXX */
-	Hjava_lang_Class* clazz;
-	Hjava_lang_String* str;
-	Hjava_lang_Object* obj;
+	const Hjava_lang_Class* clazz;
+	const Hjava_lang_String* str;
+	const Hjava_lang_Object* obj;
 	char* c;
 	jchar* jc;
 	int l;
@@ -544,7 +544,7 @@
 	switch (idx) {
 	case KGC_ALLOC_JAVASTRING:
 
-		str = (Hjava_lang_String*)mem;
+		str = (const Hjava_lang_String*)mem;
 		strcpy(buf, "java.lang.String `");
 		c = buf + strlen(buf);
 		jc = unhand(str)->value ? STRING_DATA(str) : NULL;
@@ -557,7 +557,7 @@
 		break;
 
 	case KGC_ALLOC_CLASSOBJECT:
-		clazz = (Hjava_lang_Class*)mem;
+		clazz = (const Hjava_lang_Class*)mem;
 		sprintf(buf, "java.lang.Class `%s'", clazz->name ?
 			CLASS_CNAME(clazz) : "name unknown");
 		break;
@@ -567,7 +567,7 @@
 	case KGC_ALLOC_FINALIZEOBJECT:
 	case KGC_ALLOC_REFARRAY:
 	case KGC_ALLOC_PRIMARRAY:
-		obj = (Hjava_lang_Object*)mem;
+		obj = (const Hjava_lang_Object*)mem;
 		if (obj->vtable != 0) {
 			clazz = obj->vtable->class;
 			sprintf(buf, "%s", CLASS_CNAME(clazz));
@@ -580,7 +580,7 @@
 	/* add more? */
 
 	default:
-		return ((char*)KGC_getObjectDescription(main_collector, mem));
+		return KGC_getObjectDescription(main_collector, mem);
 	}
 	return (buf);
 }
Index: kaffe/kaffe/kaffevm/hashtab.c
diff -u kaffe/kaffe/kaffevm/hashtab.c:1.14 kaffe/kaffe/kaffevm/hashtab.c:1.15
--- kaffe/kaffe/kaffevm/hashtab.c:1.14	Sun Dec 19 22:13:07 2004
+++ kaffe/kaffe/kaffevm/hashtab.c	Tue Dec 21 08:06:37 2004
@@ -103,7 +103,7 @@
 hashAdd(hashtab_t tab, const void *ptr)
 {
 	int	i;
-	void	*rtn;
+	const void	*rtn;
 
 	if (NEED_RESIZE(tab)) {
 		if (hashResize(tab) == 0) {
@@ -117,7 +117,7 @@
 		tab->list[i] = ptr;
 		tab->count++;
 	}
-	rtn = (void *) tab->list[i];
+	rtn = tab->list[i];
 
 	return(rtn);
 }
@@ -148,12 +148,12 @@
 hashFind(hashtab_t tab, const void *ptr)
 {
 	int i;
-	void *rtn;
+	const void *rtn;
 
 	i = hashFindSlot(tab, ptr);
 	assert(i != -1);
 	rtn = (tab->list[i] == DELETED) ?
-		NULL : (void *) tab->list[i];
+		NULL : tab->list[i];
 
 	return(rtn);
 }
Index: kaffe/kaffe/kaffevm/jar.c
diff -u kaffe/kaffe/kaffevm/jar.c:1.33 kaffe/kaffe/kaffevm/jar.c:1.34
--- kaffe/kaffe/kaffevm/jar.c:1.33	Sun Dec 19 22:13:07 2004
+++ kaffe/kaffe/kaffevm/jar.c	Tue Dec 21 08:06:37 2004
@@ -1234,12 +1234,12 @@
 	}
 }
 
-jarEntry *lookupJarFile(jarFile *jf, char *entry_name)
+jarEntry *lookupJarFile(jarFile *jf, const char *entry_name)
 {
 	jarEntry *retval = NULL;
 
-	assert(jf != 0);
-	assert(entry_name != 0);
+	assert(jf != NULL);
+	assert(entry_name != NULL);
 	
 	/*
 	 * No need to visit the kernel here since we're just walking the
Index: kaffe/kaffe/kaffevm/jar.h
diff -u kaffe/kaffe/kaffevm/jar.h:1.8 kaffe/kaffe/kaffevm/jar.h:1.9
--- kaffe/kaffe/kaffevm/jar.h:1.8	Sun Feb  1 22:14:53 2004
+++ kaffe/kaffe/kaffevm/jar.h	Tue Dec 21 08:06:37 2004
@@ -237,7 +237,7 @@
  * `jf' - The jarFile in which to search for the given file.
  * `entry_name' - The name of the file to search for in the JAR.
  */
-jarEntry *lookupJarFile(jarFile *jf, char *entry_name);
+jarEntry *lookupJarFile(jarFile *jf, const char *entry_name);
 /*
  * Read in and, if necessary, decompress the contents of a file stored in a
  * JAR file.
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.44 kaffe/kaffe/kaffevm/stackTrace.c:1.45
--- kaffe/kaffe/kaffevm/stackTrace.c:1.44	Tue Dec 21 00:15:30 2004
+++ kaffe/kaffe/kaffevm/stackTrace.c	Tue Dec 21 08:06:37 2004
@@ -97,9 +97,9 @@
 #include "machine.h"
 
 static Method*
-stacktraceFindMethod(uintp fp UNUSED, uintp pc)
+stacktraceFindMethod(uintp fp UNUSED, uintp _pc)
 {
-	void *pc_base = KGC_getObjectBase(main_collector, (void *)pc);
+	void *pc_base = KGC_getObjectBase(main_collector, (void *)_pc);
 
 	if (pc_base) {
 		jitCodeHeader *jch;
@@ -120,9 +120,9 @@
 #endif
 
 static inline int32
-getLineNumber(Method* meth, uintp pc)
+getLineNumber(Method* meth, uintp _pc)
 {
-	int i;
+	size_t i;
 	int32 linenr;
 	uintp linepc;
 
@@ -130,7 +130,7 @@
 	if (meth->lines != 0) {
 		linepc = 0;
 		for (i = 0; i < meth->lines->length; i++) {
-			if (pc >= meth->lines->entry[i].start_pc
+			if (_pc >= meth->lines->entry[i].start_pc
 			    && linepc <= meth->lines->entry[i].start_pc) {
 				linenr = meth->lines->entry[i].line_nr;
 				linepc = meth->lines->entry[i].start_pc;
@@ -214,7 +214,7 @@
 	Hjava_lang_VMThrowable* vmstate;
 	stackTraceInfo* info;
 	Method* meth;
-	uintp pc;
+	uintp _pc;
 	int32 linenr;
 	char *buf;
 	int len;
@@ -225,18 +225,18 @@
 	errorInfo einfo;
 
 	vmstate = (Hjava_lang_VMThrowable*)unhand(o)->vmState;
-	if (vmstate == 0) {
+	if (vmstate == NULL) {
 		return;
 	}
 	info = (stackTraceInfo*)unhand(vmstate)->backtrace;
-	if (info == 0) {
+	if (info == NULL) {
 		return;
 	}
 	for (i = 0; info[i].meth != ENDOFSTACK; i++) {
-		pc = info[i].pc;
+		_pc = info[i].pc;
 		meth = info[i].meth; 
-		if (meth != 0) {
-			linenr = getLineNumber (meth, pc);
+		if (meth != NULL) {
+			linenr = getLineNumber (meth, _pc);
 			
 			/* Even if we are reporting an out of memory and
 			   checkPtr fails, this is ok.  If we can't allocate
@@ -262,7 +262,7 @@
 						class_dot_name,
 						meth->name->data, 
 						CLASS_SOURCEFILE(meth->class),
-						(void*)pc);
+						(void*)_pc);
 				}
 			}
 			else {
@@ -288,8 +288,8 @@
 				cptr[j] = (unsigned char)buf[j];
 			}
 			if (p != NULL || !nullOK) {
-				do_execute_java_method(p, "println",
-					"([C)V", NULL, NULL, str);
+				do_execute_java_method(NULL, p, "println",
+					"([C)V", NULL, 0, str);
 			} else {
 				dprintf("%s\n", buf);
 			}
Index: kaffe/kaffe/kaffevm/string.c
diff -u kaffe/kaffe/kaffevm/string.c:1.38 kaffe/kaffe/kaffevm/string.c:1.39
--- kaffe/kaffe/kaffevm/string.c:1.38	Mon Dec 20 02:12:53 2004
+++ kaffe/kaffe/kaffevm/string.c	Tue Dec 21 08:06:37 2004
@@ -27,7 +27,7 @@
 static int *            stringLockRoot = NULL;	/* the string lock is not a monitor */
 
 /* Internal functions */
-static int		stringHashValue(const void *ptr);
+static int		stringHashValue(void *ptr);
 static int		stringCompare(const void *s1, const void *s2);
 
 /*
@@ -304,11 +304,11 @@
  * Return the interned version of a String object.
  * May or may not be the same String.
  */
-Hjava_lang_String *
+const Hjava_lang_String *
 stringInternString(Hjava_lang_String *string)
 {
 	int iLockRoot;
-	Hjava_lang_String *temp;
+	const Hjava_lang_String *temp;
 
 	/* Lock intern table */
 	lockStaticMutex(&stringLock);
@@ -316,7 +316,7 @@
 
 	/* See if string is already in the table */
 	if (hashTable != NULL) {
-		Hjava_lang_String *string2;
+		const Hjava_lang_String *string2;
 
 		if ((string2 = hashFind(hashTable, string)) != NULL) {
 			unlockStaticMutex(&stringLock);
@@ -368,9 +368,9 @@
  * is getting written no matter who writes it (strings are immutable).
  */
 static int
-stringHashValue(const void *ptr)
+stringHashValue(void *ptr)
 {
-	Hjava_lang_String *const string = (Hjava_lang_String*) ptr;
+	Hjava_lang_String *string = (Hjava_lang_String*) ptr;
 	jint hash;
 	int k;
 
Index: kaffe/kaffe/kaffevm/stringSupport.h
diff -u kaffe/kaffe/kaffevm/stringSupport.h:1.13 kaffe/kaffe/kaffevm/stringSupport.h:1.14
--- kaffe/kaffe/kaffevm/stringSupport.h:1.13	Mon Aug  2 10:44:56 2004
+++ kaffe/kaffe/kaffevm/stringSupport.h	Tue Dec 21 08:06:37 2004
@@ -40,7 +40,7 @@
 extern HArrayOfChar*	  stringC2CharArray(const char*);
 
 /* Return the interned version of the String object */
-extern Hjava_lang_String* stringInternString(Hjava_lang_String*);
+extern const Hjava_lang_String* stringInternString(Hjava_lang_String*);
 
 /* Remove the String object from the intern table. This should only be
    called during destruction of the corresponding String object. */
Index: kaffe/kaffe/kaffevm/jit3/machine.c
diff -u kaffe/kaffe/kaffevm/jit3/machine.c:1.64 kaffe/kaffe/kaffevm/jit3/machine.c:1.65
--- kaffe/kaffe/kaffevm/jit3/machine.c:1.64	Tue Dec 21 05:50:00 2004
+++ kaffe/kaffe/kaffevm/jit3/machine.c	Tue Dec 21 08:06:37 2004
@@ -1165,8 +1165,8 @@
 	localUse* lcluse1;
 	localUse* lcluse2;
 
-	lcluse1 = &codeInfo->localuse[*((SlotInfo**)s1) - localinfo];
-	lcluse2 = &codeInfo->localuse[*((SlotInfo**)s2) - localinfo];
+	lcluse1 = &codeInfo->localuse[*((SlotInfo* const*)s1) - localinfo];
+	lcluse2 = &codeInfo->localuse[*((SlotInfo* const*)s2) - localinfo];
 
 	if (lcluse1->use == lcluse2->use) {
 		return (0);
Index: kaffe/kaffe/kaffevm/jni/jni-string.c
diff -u kaffe/kaffe/kaffevm/jni/jni-string.c:1.5 kaffe/kaffe/kaffevm/jni/jni-string.c:1.6
--- kaffe/kaffe/kaffevm/jni/jni-string.c:1.5	Mon Dec 20 00:13:16 2004
+++ kaffe/kaffe/kaffevm/jni/jni-string.c	Tue Dec 21 08:06:37 2004
@@ -174,7 +174,7 @@
 }
 
 void
-KaffeJNI_ReleaseStringUTFChars(JNIEnv* env UNUSED, jstring data UNUSED, jbyte* chars)
+KaffeJNI_ReleaseStringUTFChars(JNIEnv* env UNUSED, jstring data UNUSED, const char* chars)
 {
   BEGIN_EXCEPTION_HANDLING_VOID();
 
Index: kaffe/kaffe/kaffevm/jni/jni.c
diff -u kaffe/kaffe/kaffevm/jni/jni.c:1.13 kaffe/kaffe/kaffevm/jni/jni.c:1.14
--- kaffe/kaffe/kaffevm/jni/jni.c:1.13	Mon Dec 20 00:13:16 2004
+++ kaffe/kaffe/kaffevm/jni/jni.c	Tue Dec 21 08:06:38 2004
@@ -185,7 +185,7 @@
 }
 
 static jclass
-Kaffe_DefineClass(JNIEnv* env, jobject loader, const jbyte* buf, jsize len)
+Kaffe_DefineClass(JNIEnv* env, const char *name, jobject loader, const jbyte* buf, jsize len)
 {
 	Hjava_lang_Class* cls;
 	classFile hand;
@@ -294,7 +294,7 @@
 
 	eobj = execute_java_constructor(NULL, NULL, cls,
 					"(Ljava/lang/String;)V",
-					checkPtr(stringC2Java((char*)mess)));
+					checkPtr(stringC2Java(mess)));
 
 	thread_data->exceptObj = (struct Hjava_lang_Throwable*)eobj;
 
@@ -475,7 +475,7 @@
 	errorInfo info;
 
 	BEGIN_EXCEPTION_HANDLING(NULL);
-	meth = lookupClassMethod((Hjava_lang_Class*)cls, (char*)name, (char*)sig, &info);
+	meth = lookupClassMethod((Hjava_lang_Class*)cls, name, sig, &info);
 	if (meth == NULL) {
 		postError(env, &info);
 	} 
@@ -515,7 +515,7 @@
 	errorInfo info;
 
 	BEGIN_EXCEPTION_HANDLING(NULL);
-	meth = lookupClassMethod((Hjava_lang_Class*)cls, (char*)name, (char*)sig, &info);
+	meth = lookupClassMethod((Hjava_lang_Class*)cls, name, sig, &info);
 	if (meth == NULL) {
 		postError(env, &info);
 	} else if (!METHOD_IS_STATIC(meth)) {
@@ -643,7 +643,7 @@
 }
 
 static jint
-Kaffe_AttachCurrentThread(JavaVM* vm UNUSED, void** penv, JavaVMAttachArgs* args UNUSED)
+Kaffe_AttachCurrentThread(JavaVM* vm UNUSED, void** penv, void* args UNUSED)
 {
 	if (KTHREAD(attach_current_thread) (false)) {
 		KSEM(init)(&THREAD_DATA()->sem);
@@ -655,7 +655,7 @@
 }
 
 static jint
-Kaffe_AttrachCurrentThreadAsDaemon(JavaVM* vm UNUSED, void** penv, JavaVMAttachArgs* args UNUSED)
+Kaffe_AttrachCurrentThreadAsDaemon(JavaVM* vm UNUSED, void** penv, void* args UNUSED)
 {
 	if (KTHREAD(attach_current_thread) (true)) {
 		KSEM(init)(&THREAD_DATA()->sem);
@@ -963,7 +963,7 @@
 /*
  * Setup the Kaffe invoke interface.
  */
-struct JNIInvokeInterface Kaffe_JNIInvokeInterface = {
+const struct JNIInvokeInterface Kaffe_JNIInvokeInterface = {
 	NULL,
 	NULL,
 	NULL,
@@ -994,8 +994,8 @@
 	".",		/* Classpath */
 	NULL,		/* Bootclasspath */
 	(void*)&vfprintf,/* Vprintf */
-	(void*)&exit,	/* Exit */
-	(void*)&abort,	/* Abort */
+	&exit,	/* Exit */
+	&abort,	/* Abort */
 	1,		/* Enable class GC */
 	0,		/* Enable verbose GC */
 	1,		/* Disable async GC */
Index: kaffe/kaffe/kaffevm/jni/jni_funcs.h
diff -u kaffe/kaffe/kaffevm/jni/jni_funcs.h:1.4 kaffe/kaffe/kaffevm/jni/jni_funcs.h:1.5
--- kaffe/kaffe/kaffevm/jni/jni_funcs.h:1.4	Sun Dec 12 06:54:28 2004
+++ kaffe/kaffe/kaffevm/jni/jni_funcs.h	Tue Dec 21 08:06:38 2004
@@ -30,7 +30,7 @@
 jsize   KaffeJNI_GetStringUTFLength(JNIEnv* env, jstring data);
 const jbyte*
         KaffeJNI_GetStringUTFChars(JNIEnv* env, jstring data, jbool* copy);
-void    KaffeJNI_ReleaseStringUTFChars(JNIEnv* env, jstring data, jbyte* chars);
+void    KaffeJNI_ReleaseStringUTFChars(JNIEnv* env, jstring data, const char* chars);
 void    KaffeJNI_GetStringRegion(JNIEnv *env, jstring data, jsize start, jsize len, jchar *buf);
 void    KaffeJNI_GetStringUTFRegion(JNIEnv *env, jstring data, jsize start, jsize len, char *buf);
 
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c:1.3	Fri Oct 29 00:39:25 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c	Tue Dec 21 08:06:34 2004
@@ -49,7 +49,7 @@
  */
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GThreadNativeMethodRunner_nativeRun
-  (JNIEnv *gdk_env __attribute__((unused)),
+  (JNIEnv *_gdk_env __attribute__((unused)),
    jobject lcl_obj __attribute__((unused)),
    jlong funcAddr, jlong funcArg)
 {
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:1.4 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:1.5
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c:1.4	Mon Dec 20 02:34:53 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c	Tue Dec 21 08:06:34 2004
@@ -92,7 +92,7 @@
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeAdd 
-  (JNIEnv *env, jobject obj, jstring item, jint index)
+  (JNIEnv *env, jobject obj, jstring item, jint i)
 {
   void *ptr;
   const char *label;
@@ -102,7 +102,7 @@
   label = (*env)->GetStringUTFChars (env, item, NULL);      
 
   gdk_threads_enter ();
-  gtk_combo_box_insert_text (GTK_COMBO_BOX (ptr), index, label);
+  gtk_combo_box_insert_text (GTK_COMBO_BOX (ptr), i, label);
   gdk_threads_leave ();
 
   (*env)->ReleaseStringUTFChars (env, item, label);
@@ -110,14 +110,14 @@
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemove 
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
 
   ptr = NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
-  gtk_combo_box_remove_text (GTK_COMBO_BOX (ptr), index);
+  gtk_combo_box_remove_text (GTK_COMBO_BOX (ptr), i);
   gdk_threads_leave ();
 }
 
@@ -148,14 +148,14 @@
 
 JNIEXPORT void JNICALL 
 Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select 
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
 
   ptr = NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
-  gtk_combo_box_set_active (GTK_COMBO_BOX (ptr), index);
+  gtk_combo_box_set_active (GTK_COMBO_BOX (ptr), i);
   gdk_threads_leave ();
 }
 
@@ -164,15 +164,15 @@
   (JNIEnv *env, jobject obj)
 {
   void *ptr;
-  int index;
+  int i;
 
   ptr = NSA_GET_PTR (env, obj);
 
   gdk_threads_enter ();
-  index = gtk_combo_box_get_active (GTK_COMBO_BOX (ptr));
+  i = gtk_combo_box_get_active (GTK_COMBO_BOX (ptr));
   gdk_threads_leave ();
 
-  return index;
+  return i;
 }
 
 void selection_changed (GtkComboBox *combobox, jobject peer)
@@ -181,11 +181,11 @@
   GtkTreeModel *model;
   GtkTreeIter iter;
   gchar *selected;
-  gint index;
+  gint i;
 
-  index = gtk_combo_box_get_active(combobox);
+  i = gtk_combo_box_get_active(combobox);
 
-  if (index >= 0)
+  if (i >= 0)
     {
       model = gtk_combo_box_get_model (combobox);
 
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:1.4 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:1.5
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:1.4	Sat Oct  9 22:18:26 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c	Tue Dec 21 08:06:34 2004
@@ -236,7 +236,7 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkListPeer_add
-  (JNIEnv *env, jobject obj, jstring text, jint index)
+  (JNIEnv *env, jobject obj, jstring text, jint i)
 {
   void *ptr;
   const char *str;
@@ -252,10 +252,10 @@
   list = TREE_VIEW_FROM_SW (ptr);
   list_store = gtk_tree_view_get_model (list);
 
-  if (index == -1)
+  if (i == -1)
     gtk_list_store_append (GTK_LIST_STORE (list_store), &iter);
   else
-    gtk_list_store_insert (GTK_LIST_STORE (list_store), &iter, index);
+    gtk_list_store_insert (GTK_LIST_STORE (list_store), &iter, i);
 
   gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
                       COLUMN_STRING, str, -1);
@@ -304,7 +304,7 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkListPeer_select
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
   GtkTreeView *list;
@@ -315,7 +315,7 @@
   gdk_threads_enter ();
 
   list = TREE_VIEW_FROM_SW (ptr);
-  path = gtk_tree_path_new_from_indices (index, -1);
+  path = gtk_tree_path_new_from_indices (i, -1);
   gtk_tree_view_set_cursor (list, path, NULL, FALSE);
 
   gdk_threads_leave ();
@@ -323,7 +323,7 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
   GtkTreeView *list;
@@ -336,7 +336,7 @@
 
   list = TREE_VIEW_FROM_SW (ptr);
   selection = gtk_tree_view_get_selection (list);
-  path = gtk_tree_path_new_from_indices (index, -1);
+  path = gtk_tree_path_new_from_indices (i, -1);
   gtk_tree_selection_unselect_path (selection, path);
 
   gdk_threads_leave ();
@@ -443,7 +443,7 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
   GtkTreeView *list;
@@ -454,7 +454,7 @@
   gdk_threads_enter ();
 
   list = TREE_VIEW_FROM_SW (ptr);
-  path = gtk_tree_path_new_from_indices (index, -1);
+  path = gtk_tree_path_new_from_indices (i, -1);
   gtk_tree_view_scroll_to_cell (list, path, NULL, FALSE, 0.0, 0.0);
 
   gdk_threads_leave ();
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c:1.3	Fri Oct 29 00:39:26 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c	Tue Dec 21 08:06:34 2004
@@ -97,7 +97,7 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
   GList *list;
@@ -106,7 +106,7 @@
 
   gdk_threads_enter ();
   list = gtk_container_children (GTK_CONTAINER (ptr));
-  list = g_list_nth (list, index);
+  list = g_list_nth (list, i);
   gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
   gdk_threads_leave ();
 }
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c:1.4 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c:1.5
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c:1.4	Fri Oct 29 00:39:26 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c	Tue Dec 21 08:06:34 2004
@@ -155,7 +155,7 @@
 
 JNIEXPORT void JNICALL
 Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
-  (JNIEnv *env, jobject obj, jint index)
+  (JNIEnv *env, jobject obj, jint i)
 {
   void *ptr;
   GList *list;
@@ -164,7 +164,7 @@
 
   gdk_threads_enter ();
   list = gtk_container_children (GTK_CONTAINER (ptr));
-  list = g_list_nth (list, index);
+  list = g_list_nth (list, i);
   gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
   gdk_threads_leave ();
 }
Index: kaffe/libraries/clib/net/PlainSocketImpl.c
diff -u kaffe/libraries/clib/net/PlainSocketImpl.c:1.51 kaffe/libraries/clib/net/PlainSocketImpl.c:1.52
--- kaffe/libraries/clib/net/PlainSocketImpl.c:1.51	Mon Dec 20 03:40:04 2004
+++ kaffe/libraries/clib/net/PlainSocketImpl.c	Tue Dec 21 08:06:34 2004
@@ -73,7 +73,7 @@
  */
   static const struct {
 	  int opt;
-	  char *name;
+	  const char *name;
   } optionNames[] = {
 
 #if defined(SO_SNDBUF)
@@ -124,17 +124,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;
 }
@@ -572,7 +562,7 @@
 	unsigned int k;
 
 	DBG(NATIVENET,
-	    char *optstr = "UNKNOWN";
+	    const char *optstr = "UNKNOWN";
 	    for (k = 0; k < sizeof(optionNames) / sizeof(optionNames[0]); k++) 
 		    if (optionNames[k].opt == opt)
 			    optstr = optionNames[k].name;
@@ -632,7 +622,7 @@
 	unsigned int k;
 
 	DBG(NATIVENET,
-	    char *optstr = "UNKNOWN";
+	    const char *optstr = "UNKNOWN";
 	    for (k = 0; k < sizeof(optionNames) / sizeof(optionNames[0]); k++) 
 		    if (optionNames[k].opt == opt)
 			    optstr = optionNames[k].name;




More information about the kaffe mailing list