[kaffe] CVS kaffe (doogie): Change type of various parameters and variables to jsize, to reduce gcc

Kaffe CVS cvs-commits at kaffe.org
Sat Dec 11 16:22:30 PST 2004


PatchSet 5613 
Date: 2004/12/11 20:49:36
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Change type of various parameters and variables to jsize, to reduce gcc
warnings by 47(with 3.4).

Members: 
	ChangeLog:1.3158->1.3159 
	include/Arrays.h:1.4->1.5 
	include/native.h:1.16->1.17 
	kaffe/kaffevm/object.c:1.28->1.29 
	kaffe/kaffevm/object.h:1.6->1.7 
	kaffe/kaffevm/soft.c:1.68->1.69 
	kaffe/kaffevm/stackTrace.c:1.40->1.41 
	kaffe/kaffevm/string.c:1.36->1.37 
	kaffe/kaffevm/support.c:1.77->1.78 
	kaffe/kaffevm/jni/jni-arrays.c:1.3->1.4 
	libraries/clib/native/Array.c:1.20->1.21 
	libraries/clib/native/ZipFile.c:1.22->1.23 
	libraries/clib/net/InetAddressImpl.c:1.25->1.26 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3158 kaffe/ChangeLog:1.3159
--- kaffe/ChangeLog:1.3158	Sat Dec 11 07:07:21 2004
+++ kaffe/ChangeLog	Sat Dec 11 20:49:36 2004
@@ -1,5 +1,16 @@
 2004-12-11  Adam Heath  <doogie at brainfood.com>
 
+	* include/Arrays.h, include/native.h, kaffe/kaffevm/object.c,
+	  kaffe/kaffevm/object.h, kaffe/kaffevm/soft.c,
+	  kaffe/kaffevm/stackTrace.c, kaffe/kaffevm/string.c,
+	  kaffe/kaffevm/support.c, kaffe/kaffevm/jni/jni-arrays.c,
+	  libraries/clib/native/Array.c, libraries/clib/native/ZipFile.c,
+	  libraries/clib/net/InetAddressImpl.c:
+	  Change type of various parameters and variables to jsize, to
+	  reduce gcc warnings by 47(with 3.4).
+
+2004-12-11  Adam Heath  <doogie at brainfood.com>
+
 	* kaffe/kaffevm/jit3/icode.c:
 	  Some -Wtraditional fixes.
 
Index: kaffe/include/Arrays.h
diff -u kaffe/include/Arrays.h:1.4 kaffe/include/Arrays.h:1.5
--- kaffe/include/Arrays.h:1.4	Thu May 15 15:03:05 2003
+++ kaffe/include/Arrays.h	Sat Dec 11 20:49:39 2004
@@ -15,16 +15,16 @@
 /*
  * Define various array types
  */
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jbyte body[1]; } data[1]; } HArrayOfBoolean;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jbyte body[1]; } data[1]; } HArrayOfByte;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jchar body[1]; } data[1]; } HArrayOfChar;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jdouble body[1]; } data[1]; } HArrayOfDouble;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jfloat body[1]; } data[1]; } HArrayOfFloat;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jint body[1]; } data[1]; } HArrayOfInt;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jshort body[1]; } data[1]; } HArrayOfShort;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; jlong body[1]; } data[1]; } HArrayOfLong;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; Hjava_lang_Object* body[1]; } data[1]; } HArrayOfArray;
-typedef struct { Hjava_lang_Object base; unsigned int length; union { double align; Hjava_lang_Object* body[1]; } data[1]; } HArrayOfObject;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jbyte body[1]; } data[1]; } HArrayOfBoolean;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jbyte body[1]; } data[1]; } HArrayOfByte;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jchar body[1]; } data[1]; } HArrayOfChar;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jdouble body[1]; } data[1]; } HArrayOfDouble;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jfloat body[1]; } data[1]; } HArrayOfFloat;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jint body[1]; } data[1]; } HArrayOfInt;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jshort body[1]; } data[1]; } HArrayOfShort;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; jlong body[1]; } data[1]; } HArrayOfLong;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; Hjava_lang_Object* body[1]; } data[1]; } HArrayOfArray;
+typedef struct { Hjava_lang_Object base; jsize length; union { double align; Hjava_lang_Object* body[1]; } data[1]; } HArrayOfObject;
 
 /* Get length of arrays */
 #define	obj_length(_obj)	((_obj)->length)
Index: kaffe/include/native.h
diff -u kaffe/include/native.h:1.16 kaffe/include/native.h:1.17
--- kaffe/include/native.h:1.16	Tue Oct 12 17:00:10 2004
+++ kaffe/include/native.h	Sat Dec 11 20:49:39 2004
@@ -63,7 +63,7 @@
 extern int	utf8ConstEqualJavaString(const Utf8Const*, const HString*);
 
 extern HObject*	AllocObject(const char*, struct Hjava_lang_ClassLoader*);
-extern HObject*	AllocArray(size_t len, int type);
+extern HObject*	AllocArray(jsize len, int type);
 extern HObject*	AllocObjectArray(int, const char*, struct Hjava_lang_ClassLoader*);
 
 /*
Index: kaffe/kaffe/kaffevm/object.c
diff -u kaffe/kaffe/kaffevm/object.c:1.28 kaffe/kaffe/kaffevm/object.c:1.29
--- kaffe/kaffe/kaffevm/object.c:1.28	Wed Dec  8 21:16:50 2004
+++ kaffe/kaffe/kaffevm/object.c	Sat Dec 11 20:49:39 2004
@@ -127,7 +127,7 @@
  * Allocate a new array, of whatever types.
  */
 Hjava_lang_Object*
-newArrayChecked(Hjava_lang_Class* elclass, size_t count, errorInfo *info)
+newArrayChecked(Hjava_lang_Class* elclass, jsize 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, size_t count)
+newArray(Hjava_lang_Class* elclass, jsize count)
 {
 	Hjava_lang_Object* obj;
 	errorInfo info;
@@ -217,7 +217,7 @@
       return NULL;
     }
   
-  obj = newArrayChecked(CLASS_ELEMENT_TYPE(clazz), (unsigned)dims[0], einfo);
+  obj = newArrayChecked(CLASS_ELEMENT_TYPE(clazz), (jsize)dims[0], einfo);
   if (!obj)
     return NULL;
   
@@ -237,7 +237,7 @@
 	  for (k=0;k<localdim;k++)
 	  {
 	    stack[localptr+k] = array[k] = 
-	      newArrayChecked(CLASS_ELEMENT_TYPE(prevclazz), (unsigned)dims[j+1], einfo);
+	      newArrayChecked(CLASS_ELEMENT_TYPE(prevclazz), (jsize)dims[j+1], einfo);
 	    if (array[k] == NULL)
 	      return NULL;
 	  }
Index: kaffe/kaffe/kaffevm/object.h
diff -u kaffe/kaffe/kaffevm/object.h:1.6 kaffe/kaffe/kaffevm/object.h:1.7
--- kaffe/kaffe/kaffevm/object.h:1.6	Sun Apr 18 13:57:27 2004
+++ kaffe/kaffe/kaffevm/object.h	Sat Dec 11 20:49:39 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*, size_t,
+Hjava_lang_Object*	newArrayChecked(struct Hjava_lang_Class*, jsize,
 					struct _errorInfo *);
-Hjava_lang_Object*	newArray(struct Hjava_lang_Class*, size_t);
+Hjava_lang_Object*	newArray(struct Hjava_lang_Class*, jsize);
 Hjava_lang_Object*	newMultiArrayChecked(struct Hjava_lang_Class*, int*,
 					     struct _errorInfo *);
 Hjava_lang_Object*	newMultiArray(struct Hjava_lang_Class*, int*);
Index: kaffe/kaffe/kaffevm/soft.c
diff -u kaffe/kaffe/kaffevm/soft.c:1.68 kaffe/kaffe/kaffevm/soft.c:1.69
--- kaffe/kaffe/kaffevm/soft.c:1.68	Sun Nov 14 13:52:06 2004
+++ kaffe/kaffe/kaffevm/soft.c	Sat Dec 11 20:49:39 2004
@@ -83,7 +83,7 @@
 		throwException(NegativeArraySizeException);
 	}
 
-	obj = newArrayChecked(TYPE_CLASS(type), (size_t)size, &info);
+	obj = newArrayChecked(TYPE_CLASS(type), (jsize)size, &info);
 	if (obj == 0) {
 		throwError(&info);
 	}
@@ -108,7 +108,7 @@
 		throwException(NegativeArraySizeException);
 	}
 
-	obj = newArrayChecked(elclass, (size_t)size, &info);
+	obj = newArrayChecked(elclass, (jsize)size, &info);
 	if (obj == 0) {
 		throwError(&info);
 	}
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.40 kaffe/kaffe/kaffevm/stackTrace.c:1.41
--- kaffe/kaffe/kaffevm/stackTrace.c:1.40	Fri Dec 10 00:37:21 2004
+++ kaffe/kaffe/kaffevm/stackTrace.c	Sat Dec 11 20:49:39 2004
@@ -170,7 +170,7 @@
 	}
 
 	result = (HArrayOfObject*)newArray(javaLangStackTraceElement,
-					   (size_t)(frame - first_frame));
+					   (jsize)(frame - first_frame));
 
 	frame = 0;
 	for(i = 0; stack[i].meth != ENDOFSTACK; i++) {
@@ -269,7 +269,7 @@
 			}
 			KFREE(class_dot_name);
 			len = strlen(buf);
-			str = newArrayChecked(TYPE_CLASS(TYPE_Char), (size_t)len, &einfo);
+			str = newArrayChecked(TYPE_CLASS(TYPE_Char), (jsize)len, &einfo);
 			if (!str) {
 				KFREE(buf);
 				if (nullOK) {
Index: kaffe/kaffe/kaffevm/string.c
diff -u kaffe/kaffe/kaffevm/string.c:1.36 kaffe/kaffe/kaffevm/string.c:1.37
--- kaffe/kaffe/kaffevm/string.c:1.36	Sun Sep  5 12:24:48 2004
+++ kaffe/kaffe/kaffevm/string.c	Sat Dec 11 20:49:40 2004
@@ -118,7 +118,7 @@
 
 	/* Get new array object */
 	ary = (HArrayOfChar*)newArrayChecked(TYPE_CLASS(TYPE_Char),
-					     (size_t)len, &info);
+					     (jsize)len, &info);
 	if (!ary) {
 		discardErrorInfo(&info);
 		return 0;
@@ -471,7 +471,7 @@
 	}
 
 	/* Create a new String object */
-	ary = (HArrayOfChar*)newArrayChecked(charClass, (size_t)len,
+	ary = (HArrayOfChar*)newArrayChecked(charClass, (jsize)len,
 					     &info);
 	if (!ary) {
 		discardErrorInfo(&info);
Index: kaffe/kaffe/kaffevm/support.c
diff -u kaffe/kaffe/kaffevm/support.c:1.77 kaffe/kaffe/kaffevm/support.c:1.78
--- kaffe/kaffe/kaffevm/support.c:1.77	Fri Dec 10 00:37:22 2004
+++ kaffe/kaffe/kaffevm/support.c	Sat Dec 11 20:49:40 2004
@@ -832,7 +832,7 @@
  * @return the new allocated array
  */
 Hjava_lang_Object*
-AllocArray(size_t len, int type)
+AllocArray(jsize len, int type)
 {
 	return (newArray(TYPE_CLASS(type), len));
 }
Index: kaffe/kaffe/kaffevm/jni/jni-arrays.c
diff -u kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.3 kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.4
--- kaffe/kaffe/kaffevm/jni/jni-arrays.c:1.3	Mon Jul  5 16:40:46 2004
+++ kaffe/kaffe/kaffevm/jni/jni-arrays.c	Sat Dec 11 20:49:40 2004
@@ -28,7 +28,7 @@
 
   BEGIN_EXCEPTION_HANDLING(0);
 
-  if (elem >= obj_length((HArrayOfObject*)arr)) {
+  if (elem >= (jsize)obj_length((HArrayOfObject*)arr)) {
     throwException(ArrayIndexOutOfBoundsException);
   }
   obj = unhand_array((HArrayOfObject*)arr)->body[elem];
@@ -43,7 +43,7 @@
 {
   BEGIN_EXCEPTION_HANDLING_VOID();
 
-  if (elem >= obj_length((HArrayOfObject*)arr)) {
+  if (elem >= (jsize)obj_length((HArrayOfObject*)arr)) {
     throwException(ArrayIndexOutOfBoundsException);
   }
   unhand_array((HArrayOfObject*)arr)->body[elem] = (Hjava_lang_Object*)val;
@@ -55,7 +55,7 @@
 KaffeJNI_NewObjectArray(JNIEnv* env UNUSED, jsize len, jclass cls, jobject init)
 {
   HArrayOfObject* obj;
-  unsigned int i;
+  jsize i;
 
   BEGIN_EXCEPTION_HANDLING(0);
 
Index: kaffe/libraries/clib/native/Array.c
diff -u kaffe/libraries/clib/native/Array.c:1.20 kaffe/libraries/clib/native/Array.c:1.21
--- kaffe/libraries/clib/native/Array.c:1.20	Fri May 21 15:19:23 2004
+++ kaffe/libraries/clib/native/Array.c	Sat Dec 11 20:49:40 2004
@@ -44,7 +44,7 @@
 	if (size < 0) {
 		SignalError("java.lang.NegativeArraySizeException", "");
 	} else {
-		return (newArray(clazz, (size_t) size));
+		return (newArray(clazz, (jsize) size));
 	}
 }
 
Index: kaffe/libraries/clib/native/ZipFile.c
diff -u kaffe/libraries/clib/native/ZipFile.c:1.22 kaffe/libraries/clib/native/ZipFile.c:1.23
--- kaffe/libraries/clib/native/ZipFile.c:1.22	Tue Oct 12 17:21:54 2004
+++ kaffe/libraries/clib/native/ZipFile.c	Sat Dec 11 20:49:40 2004
@@ -92,7 +92,7 @@
 			return (0);
 		}
 	}
-	array = (HArrayOfByte*)AllocArray((size_t)size, TYPE_Byte);
+	array = (HArrayOfByte*)AllocArray((jsize)size, TYPE_Byte);
 	if( buf )
 	{
 		memcpy(unhand_array(array)->body, buf, (size_t)size);
Index: kaffe/libraries/clib/net/InetAddressImpl.c
diff -u kaffe/libraries/clib/net/InetAddressImpl.c:1.25 kaffe/libraries/clib/net/InetAddressImpl.c:1.26
--- kaffe/libraries/clib/net/InetAddressImpl.c:1.25	Sat Dec 11 07:00:52 2004
+++ kaffe/libraries/clib/net/InetAddressImpl.c	Sat Dec 11 20:49:41 2004
@@ -127,7 +127,8 @@
 		struct Hjava_lang_String* jStr)
 {
 #if defined(HAVE_GETADDRINFO)
-  int i = 0, count = 0, retryCount = 5, rc;
+  int i = 0, retryCount = 5, rc;
+  jsize count = 0;
   struct addrinfo hints, *ai = 0, *curr;
   HArrayOfArray *retval = 0;
   int iLockRoot;
@@ -171,7 +172,7 @@
 	}
 		
       retval = (HArrayOfArray *)
-	newArrayChecked(ObjectClass, (size_t)count, &einfo);
+	newArrayChecked(ObjectClass, count, &einfo);
       curr = ai;
       while( curr && retval )
 	{



More information about the kaffe mailing list