[kaffe] CVS kaffe (dalibor): Various warning fixes

Kaffe CVS cvs-commits at kaffe.org
Sun Apr 18 07:06:03 PDT 2004


PatchSet 4658 
Date: 2004/04/18 13:57:24
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Various warning fixes

2004-04-18  Nektarios Papadopoulos <npapadop at inaccessnetworks.com>

        * kaffe/kaffevm/classMethod.c,
        kaffe/kaffevm/classMethod.h,
        kaffe/kaffevm/debug.c,
        kaffe/kaffevm/external.c,
        kaffe/kaffevm/file.h,
        kaffe/kaffevm/findInJar.c,
        kaffe/kaffevm/fp.c,
        kaffe/kaffevm/jar.c,
        kaffe/kaffevm/jni.c,
        kaffe/kaffevm/object.c,
        kaffe/kaffevm/object.h,
        kaffe/kaffevm/readClass.c,
        kaffe/kaffevm/soft.c,
        kaffe/kaffevm/stackTrace.c,
        kaffe/kaffevm/string.c,
        kaffe/kaffevm/stringParsing.c,
        kaffe/kaffevm/support.c,
        kaffe/kaffevm/utf8const.c,
        kaffe/kaffevm/verify.c,
        kaffe/kaffevm/mem/gc-incremental.c,
        kaffe/kaffevm/systems/unix-jthreads/syscalls.c,
        libraries/clib/io/AudioPlayer.c,
        libraries/clib/io/File.c,
        libraries/clib/management/Debug.c,
        libraries/clib/management/JIT.c,
        libraries/clib/management/XProfiler.c,
        libraries/clib/native/Array.c,
        libraries/clib/native/Arrays.c,
        libraries/clib/native/ByteToCharIconv.c,
        libraries/clib/native/CharToByteIconv.c,
        libraries/clib/native/Class.c,
        libraries/clib/native/ClassLoader.c,
        libraries/clib/native/Compiler.c,
        libraries/clib/native/MemoryAdvice.c,
        libraries/clib/native/Method.c,
        libraries/clib/native/PrimordialClassLoader.c,
        libraries/clib/native/Runtime.c,
        libraries/clib/native/String.c,
        libraries/clib/native/System.c,
        libraries/clib/native/Thread.c,
        libraries/clib/net/InetAddressImpl.c,
        libraries/clib/net/PlainDatagramSocketImpl.c,
        libraries/clib/net/PlainSocketImpl.c,
        libraries/clib/security/digest.c,
        libraries/clib/zip/Adler32.c,
        libraries/clib/zip/CRC32.c,
        libraries/clib/zip/Deflater.c,
        libraries/clib/zip/Inflater.c:
        Fixed various warnings about unused parameters and
        signedness of variables.

Members: 
	ChangeLog:1.2234->1.2235 
	kaffe/kaffevm/classMethod.c:1.118->1.119 
	kaffe/kaffevm/classMethod.h:1.64->1.65 
	kaffe/kaffevm/debug.c:1.50->1.51 
	kaffe/kaffevm/external.c:1.56->1.57 
	kaffe/kaffevm/file.h:1.6->1.7 
	kaffe/kaffevm/findInJar.c:1.56->1.57 
	kaffe/kaffevm/fp.c:1.5->1.6 
	kaffe/kaffevm/jar.c:1.27->1.28 
	kaffe/kaffevm/jni.c:1.110->1.111 
	kaffe/kaffevm/object.c:1.23->1.24 
	kaffe/kaffevm/object.h:1.5->1.6 
	kaffe/kaffevm/readClass.c:1.20->1.21 
	kaffe/kaffevm/soft.c:1.60->1.61 
	kaffe/kaffevm/stackTrace.c:1.34->1.35 
	kaffe/kaffevm/string.c:1.30->1.31 
	kaffe/kaffevm/stringParsing.c:1.6->1.7 
	kaffe/kaffevm/support.c:1.65->1.66 
	kaffe/kaffevm/utf8const.c:1.35->1.36 
	kaffe/kaffevm/verify.c:1.75->1.76 
	kaffe/kaffevm/mem/gc-incremental.c:1.78->1.79 
	kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.13->1.14 
	libraries/clib/io/AudioPlayer.c:1.13->1.14 
	libraries/clib/io/File.c:1.21->1.22 
	libraries/clib/management/Debug.c:1.3->1.4 
	libraries/clib/management/JIT.c:1.4->1.5 
	libraries/clib/management/XProfiler.c:1.1->1.2 
	libraries/clib/native/Array.c:1.18->1.19 
	libraries/clib/native/Arrays.c:1.4->1.5 
	libraries/clib/native/ByteToCharIconv.c:1.9->1.10 
	libraries/clib/native/CharToByteIconv.c:1.7->1.8 
	libraries/clib/native/Class.c:1.71->1.72 
	libraries/clib/native/ClassLoader.c:1.37->1.38 
	libraries/clib/native/Compiler.c:1.5->1.6 
	libraries/clib/native/MemoryAdvice.c:1.2->1.3 
	libraries/clib/native/Method.c:1.36->1.37 
	libraries/clib/native/PrimordialClassLoader.c:1.1->1.2 
	libraries/clib/native/Runtime.c:1.21->1.22 
	libraries/clib/native/String.c:1.14->1.15 
	libraries/clib/native/System.c:1.43->1.44 
	libraries/clib/native/Thread.c:1.15->1.16 
	libraries/clib/net/InetAddressImpl.c:1.21->1.22 
	libraries/clib/net/PlainDatagramSocketImpl.c:1.42->1.43 
	libraries/clib/net/PlainSocketImpl.c:1.42->1.43 
	libraries/clib/security/digest.c:1.6->1.7 
	libraries/clib/zip/Adler32.c:1.5->1.6 
	libraries/clib/zip/CRC32.c:1.5->1.6 
	libraries/clib/zip/Deflater.c:1.13->1.14 
	libraries/clib/zip/Inflater.c:1.12->1.13 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2234 kaffe/ChangeLog:1.2235
--- kaffe/ChangeLog:1.2234	Sat Apr 17 10:31:11 2004
+++ kaffe/ChangeLog	Sun Apr 18 13:57:24 2004
@@ -1,3 +1,56 @@
+2004-04-18  Nektarios Papadopoulos <npapadop at inaccessnetworks.com>
+
+        * kaffe/kaffevm/classMethod.c,
+        kaffe/kaffevm/classMethod.h,
+        kaffe/kaffevm/debug.c,
+        kaffe/kaffevm/external.c,
+        kaffe/kaffevm/file.h,
+        kaffe/kaffevm/findInJar.c,
+        kaffe/kaffevm/fp.c,
+        kaffe/kaffevm/jar.c,
+        kaffe/kaffevm/jni.c,
+        kaffe/kaffevm/object.c,
+        kaffe/kaffevm/object.h,
+        kaffe/kaffevm/readClass.c,
+        kaffe/kaffevm/soft.c,
+        kaffe/kaffevm/stackTrace.c,
+        kaffe/kaffevm/string.c,
+        kaffe/kaffevm/stringParsing.c,
+        kaffe/kaffevm/support.c,
+        kaffe/kaffevm/utf8const.c,
+        kaffe/kaffevm/verify.c,
+        kaffe/kaffevm/mem/gc-incremental.c,
+        kaffe/kaffevm/systems/unix-jthreads/syscalls.c,
+        libraries/clib/io/AudioPlayer.c,
+        libraries/clib/io/File.c,
+        libraries/clib/management/Debug.c,
+        libraries/clib/management/JIT.c,
+        libraries/clib/management/XProfiler.c,
+        libraries/clib/native/Array.c,
+        libraries/clib/native/Arrays.c,
+        libraries/clib/native/ByteToCharIconv.c,
+        libraries/clib/native/CharToByteIconv.c,
+        libraries/clib/native/Class.c,
+        libraries/clib/native/ClassLoader.c,
+        libraries/clib/native/Compiler.c,
+        libraries/clib/native/MemoryAdvice.c,
+        libraries/clib/native/Method.c,
+        libraries/clib/native/PrimordialClassLoader.c,
+        libraries/clib/native/Runtime.c,
+        libraries/clib/native/String.c,
+        libraries/clib/native/System.c,
+        libraries/clib/native/Thread.c,
+        libraries/clib/net/InetAddressImpl.c,
+        libraries/clib/net/PlainDatagramSocketImpl.c,
+        libraries/clib/net/PlainSocketImpl.c,
+        libraries/clib/security/digest.c,
+        libraries/clib/zip/Adler32.c,
+        libraries/clib/zip/CRC32.c,
+        libraries/clib/zip/Deflater.c,
+        libraries/clib/zip/Inflater.c:
+	Fixed various warnings about unused parameters and
+	signedness of variables.
+
 2004-04-17  Dalibor Topic <robilad at kaffe.org>
 
 	* Makefile.am: (EXTRA_DIST) 
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.118 kaffe/kaffe/kaffevm/classMethod.c:1.119
--- kaffe/kaffe/kaffevm/classMethod.c:1.118	Mon Apr  5 17:43:38 2004
+++ kaffe/kaffe/kaffevm/classMethod.c	Sun Apr 18 13:57:26 2004
@@ -885,12 +885,12 @@
 static int
 inPackageSet(char **plist, Utf8Const *name)
 {
-	int name_len, lpc, retval = 0;
+	unsigned int name_len, lpc, retval = 0;
 	
 	name_len = strlen(name->data);
 	for( lpc = 0; plist[lpc] && !retval; lpc++ )
 	{
-		int len;
+		unsigned int len;
 
 		len = strlen(plist[lpc]);
 		if( (name_len > len) &&
@@ -1044,7 +1044,7 @@
 		return true;
 	}
 
-	if (! checkBufSize(fp, nr*(2*4), CLASS_CNAME(c), einfo))
+	if (! checkBufSize(fp, (u2)(nr*(2*4)), CLASS_CNAME(c), einfo))
 	    return false;
 
 	ic = gc_malloc(sizeof(innerClass) * nr, GC_ALLOC_CLASSMISC);
@@ -1816,8 +1816,9 @@
 		offset += fsize;
 	}
 
+	assert(offset > 0);
 	/* Allocate memory required */
-	mem = gc_malloc(offset, GC_ALLOC_STATICDATA);
+	mem = gc_malloc((unsigned int)offset, GC_ALLOC_STATICDATA);
 	if (mem == NULL) {
 		postOutOfMemory(einfo);
 		return (false);
@@ -2458,6 +2459,7 @@
  */
 static
 bool
+/* ARGSUSED */
 prepareInterface(Hjava_lang_Class* class, errorInfo *einfo)
 {
 	Method* meth;
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.64 kaffe/kaffe/kaffevm/classMethod.h:1.65
--- kaffe/kaffe/kaffevm/classMethod.h:1.64	Fri Mar 26 22:58:41 2004
+++ kaffe/kaffe/kaffevm/classMethod.h	Sun Apr 18 13:57:26 2004
@@ -87,7 +87,7 @@
 	struct _classEntry*	centry;
 
 	Utf8Const*		name;
-	int			packageLength;
+	unsigned int			packageLength;
 	char*			sourcefile;	/* source file name if known */
 	accessFlags		accflags;
 
Index: kaffe/kaffe/kaffevm/debug.c
diff -u kaffe/kaffe/kaffevm/debug.c:1.50 kaffe/kaffe/kaffevm/debug.c:1.51
--- kaffe/kaffe/kaffevm/debug.c:1.50	Sun Apr  4 06:11:56 2004
+++ kaffe/kaffe/kaffevm/debug.c	Sun Apr 18 13:57:26 2004
@@ -42,8 +42,8 @@
 #endif /* defined(TRANSLATOR) */
 
 static char *debugBuffer;
-static int bufferBegin = 0;
-static int bufferSz = 16 * 1024;
+static size_t bufferBegin = 0;
+static size_t bufferSz = 16 * 1024;
 static int bufferOutput = 0;
 
 #if defined(NDEBUG) || !defined(KAFFE_VMDEBUG)
@@ -314,8 +314,9 @@
 static void
 debugToBuffer(int size)
 {
+	assert(size > 0);
 	bufferSz = size;
-	debugBuffer = malloc(size);
+	debugBuffer = malloc(bufferSz);
 	bufferOutput = 1;
 	assert(debugBuffer != NULL);
 }
@@ -391,7 +392,8 @@
 
 #ifdef HAVE_VSNPRINTF
 	max = bufferSz - bufferBegin - 1;
-	n = vsnprintf(debugBuffer + bufferBegin, max, fmt, args);
+	assert(max > 0);
+	n = vsnprintf(debugBuffer + bufferBegin, (unsigned int)max, fmt, args);
 
 	/* The return value is bytes *needed* not bytes *used* */
 	if (n > max)
@@ -414,7 +416,7 @@
 		while (max < n) {
 			int w =  write(2,
 				       debugBuffer + max,
-				       n - max);
+				       (size_t)(n - max));
 			if (w >= 0)
 				/* ignore errors */
 				max += w;
Index: kaffe/kaffe/kaffevm/external.c
diff -u kaffe/kaffe/kaffevm/external.c:1.56 kaffe/kaffe/kaffevm/external.c:1.57
--- kaffe/kaffe/kaffevm/external.c:1.56	Sat Apr 17 10:02:33 2004
+++ kaffe/kaffe/kaffevm/external.c	Sun Apr 18 13:57:26 2004
@@ -143,7 +143,7 @@
 	char* lpath;
 	char* nptr;
 	char* ptr;
-	int len;
+	unsigned int len;
 
 	DBG(INIT, dprintf("initNative()\n"); )
 
@@ -185,7 +185,7 @@
 			continue;
 		}
 		else {
-			strncpy(lib, ptr, nptr - ptr);
+			strncpy(lib, ptr, (size_t)(nptr - ptr));
 			lib[nptr-ptr] = '\0';
 			nptr += strlen(path_separator);
 		}
Index: kaffe/kaffe/kaffevm/file.h
diff -u kaffe/kaffe/kaffevm/file.h:1.6 kaffe/kaffe/kaffevm/file.h:1.7
--- kaffe/kaffe/kaffevm/file.h:1.6	Fri Mar 26 22:58:41 2004
+++ kaffe/kaffe/kaffevm/file.h	Sun Apr 18 13:57:26 2004
@@ -48,7 +48,7 @@
  * Check that the needed number of bytes are available.  If
  * not a ClassFormatError is posted in einfo.
  */
-static inline bool checkBufSize(classFile* cf, int need,
+static inline bool checkBufSize(classFile* cf, u4 need,
 				const char* cfname,
 				errorInfo* einfo) __UNUSED__;
 /* Read a single unsigned byte from cf */
@@ -75,13 +75,12 @@
 }
 
 static inline bool 
-checkBufSize(classFile* cf, int need, const char* cfname, errorInfo* einfo)
+checkBufSize(classFile* cf, u4 need, const char* cfname, errorInfo* einfo)
 {
 	assert(cf != NULL);
-	assert(need >= 0);
 	assert(cf->type != CP_INVALID);
 	
-	if ((cf->base + cf->size - cf->cur) < need)
+	if ((unsigned)(cf->base + cf->size - cf->cur) < need)
 	{
 		if (cfname != NULL)
 			postExceptionMessage(einfo,
Index: kaffe/kaffe/kaffevm/findInJar.c
diff -u kaffe/kaffe/kaffevm/findInJar.c:1.56 kaffe/kaffe/kaffevm/findInJar.c:1.57
--- kaffe/kaffe/kaffevm/findInJar.c:1.56	Sat Oct 11 20:45:49 2003
+++ kaffe/kaffe/kaffevm/findInJar.c	Sun Apr 18 13:57:26 2004
@@ -275,17 +275,17 @@
 			data = NULL;
 			if (sbuf.st_size > 0)
 			{
-				data = KMALLOC(sbuf.st_size);
+				data = KMALLOC((size_t)sbuf.st_size);
 				if (data == 0) {
-				postOutOfMemory(einfo);
-				goto done;
-			}
+					postOutOfMemory(einfo);
+					goto done;
+				}
 			}
 
 			i = 0;
 			while (i < sbuf.st_size) {
 				ssize_t j;
-				rc = KREAD(fp, data, sbuf.st_size - i, &j);
+				rc = KREAD(fp, data, (size_t)(sbuf.st_size - i), &j);
 				if (rc != 0) {
 					postExceptionMessage(einfo,
 						JAVA_IO(IOException),
@@ -302,7 +302,7 @@
 				}
 			}
 
-			classFileInit(hand, data, sbuf.st_size, CP_DIR);
+			classFileInit(hand, data, (unsigned)sbuf.st_size, CP_DIR);
 
 			KCLOSE(fp);
 			if (Kaffe_JavaVMArgs[0].enableVerboseClassloading) {
@@ -343,7 +343,7 @@
 {
 	char* cp;
 	char* hm;
-	int len;
+	size_t len;
 	classpathEntry* ptr;
 
 	DBG(INIT, dprintf("initClasspath()\n"); )
@@ -710,7 +710,7 @@
 
 			if (len != 0) {
 				newEntry->path = KMALLOC(len + strlen(file_separator) + strlen(pathname));
-				strncpy (newEntry->path, ptr->path, len - 1);
+				strncpy (newEntry->path, ptr->path, (size_t)(len - 1));
 				sprintf (newEntry->path + len - 1, "%s%s",
 					 file_separator, pathname);
 			}
Index: kaffe/kaffe/kaffevm/fp.c
diff -u kaffe/kaffe/kaffevm/fp.c:1.5 kaffe/kaffe/kaffevm/fp.c:1.6
--- kaffe/kaffe/kaffevm/fp.c:1.5	Sat Oct  9 22:56:20 1999
+++ kaffe/kaffe/kaffevm/fp.c	Sun Apr 18 13:57:26 2004
@@ -221,7 +221,7 @@
 	if (v1 == 0.0) {
 		return longToDouble(DNANBITS);
 	}
-	return longToDouble(DINFBITS | ((v1bits ^ v2bits) & DSIGNBIT));
+	return longToDouble((jlong)(DINFBITS | ((v1bits ^ v2bits) & DSIGNBIT)));
 }
 
 /*
@@ -244,5 +244,5 @@
 	if (v1 == 0.0) {
 		return intToFloat(FNANBITS);
 	}
-	return intToFloat(FINFBITS | ((v1bits ^ v2bits) & FSIGNBIT));
+	return intToFloat((jint)(FINFBITS | ((v1bits ^ v2bits) & FSIGNBIT)));
 }
Index: kaffe/kaffe/kaffevm/jar.c
diff -u kaffe/kaffe/kaffevm/jar.c:1.27 kaffe/kaffe/kaffevm/jar.c:1.28
--- kaffe/kaffe/kaffevm/jar.c:1.27	Fri Apr 16 15:02:37 2004
+++ kaffe/kaffe/kaffevm/jar.c	Sun Apr 18 13:57:26 2004
@@ -778,7 +778,7 @@
 				jf->error = JAR_ERROR_IMPOSSIBLY_LARGE_DIRECTORY;
 			}
 			else if( jarSeek(jf,
-					 cde.offsetOfDirectory,
+					 (off_t)cde.offsetOfDirectory,
 					 SEEK_SET) >= 0 )
 			{
 				*out_dir_size = cde.sizeOfDirectory;
@@ -898,9 +898,9 @@
 					     GC_ALLOC_JAR)) )
 		{
 			if( inflate_oneshot(buf,
-					    je->compressedSize,
+					    (int)je->compressedSize,
 					    retval,
-					    je->uncompressedSize) == 0 )
+					    (int)je->uncompressedSize) == 0 )
 			{
 				addToCounter(&jarmem, "vmmem-jar files",
 					     1, GCSIZEOF(retval));
@@ -941,7 +941,7 @@
 	lockMutex(jf);
 	/* Move to the local header in the file and read it. */
 	if( !jf->error &&
-	    (jarSeek(jf, je->localHeaderOffset, SEEK_SET) >= 0) &&
+	    (jarSeek(jf, (off_t)je->localHeaderOffset, SEEK_SET) >= 0) &&
 	    readJarHeader(jf, LOCAL_HEADER_SIGNATURE, &lh,
 			  FILE_SIZEOF_LOCALHEADER) )
 	{
Index: kaffe/kaffe/kaffevm/jni.c
diff -u kaffe/kaffe/kaffevm/jni.c:1.110 kaffe/kaffe/kaffevm/jni.c:1.111
--- kaffe/kaffe/kaffevm/jni.c:1.110	Fri Apr 16 17:16:24 2004
+++ kaffe/kaffe/kaffevm/jni.c	Sun Apr 18 13:57:26 2004
@@ -265,6 +265,7 @@
 }
 
 static void
+/* ARGSUSED */
 Kaffe_DeleteLocalRef(JNIEnv* env UNUSED, jref obj)
 {
 	REMOVE_REF(obj);
@@ -2706,7 +2707,7 @@
 {
 	Hjava_lang_String* str;
 	Utf8Const* utf8;
-	int len;
+	unsigned int len;
 
 	BEGIN_EXCEPTION_HANDLING(0);
 
Index: kaffe/kaffe/kaffevm/object.c
diff -u kaffe/kaffe/kaffevm/object.c:1.23 kaffe/kaffe/kaffevm/object.c:1.24
--- kaffe/kaffe/kaffevm/object.c:1.23	Mon Mar  8 21:21:09 2004
+++ kaffe/kaffe/kaffevm/object.c	Sun Apr 18 13:57:27 2004
@@ -45,7 +45,7 @@
 				     CLASS_CNAME(class));
 		return (0);
 	}
-	obj = gc_malloc(CLASS_FSIZE(class), class->alloc_type);
+	obj = gc_malloc((size_t)(CLASS_FSIZE(class)), class->alloc_type);
 
 	if (!obj) {
 		postOutOfMemory(info);
@@ -127,7 +127,7 @@
  * Allocate a new array, of whatever types.
  */
 Hjava_lang_Object*
-newArrayChecked(Hjava_lang_Class* elclass, int count, errorInfo *info)
+newArrayChecked(Hjava_lang_Class* elclass, size_t count, errorInfo *info)
 {
 	Hjava_lang_Class* class = 0;
 	Hjava_lang_Object* obj = 0;
@@ -180,7 +180,7 @@
  * Allocate a new array, of whatever types.
  */
 Hjava_lang_Object*
-newArray(Hjava_lang_Class* elclass, int count)
+newArray(Hjava_lang_Class* elclass, size_t count)
 {
 	Hjava_lang_Object* obj;
 	errorInfo info;
@@ -202,9 +202,9 @@
 	Hjava_lang_Object** array;
 	int i;
 
-	obj = newArrayChecked(CLASS_ELEMENT_TYPE(clazz), dims[0], einfo);
+	obj = newArrayChecked(CLASS_ELEMENT_TYPE(clazz), (unsigned)dims[0], einfo);
 	if (!obj) {
-	    return NULL;
+		return NULL;
 	}
 
 	if (dims[1] >= 0) {
@@ -212,7 +212,7 @@
 		for (i = 0; i < dims[0]; i++) {
 			array[i] = newMultiArrayChecked(CLASS_ELEMENT_TYPE(clazz), &dims[1], einfo);
 			if (!array[i]) {
-			    return NULL;
+				return NULL;
 			}
 		}
 	}
Index: kaffe/kaffe/kaffevm/object.h
diff -u kaffe/kaffe/kaffevm/object.h:1.5 kaffe/kaffe/kaffevm/object.h:1.6
--- kaffe/kaffe/kaffevm/object.h:1.5	Mon Mar  8 21:21:09 2004
+++ kaffe/kaffe/kaffevm/object.h	Sun Apr 18 13:57:27 2004
@@ -40,9 +40,9 @@
 					 struct _errorInfo *);
 Hjava_lang_Object*	newObject(struct Hjava_lang_Class*);
 struct Hjava_lang_Class* newClass(void);
-Hjava_lang_Object*	newArrayChecked(struct Hjava_lang_Class*, int,
+Hjava_lang_Object*	newArrayChecked(struct Hjava_lang_Class*, size_t,
 					struct _errorInfo *);
-Hjava_lang_Object*	newArray(struct Hjava_lang_Class*, int);
+Hjava_lang_Object*	newArray(struct Hjava_lang_Class*, size_t);
 Hjava_lang_Object*	newMultiArrayChecked(struct Hjava_lang_Class*, int*,
 					     struct _errorInfo *);
 Hjava_lang_Object*	newMultiArray(struct Hjava_lang_Class*, int*);
Index: kaffe/kaffe/kaffevm/readClass.c
diff -u kaffe/kaffe/kaffevm/readClass.c:1.20 kaffe/kaffe/kaffevm/readClass.c:1.21
--- kaffe/kaffe/kaffevm/readClass.c:1.20	Mon Mar  8 21:21:09 2004
+++ kaffe/kaffe/kaffevm/readClass.c	Sun Apr 18 13:57:27 2004
@@ -122,7 +122,7 @@
 		return true;
 	}			
 
-	if (! checkBufSize(fp, interfaces_count * 2, CLASS_CNAME(this), einfo))
+	if (! checkBufSize(fp, (u2)(interfaces_count * 2), CLASS_CNAME(this), einfo))
 		return false;
 
 	interfaces = (Hjava_lang_Class**)
Index: kaffe/kaffe/kaffevm/soft.c
diff -u kaffe/kaffe/kaffevm/soft.c:1.60 kaffe/kaffe/kaffevm/soft.c:1.61
--- kaffe/kaffe/kaffevm/soft.c:1.60	Mon Apr  5 17:43:38 2004
+++ kaffe/kaffe/kaffevm/soft.c	Sun Apr 18 13:57:27 2004
@@ -83,7 +83,7 @@
 		throwException(NegativeArraySizeException);
 	}
 
-	obj = newArrayChecked(TYPE_CLASS(type), size, &info);
+	obj = newArrayChecked(TYPE_CLASS(type), (size_t)size, &info);
 	if (obj == 0) {
 		throwError(&info);
 	}
@@ -108,7 +108,7 @@
 		throwException(NegativeArraySizeException);
 	}
 
-	obj = newArrayChecked(elclass, size, &info);
+	obj = newArrayChecked(elclass, (size_t)size, &info);
 	if (obj == 0) {
 		throwError(&info);
 	}
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.34 kaffe/kaffe/kaffevm/stackTrace.c:1.35
--- kaffe/kaffe/kaffevm/stackTrace.c:1.34	Wed Apr  7 18:21:11 2004
+++ kaffe/kaffe/kaffevm/stackTrace.c	Sun Apr 18 13:57:27 2004
@@ -171,7 +171,7 @@
 	}
 
 	result = (HArrayOfObject*)newArray(javaLangStackTraceElement,
-					   frame - first_frame);
+					   (size_t)(frame - first_frame));
 
 	frame = 0;
 	for(i = 0; stack[i].meth != ENDOFSTACK; i++) {
@@ -270,7 +270,7 @@
 			}
 			KFREE(class_dot_name);
 			len = strlen(buf);
-			str = newArrayChecked(TYPE_CLASS(TYPE_Char), len, &einfo);
+			str = newArrayChecked(TYPE_CLASS(TYPE_Char), (size_t)len, &einfo);
 			if (!str) {
 				KFREE(buf);
 				if (nullOK) {
Index: kaffe/kaffe/kaffevm/string.c
diff -u kaffe/kaffe/kaffevm/string.c:1.30 kaffe/kaffe/kaffevm/string.c:1.31
--- kaffe/kaffe/kaffevm/string.c:1.30	Sat Apr  3 02:57:43 2004
+++ kaffe/kaffe/kaffevm/string.c	Sun Apr 18 13:57:27 2004
@@ -38,7 +38,7 @@
 {
 	char* str;
 
-	str = gc_malloc(STRING_SIZE(js) + 1, GC_ALLOC_FIXED);
+	str = gc_malloc((size_t)(STRING_SIZE(js) + 1), GC_ALLOC_FIXED);
 	if (str != 0) {
 		stringJava2CBuf(js, str, STRING_SIZE(js) + 1);
 	}
@@ -118,7 +118,7 @@
 
 	/* Get new array object */
 	ary = (HArrayOfChar*)newArrayChecked(TYPE_CLASS(TYPE_Char),
-					     len, &info);
+					     (size_t)len, &info);
 	if (!ary) {
 		discardErrorInfo(&info);
 		return 0;
@@ -466,7 +466,7 @@
 	}
 
 	/* Create a new String object */
-	ary = (HArrayOfChar*)newArrayChecked(charClass, len,
+	ary = (HArrayOfChar*)newArrayChecked(charClass, (size_t)len,
 					     &info);
 	if (!ary) {
 		discardErrorInfo(&info);
Index: kaffe/kaffe/kaffevm/stringParsing.c
diff -u kaffe/kaffe/kaffevm/stringParsing.c:1.6 kaffe/kaffe/kaffevm/stringParsing.c:1.7
--- kaffe/kaffe/kaffevm/stringParsing.c:1.6	Sun Feb  8 16:29:15 2004
+++ kaffe/kaffe/kaffevm/stringParsing.c	Sun Apr 18 13:57:27 2004
@@ -681,7 +681,7 @@
 			len = strlen(str_ptr);
 			new_pos = str;
 			if( ((pv.type == SPO_Noop) &&
-			     !strncmp(str, str_ptr, len)) ||
+			     !strncmp(str, str_ptr, (size_t)len)) ||
 			    ((pv.type != SPO_Noop) &&
 			     (new_pos = strstr(str, str_ptr)) &&
 			     (new_pos < str_end)) )
@@ -873,9 +873,9 @@
 {
 	char *retval;
 
-	if( (retval = spMalloc(ps->len + 1)) )
+	if( (retval = spMalloc((size_t)(ps->len + 1))) )
 	{
-		strncpy(retval, ps->data, ps->len);
+		strncpy(retval, ps->data, (size_t)ps->len);
 		retval[ps->len] = '\0';
 	}
 	return( retval );
Index: kaffe/kaffe/kaffevm/support.c
diff -u kaffe/kaffe/kaffevm/support.c:1.65 kaffe/kaffe/kaffevm/support.c:1.66
--- kaffe/kaffe/kaffevm/support.c:1.65	Fri Apr 16 17:12:07 2004
+++ kaffe/kaffe/kaffevm/support.c	Sun Apr 18 13:57:27 2004
@@ -1122,7 +1122,10 @@
 Hjava_lang_Object*
 AllocArray(int len, int type)
 {
-	return (newArray(TYPE_CLASS(type), len));
+	if (len < 0) {
+		throwException(NegativeArraySizeException);
+	}
+	return (newArray(TYPE_CLASS(type), (size_t)len));
 }
 
 /**
@@ -1145,11 +1148,11 @@
 	if (sz < 0) {
 		throwException(NegativeArraySizeException);
 	}
-        elclass = getClassFromSignature(classname, loader, &info);
+	elclass = getClassFromSignature(classname, loader, &info);
 	if (elclass == 0) {
 		throwError(&info);
 	}
-        return (newArray(elclass, sz));
+	return (newArray(elclass, sz));
 
 }
 
Index: kaffe/kaffe/kaffevm/utf8const.c
diff -u kaffe/kaffe/kaffevm/utf8const.c:1.35 kaffe/kaffe/kaffevm/utf8const.c:1.36
--- kaffe/kaffe/kaffevm/utf8const.c:1.35	Fri Apr 16 17:16:24 2004
+++ kaffe/kaffe/kaffevm/utf8const.c	Sun Apr 18 13:57:27 2004
@@ -122,8 +122,9 @@
  * Returns 0 if an malloc failed occurred.
  */
 Utf8Const *
-utf8ConstNew(const char *s, int len)
+utf8ConstNew(const char *s, int slen)
 {
+	unsigned int len;
 	Utf8Const *utf8, *temp;
 	int32 hash;
 	Utf8Const *fake;
@@ -133,8 +134,10 @@
 #endif
 
 	/* Automatic length finder */
-	if (len < 0) {
+	if (slen < 0) {
 		len = strlen(s);
+	}else{
+		len = (unsigned int) slen;
 	}
 
 #ifdef KAFFE_VMDEBUG
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.75 kaffe/kaffe/kaffevm/verify.c:1.76
--- kaffe/kaffe/kaffevm/verify.c:1.75	Fri Apr 16 15:02:38 2004
+++ kaffe/kaffe/kaffevm/verify.c	Sun Apr 18 13:57:27 2004
@@ -483,7 +483,7 @@
 branchInBoundsErrorInVerifyMethod3a(errorInfo* einfo,
 				    Method* method,
 				    int codelen,
-				    int n)
+				    uint32 n)
 {
   DBG(VERIFY3, dprintf("ERROR: branch to (%d) out of bound (%d) \n", n, codelen); );
   return verifyErrorInVerifyMethod3a(einfo, method, "branch out of method code");
@@ -498,7 +498,7 @@
 				     Method* method,
 				     uint32 pc,
 				     unsigned char* code,
-				     int n)
+				     uint32 n)
 {
   DBG(VERIFY3,
       dprintf("ERROR:  pc = %d, instruction = ", pc);
Index: kaffe/kaffe/kaffevm/mem/gc-incremental.c
diff -u kaffe/kaffe/kaffevm/mem/gc-incremental.c:1.78 kaffe/kaffe/kaffevm/mem/gc-incremental.c:1.79
--- kaffe/kaffe/kaffevm/mem/gc-incremental.c:1.78	Fri Apr 16 15:02:38 2004
+++ kaffe/kaffe/kaffevm/mem/gc-incremental.c	Sun Apr 18 13:57:27 2004
@@ -121,7 +121,7 @@
 
 #undef  OBJECTSIZE
 
-  { -1, -1, -1 }
+  { -1, -1, 0 }
 
 };
 
@@ -1224,7 +1224,7 @@
 
 	/* Allocate new memory, copy data, and free the old */
 	newmem = gcMalloc(gcif, size, fidx);
-	memcpy(newmem, mem, osize);
+	memcpy(newmem, mem, (size_t)osize);
 	gcFree(gcif, mem);
 
 	return (newmem);
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.13 kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.14
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.13	Mon Apr 12 11:40:03 2004
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c	Sun Apr 18 13:57:27 2004
@@ -68,7 +68,7 @@
 	int rc = 0;
 
 	jthread_spinon(0);
-	if (bind(fd, addr, namelen) == -1) {
+	if (bind(fd, addr, (size_t)namelen) == -1) {
 		rc = errno;
 	}
 	jthread_spinoff(0);
@@ -153,7 +153,7 @@
 	int rc = 0;
 
 	jthread_spinon(0);
-	if (mkdir(path, mode) == -1) {
+	if (mkdir(path, (unsigned)mode) == -1) {
 		rc = errno;
 	}
 	jthread_spinoff(0);
@@ -201,7 +201,7 @@
 
 static int     
 jthreadedSendto(int a, const void* b, size_t c, int d, const struct sockaddr* e,
-		int f, ssize_t *out)
+		size_t f, ssize_t *out)
 {
 	int rc = 0;
 
@@ -220,7 +220,7 @@
 	int rc = 0;
 
 	jthread_spinon(0);
-	if (setsockopt(a, b, c, d, e) == -1) {
+	if (setsockopt(a, b, c, d, (unsigned)e) == -1) {
 		rc = errno;
 	}
 	jthread_spinoff(0);
@@ -299,7 +299,7 @@
 
 	jthread_spinon(0);
 	/* NB: same comment as for jthreadedGetHostByName applies here */
-	*out = gethostbyaddr(host, l, t);
+	*out = gethostbyaddr(host, (unsigned)l, t);
 	if (*out == 0) {
 		rc = h_errno;
 		if (rc == 0) {
Index: kaffe/libraries/clib/io/AudioPlayer.c
diff -u kaffe/libraries/clib/io/AudioPlayer.c:1.13 kaffe/libraries/clib/io/AudioPlayer.c:1.14
--- kaffe/libraries/clib/io/AudioPlayer.c:1.13	Thu Oct 30 14:53:58 2003
+++ kaffe/libraries/clib/io/AudioPlayer.c	Sun Apr 18 13:57:28 2004
@@ -22,7 +22,7 @@
 kaffe_applet_AudioPlayer_playFile(struct Hjava_lang_String* jstr)
 {
 	char    fName[MAXPATHLEN];
-	int     bLen = 1024;
+	size_t  bLen = 1024;
 	int     fin, dev, rc;
 	ssize_t	bRead;
 	void	*buf;
@@ -48,7 +48,7 @@
 
 	while ( (KREAD( fin, buf, bLen, &bRead ) == 0) && (bRead > 0)) {
 		ssize_t bWritten;
-		KWRITE( dev, buf, bRead, &bWritten );	/* XXX check error */
+		KWRITE( dev, buf, (size_t)bRead, &bWritten );	/* XXX check error */
 	}
 
 	KCLOSE( dev);
Index: kaffe/libraries/clib/io/File.c
diff -u kaffe/libraries/clib/io/File.c:1.21 kaffe/libraries/clib/io/File.c:1.22
--- kaffe/libraries/clib/io/File.c:1.21	Sun Aug 31 17:16:49 2003
+++ kaffe/libraries/clib/io/File.c	Sun Apr 18 13:57:28 2004
@@ -32,7 +32,7 @@
 /*
  * Is named item a file?
  */
-jboolean java_io_File_isFileInternal(struct Hjava_io_File* this, 
+jboolean java_io_File_isFileInternal(struct Hjava_io_File* this UNUSED, 
 				     struct Hjava_lang_String* fileName)
 {
   struct stat buf;
@@ -53,7 +53,7 @@
 /*
  * Is named item a directory?
  */
-jboolean java_io_File_isDirectoryInternal(struct Hjava_io_File* this,
+jboolean java_io_File_isDirectoryInternal(struct Hjava_io_File* this UNUSED,
 					  struct Hjava_lang_String* fileName)
 {
   struct stat buf;
@@ -74,7 +74,7 @@
 /*
  * Does named file exist?
  */
-jboolean java_io_File_existsInternal(struct Hjava_io_File* this,
+jboolean java_io_File_existsInternal(struct Hjava_io_File* this UNUSED,
 				     struct Hjava_lang_String* fileName)
 {
   struct stat buf;
@@ -89,7 +89,7 @@
 /*
  * Last modified time on file.
  */
-jlong java_io_File_lastModifiedInternal(struct Hjava_io_File* this,
+jlong java_io_File_lastModifiedInternal(struct Hjava_io_File* this UNUSED,
 					struct Hjava_lang_String* fileName)
 {
   struct stat buf;
@@ -109,7 +109,7 @@
  * Can I write to this file?
  */
 jboolean
-java_io_File_canWriteInternal(struct Hjava_io_File* this,
+java_io_File_canWriteInternal(struct Hjava_io_File* this UNUSED,
 			      struct Hjava_lang_String* fileName)
 {
 	char str[MAXPATHLEN];
@@ -124,7 +124,7 @@
 /*
  * Can I read from this file.
  */
-jboolean java_io_File_canReadInternal(struct Hjava_io_File* this,
+jboolean java_io_File_canReadInternal(struct Hjava_io_File* this UNUSED,
 				      struct Hjava_lang_String* fileName)
 {
   char str[MAXPATHLEN];
@@ -139,7 +139,7 @@
 /*
  * Return length of file.
  */
-jlong java_io_File_lengthInternal(struct Hjava_io_File* this,
+jlong java_io_File_lengthInternal(struct Hjava_io_File* this UNUSED,
 				  struct Hjava_lang_String* fileName)
 {
   struct stat buf;
@@ -158,7 +158,7 @@
 /*
  * Create a directory.
  */
-jboolean java_io_File_mkdirInternal(struct Hjava_io_File* this,
+jboolean java_io_File_mkdirInternal(struct Hjava_io_File* this UNUSED,
 				    struct Hjava_lang_String* fileName)
 {
   char str[MAXPATHLEN];
@@ -172,7 +172,7 @@
 /*
  * Rename a file.
  */
-jboolean java_io_File_renameToInternal(struct Hjava_io_File* this,
+jboolean java_io_File_renameToInternal(struct Hjava_io_File* this UNUSED,
 				       struct Hjava_lang_String* fromName,
 				       struct Hjava_lang_String* toName)
 {
@@ -208,7 +208,7 @@
 /*
  * Get a directory listing.
  */
-HArrayOfObject* java_io_File_listInternal(struct Hjava_io_File* this,
+HArrayOfObject* java_io_File_listInternal(struct Hjava_io_File* this UNUSED,
 					  struct Hjava_lang_String* dirName)
 {
 #if defined(HAVE_DIRENT_H)
@@ -313,7 +313,7 @@
   return 1;
 }
 
-jboolean java_io_File_setLastModifiedInternal(struct Hjava_io_File* this,
+jboolean java_io_File_setLastModifiedInternal(struct Hjava_io_File* this UNUSED,
 					      struct Hjava_lang_String* fileName,
 					      jlong thetime)
 {
@@ -334,7 +334,7 @@
 #endif
 }
 
-jboolean java_io_File_setReadOnlyInternal(struct Hjava_io_File* this, 
+jboolean java_io_File_setReadOnlyInternal(struct Hjava_io_File* this UNUSED, 
 					  struct Hjava_lang_String* fileName)
 {
   struct stat buf;
Index: kaffe/libraries/clib/management/Debug.c
diff -u kaffe/libraries/clib/management/Debug.c:1.3 kaffe/libraries/clib/management/Debug.c:1.4
--- kaffe/libraries/clib/management/Debug.c:1.3	Fri Feb 11 11:13:53 2000
+++ kaffe/libraries/clib/management/Debug.c	Sun Apr 18 13:57:28 2004
@@ -7,7 +7,7 @@
 
 void
 Java_kaffe_management_Debug_enable
-	(JNIEnv *env, jclass thisClass, jobject list)
+	(JNIEnv *env, jclass thisClass UNUSED, jobject list)
 {
 	const char *real_list = (*env)->GetStringUTFChars(env, list, 0);
 	/* do we always have alloca? */
@@ -21,28 +21,28 @@
 
 void
 Java_kaffe_management_Debug_setVerboseGC
-	(JNIEnv *env, jclass thisClass, jint level)
+	(JNIEnv *env UNUSED, jclass thisClass UNUSED, jint level)
 {
 	Kaffe_JavaVMArgs[0].enableVerboseGC = level;
 }
 
 void
 Java_kaffe_management_Debug_setVerboseJIT
-	(JNIEnv *env, jclass thisClass, jboolean on)
+	(JNIEnv *env UNUSED, jclass thisClass UNUSED, jboolean on)
 {
 	Kaffe_JavaVMArgs[0].enableVerboseJIT = on;
 }
 
 void
 Java_kaffe_management_Debug_setTracing
-	(JNIEnv *env, jclass thisClass, jint level)
+	(JNIEnv *env UNUSED, jclass thisClass UNUSED, jint level)
 {
 	Kaffe_JavaVMArgs[0].enableVerboseCall = level;
 }
 
 void
 Java_kaffe_management_Debug_enableStats
-	(JNIEnv *env, jclass thisClass, jobject list)
+	(JNIEnv *env, jclass thisClass UNUSED, jobject list)
 {
 #ifdef KAFFE_STATS
 	static char *curStats;	/* kaffe expects this string to be
Index: kaffe/libraries/clib/management/JIT.c
diff -u kaffe/libraries/clib/management/JIT.c:1.4 kaffe/libraries/clib/management/JIT.c:1.5
--- kaffe/libraries/clib/management/JIT.c:1.4	Mon Jul 28 16:03:43 2003
+++ kaffe/libraries/clib/management/JIT.c	Sun Apr 18 13:57:28 2004
@@ -39,7 +39,7 @@
  * Translate a method given class, method name, and signature
  */
 void
-Java_kaffe_management_JIT_translateMethod(JNIEnv *env, jclass _vmclass, 
+Java_kaffe_management_JIT_translateMethod(JNIEnv *env UNUSED, jclass _vmclass UNUSED, 
 	jstring _cname, jstring _mname, 
 	jstring _signature, jobject loader)	
 	/* JNI? what's that? */
@@ -90,7 +90,7 @@
  * Flush the dcache 
  */
 void
-Java_kaffe_management_JIT_flushCache(JNIEnv *env, jclass clazz)
+Java_kaffe_management_JIT_flushCache(JNIEnv *env UNUSED, jclass clazz UNUSED)
 {
 #if defined(TRANSLATOR) 
 #if defined(FULL_CACHE_FLUSH)
Index: kaffe/libraries/clib/management/XProfiler.c
diff -u kaffe/libraries/clib/management/XProfiler.c:1.1 kaffe/libraries/clib/management/XProfiler.c:1.2
--- kaffe/libraries/clib/management/XProfiler.c:1.1	Tue May 23 17:55:37 2000
+++ kaffe/libraries/clib/management/XProfiler.c	Sun Apr 18 13:57:28 2004
@@ -20,21 +20,21 @@
 #include "../../../kaffe/kaffevm/stringSupport.h"
 #include <native.h>
 
-void Java_kaffe_management_XProfiler_on(JNIEnv *env, jclass clazz)

*** Patch too long, truncated ***




More information about the kaffe mailing list