Index: kaffe/kaffevm/classMethod.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/classMethod.c,v retrieving revision 1.118 diff -u -r1.118 classMethod.c --- kaffe/kaffevm/classMethod.c 5 Apr 2004 17:43:38 -0000 1.118 +++ kaffe/kaffevm/classMethod.c 13 Apr 2004 11:27:57 -0000 @@ -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/kaffevm/classMethod.h =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/classMethod.h,v retrieving revision 1.64 diff -u -r1.64 classMethod.h --- kaffe/kaffevm/classMethod.h 26 Mar 2004 22:58:41 -0000 1.64 +++ kaffe/kaffevm/classMethod.h 13 Apr 2004 11:27:58 -0000 @@ -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/kaffevm/debug.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/debug.c,v retrieving revision 1.50 diff -u -r1.50 debug.c --- kaffe/kaffevm/debug.c 4 Apr 2004 06:11:56 -0000 1.50 +++ kaffe/kaffevm/debug.c 13 Apr 2004 11:27:59 -0000 @@ -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/kaffevm/external.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/external.c,v retrieving revision 1.55 diff -u -r1.55 external.c --- kaffe/kaffevm/external.c 3 Apr 2004 02:57:43 -0000 1.55 +++ kaffe/kaffevm/external.c 13 Apr 2004 11:28:00 -0000 @@ -160,7 +160,7 @@ char* lpath; char* nptr; char* ptr; - int len; + unsigned int len; DBG(INIT, dprintf("initNative()\n"); ) @@ -202,7 +202,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/kaffevm/file.h =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/file.h,v retrieving revision 1.6 diff -u -r1.6 file.h --- kaffe/kaffevm/file.h 26 Mar 2004 22:58:41 -0000 1.6 +++ kaffe/kaffevm/file.h 13 Apr 2004 11:28:00 -0000 @@ -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/kaffevm/findInJar.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/findInJar.c,v retrieving revision 1.56 diff -u -r1.56 findInJar.c --- kaffe/kaffevm/findInJar.c 11 Oct 2003 20:45:49 -0000 1.56 +++ kaffe/kaffevm/findInJar.c 13 Apr 2004 11:28:01 -0000 @@ -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/kaffevm/fp.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/fp.c,v retrieving revision 1.5 diff -u -r1.5 fp.c --- kaffe/kaffevm/fp.c 9 Oct 1999 22:56:20 -0000 1.5 +++ kaffe/kaffevm/fp.c 13 Apr 2004 11:28:01 -0000 @@ -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/kaffevm/jar.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/jar.c,v retrieving revision 1.26 diff -u -r1.26 jar.c --- kaffe/kaffevm/jar.c 2 Apr 2004 20:14:42 -0000 1.26 +++ kaffe/kaffevm/jar.c 13 Apr 2004 11:28:03 -0000 @@ -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/kaffevm/jni.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/jni.c,v retrieving revision 1.109 diff -u -r1.109 jni.c --- kaffe/kaffevm/jni.c 5 Apr 2004 17:43:38 -0000 1.109 +++ kaffe/kaffevm/jni.c 13 Apr 2004 11:28:10 -0000 @@ -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/kaffevm/object.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/object.c,v retrieving revision 1.23 diff -u -r1.23 object.c --- kaffe/kaffevm/object.c 8 Mar 2004 21:21:09 -0000 1.23 +++ kaffe/kaffevm/object.c 13 Apr 2004 11:28:10 -0000 @@ -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/kaffevm/object.h =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/object.h,v retrieving revision 1.5 diff -u -r1.5 object.h --- kaffe/kaffevm/object.h 8 Mar 2004 21:21:09 -0000 1.5 +++ kaffe/kaffevm/object.h 13 Apr 2004 11:28:10 -0000 @@ -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/kaffevm/readClass.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/readClass.c,v retrieving revision 1.20 diff -u -r1.20 readClass.c --- kaffe/kaffevm/readClass.c 8 Mar 2004 21:21:09 -0000 1.20 +++ kaffe/kaffevm/readClass.c 13 Apr 2004 11:28:10 -0000 @@ -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/kaffevm/soft.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/soft.c,v retrieving revision 1.60 diff -u -r1.60 soft.c --- kaffe/kaffevm/soft.c 5 Apr 2004 17:43:38 -0000 1.60 +++ kaffe/kaffevm/soft.c 13 Apr 2004 11:28:11 -0000 @@ -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/kaffevm/stackTrace.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/stackTrace.c,v retrieving revision 1.34 diff -u -r1.34 stackTrace.c --- kaffe/kaffevm/stackTrace.c 7 Apr 2004 18:21:11 -0000 1.34 +++ kaffe/kaffevm/stackTrace.c 13 Apr 2004 11:28:12 -0000 @@ -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/kaffevm/string.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/string.c,v retrieving revision 1.30 diff -u -r1.30 string.c --- kaffe/kaffevm/string.c 3 Apr 2004 02:57:43 -0000 1.30 +++ kaffe/kaffevm/string.c 13 Apr 2004 11:28:13 -0000 @@ -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/kaffevm/stringParsing.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/stringParsing.c,v retrieving revision 1.6 diff -u -r1.6 stringParsing.c --- kaffe/kaffevm/stringParsing.c 8 Feb 2004 16:29:15 -0000 1.6 +++ kaffe/kaffevm/stringParsing.c 13 Apr 2004 11:28:14 -0000 @@ -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/kaffevm/support.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/support.c,v retrieving revision 1.64 diff -u -r1.64 support.c --- kaffe/kaffevm/support.c 5 Apr 2004 17:43:38 -0000 1.64 +++ kaffe/kaffevm/support.c 13 Apr 2004 11:28:16 -0000 @@ -1069,7 +1069,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)); } /** @@ -1092,11 +1095,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/kaffevm/utf8const.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/utf8const.c,v retrieving revision 1.34 diff -u -r1.34 utf8const.c --- kaffe/kaffevm/utf8const.c 2 Apr 2004 20:14:42 -0000 1.34 +++ kaffe/kaffevm/utf8const.c 13 Apr 2004 11:28:16 -0000 @@ -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/kaffevm/verify.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/verify.c,v retrieving revision 1.74 diff -u -r1.74 verify.c --- kaffe/kaffevm/verify.c 11 Apr 2004 11:23:26 -0000 1.74 +++ kaffe/kaffevm/verify.c 13 Apr 2004 11:28:24 -0000 @@ -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/kaffevm/mem/gc-incremental.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/mem/gc-incremental.c,v retrieving revision 1.77 diff -u -r1.77 gc-incremental.c --- kaffe/kaffevm/mem/gc-incremental.c 3 Apr 2004 00:06:13 -0000 1.77 +++ kaffe/kaffevm/mem/gc-incremental.c 13 Apr 2004 11:28:26 -0000 @@ -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/kaffevm/systems/unix-jthreads/syscalls.c =================================================================== RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c,v retrieving revision 1.13 diff -u -r1.13 syscalls.c --- kaffe/kaffevm/systems/unix-jthreads/syscalls.c 12 Apr 2004 11:40:03 -0000 1.13 +++ kaffe/kaffevm/systems/unix-jthreads/syscalls.c 13 Apr 2004 11:28:27 -0000 @@ -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: libraries/clib/io/AudioPlayer.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/io/AudioPlayer.c,v retrieving revision 1.13 diff -u -r1.13 AudioPlayer.c --- libraries/clib/io/AudioPlayer.c 30 Oct 2003 14:53:58 -0000 1.13 +++ libraries/clib/io/AudioPlayer.c 13 Apr 2004 11:28:27 -0000 @@ -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: libraries/clib/native/Array.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Array.c,v retrieving revision 1.18 diff -u -r1.18 Array.c --- libraries/clib/native/Array.c 6 May 2002 02:27:33 -0000 1.18 +++ libraries/clib/native/Array.c 13 Apr 2004 11:28:27 -0000 @@ -44,7 +44,7 @@ if (size < 0) { SignalError("java.lang.NegativeArraySizeException", ""); } else { - return (newArray(clazz, size)); + return (newArray(clazz, (size_t)size)); } } Index: libraries/clib/native/Arrays.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Arrays.c,v retrieving revision 1.4 diff -u -r1.4 Arrays.c --- libraries/clib/native/Arrays.c 27 Mar 2004 16:07:33 -0000 1.4 +++ libraries/clib/native/Arrays.c 13 Apr 2004 11:28:27 -0000 @@ -89,49 +89,49 @@ void java_util_Arrays_sortByte(HArrayOfByte *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpByte); } void java_util_Arrays_sortChar(HArrayOfChar *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpChar); } void java_util_Arrays_sortDouble(HArrayOfDouble *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpDouble); } void java_util_Arrays_sortFloat(HArrayOfFloat *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpFloat); } void java_util_Arrays_sortInt(HArrayOfInt *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpInt); } void java_util_Arrays_sortShort(HArrayOfShort *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpShort); } void java_util_Arrays_sortLong(HArrayOfLong *a, jint fromIndex, jint toIndex) { - qsort(&unhand_array(a)->body[fromIndex], toIndex - fromIndex, + qsort(&unhand_array(a)->body[fromIndex], (size_t)(toIndex - fromIndex), sizeof(*unhand_array(a)->body), cmpLong); } @@ -166,14 +166,16 @@ void java_util_Arrays_sortObject(HArrayOfObject *a, jint fromIndex, jint toIndex, struct Hjava_util_Comparator *c) { - const int len = toIndex - fromIndex; + int slen = toIndex - fromIndex; + unsigned int len; struct objcmpinfo *ilist; errorInfo info; - int k; + unsigned int k; - if (len <= 1) { + if (slen <= 1) { return; } + len = slen; /* Prepare shadow array */ ilist = KMALLOC(len * sizeof(*ilist)); Index: libraries/clib/native/Method.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Method.c,v retrieving revision 1.36 diff -u -r1.36 Method.c --- libraries/clib/native/Method.c 8 Mar 2004 21:21:27 -0000 1.36 +++ libraries/clib/native/Method.c 13 Apr 2004 11:28:28 -0000 @@ -167,8 +167,8 @@ rettype = *METHOD_RET_TYPE(meth); for (i = len - 1; i >= 0; i--) { - arg = (*env)->GetObjectArrayElement(env, argobj, i); - argc = (*env)->GetObjectArrayElement(env, paramtypes, i); + arg = (*env)->GetObjectArrayElement(env, argobj, (unsigned int)i); + argc = (*env)->GetObjectArrayElement(env, paramtypes, (unsigned int)i); if (!CLASS_IS_PRIMITIVE((Hjava_lang_Class*)argc)) { args[i].l = arg; } Index: libraries/clib/native/String.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/native/String.c,v retrieving revision 1.14 diff -u -r1.14 String.c --- libraries/clib/native/String.c 4 Jul 2003 07:18:02 -0000 1.14 +++ libraries/clib/native/String.c 13 Apr 2004 11:28:28 -0000 @@ -66,7 +66,7 @@ */ k = n - m+1; for ( i=offset; i> 24) & 0xFF; @@ -339,7 +339,7 @@ do { rc = KRECVFROM(unhand(this)->native_fd, &(unhand_array(unhand(pkt)->buffer)->body)[offset], - to_read, 0, (struct sockaddr*)&addr, + (unsigned)to_read, 0, (struct sockaddr*)&addr, &alen, unhand(this)->timeout, &r); switch( rc ) { Index: libraries/clib/net/PlainSocketImpl.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/net/PlainSocketImpl.c,v retrieving revision 1.42 diff -u -r1.42 PlainSocketImpl.c --- libraries/clib/net/PlainSocketImpl.c 12 Apr 2004 11:40:08 -0000 1.42 +++ libraries/clib/net/PlainSocketImpl.c 13 Apr 2004 11:28:32 -0000 @@ -99,7 +99,7 @@ }; static char * -ip2str(jint addr) +ip2str(uint32 addr) { static char addrbuf[16]; @@ -667,7 +667,7 @@ total_read = 0; r = 0; do { - rc = KSOCKREAD(fd, &unhand_array(buf)->body[offset], len, unhand(this)->timeout, &r); + rc = KSOCKREAD(fd, &unhand_array(buf)->body[offset], (unsigned)len, unhand(this)->timeout, &r); if (rc == ETIMEDOUT) { struct Hjava_io_InterruptedIOException* except; @@ -708,7 +708,7 @@ if (fd >= 0) { while (len > 0) { r = KSOCKWRITE(fd, - &unhand_array(buf)->body[offset], len, &nw); + &unhand_array(buf)->body[offset], (unsigned)len, &nw); if (r) { SignalError("java.io.IOException", SYS_ERROR(r)); } Index: libraries/clib/zip/Adler32.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/zip/Adler32.c,v retrieving revision 1.5 diff -u -r1.5 Adler32.c --- libraries/clib/zip/Adler32.c 19 Jun 2000 11:46:46 -0000 1.5 +++ libraries/clib/zip/Adler32.c 13 Apr 2004 11:28:32 -0000 @@ -13,6 +13,7 @@ #include "config-mem.h" #include #include "java_util_zip_Adler32.h" +#include "../../../kaffe/kaffevm/gtypes.h" #if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H) @@ -21,7 +22,10 @@ void java_util_zip_Adler32_update(struct Hjava_util_zip_Adler32* this, HArrayOfByte* buf, jint from, jint len) { - unhand(this)->adler = adler32(unhand(this)->adler, &unhand_array(buf)->body[from], len); + // XXX What happens if out of bounds ? + if (from >= 0 && len > 0 && from + len <= obj_length(buf)) { + unhand(this)->adler = adler32((uint32)unhand(this)->adler, &unhand_array(buf)->body[from], (unsigned)len); + } } void @@ -30,7 +34,7 @@ jbyte b; b = val; - unhand(this)->adler = adler32(unhand(this)->adler, &b, sizeof(b)); + unhand(this)->adler = adler32((uint32)unhand(this)->adler, &b, sizeof(b)); } #else Index: libraries/clib/zip/CRC32.c =================================================================== RCS file: /cvs/kaffe/kaffe/libraries/clib/zip/CRC32.c,v retrieving revision 1.5 diff -u -r1.5 CRC32.c --- libraries/clib/zip/CRC32.c 6 Jan 2003 17:14:27 -0000 1.5 +++ libraries/clib/zip/CRC32.c 13 Apr 2004 11:28:32 -0000 @@ -99,7 +99,7 @@ void java_util_zip_CRC32_update(struct Hjava_util_zip_CRC32* this, HArrayOfByte* buf, jint from, jint len) { - unhand(this)->crc = crc32(unhand(this)->crc, &unhand_array(buf)->body[from], len); + unhand(this)->crc = crc32((uint32)unhand(this)->crc, &unhand_array(buf)->body[from], len); } void @@ -108,6 +108,6 @@ jbyte b; b = val; - unhand(this)->crc = crc32(unhand(this)->crc, &b, sizeof(b)); + unhand(this)->crc = crc32((uint32)unhand(this)->crc, &b, sizeof(b)); }