[kaffe] warning hunt
Nektarios K. Papadopoulos
npapadop@inaccessnetworks.com
Tue Apr 13 04:43:02 2004
This is a multi-part message in MIME format.
--------------000707040209000604040708
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Dalibor Topic wrote:
>> Should I send :
>> - one diff per file ?
>> - one diff per dir ?
>> - one global diff ?
>
>
> One diff per type would be nice, otherwise, a global diff would do.
>
Well, here it goes:
fix_traditional-2.diff fixes
traditional-2 warnings in 32 files
fix_unused_param.diff
fixes unused-parameter warnings in 11 files
fix_trad2_unused_mix.diff
fixes both types of warnings in 7 files
[1] unused-parameter warnings were handled by adding the UNUSED macro to
the offending parameter, is that ok?
Some such warnings still remain because the offending parameters are
actually used in an ifdef-out section.
[2] traditional-2 warnings were handled differently in different cases.
(a) I just cast the argument appropriately, when there is a reason to
be declared of that type, but it has already been checked.
(b) As in (a) only that I added the checks.
(c) I changed the types involved to a more reasonable one
(as Dalibor suggested)
There are some situations where I am not sure whether I should check for
proper values or what exactly to do if an error occur. In general I
tried to act as the rest of the code acts in each file. But since I am
new to kaffe and hunted a lot of warning the last days, some things
might have been done *not*quite*properly*. So I wish that some of the
kaffe gurus have a quick second look at the code before committing.
I also remind you that I only check my changes against my own configuration.
cheers
nektarios
--------------000707040209000604040708
Content-Type: text/plain;
name="fix_trad2_unused_mix.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="fix_trad2_unused_mix.diff"
Index: libraries/clib/native/Class.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Class.c,v
retrieving revision 1.71
diff -u -r1.71 Class.c
--- libraries/clib/native/Class.c 3 Apr 2004 02:57:46 -0000 1.71
+++ libraries/clib/native/Class.c 13 Apr 2004 09:42:52 -0000
@@ -281,13 +281,13 @@
}
HArrayOfObject*
-java_lang_Class_getSigners(struct Hjava_lang_Class* this)
+java_lang_Class_getSigners(struct Hjava_lang_Class* this UNUSED)
{
unimp("java.lang.Class:getSigners unimplemented");
}
void
-java_lang_Class_setSigners(struct Hjava_lang_Class* this, HArrayOfObject* sigs)
+java_lang_Class_setSigners(struct Hjava_lang_Class* this UNUSED, HArrayOfObject* sigs UNUSED)
{
unimp("java.lang.Class:setSigners unimplemented");
}
@@ -714,7 +714,7 @@
int
checkParameters(Method* mth, HArrayOfObject* argtypes)
{
- int i;
+ unsigned int i;
errorInfo info;
/* The JDK doc says and experimentation shows that a null second
Index: libraries/clib/native/ClassLoader.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/ClassLoader.c,v
retrieving revision 1.37
diff -u -r1.37 ClassLoader.c
--- libraries/clib/native/ClassLoader.c 3 Nov 2003 05:29:33 -0000 1.37
+++ libraries/clib/native/ClassLoader.c 13 Apr 2004 09:42:52 -0000
@@ -43,7 +43,7 @@
{
SignalError("java.lang.ClassFormatError", "truncated class");
}
- classFileInit(&hand, &unhand_array(data)->body[offset], length, CP_BYTEARRAY);
+ classFileInit(&hand, &unhand_array(data)->body[offset], (unsigned) length, CP_BYTEARRAY);
clazz = newClass();
if (clazz == 0) {
@@ -116,7 +116,7 @@
* Resolve classes reference by this class.
*/
void
-java_lang_ClassLoader_resolveClass0(struct Hjava_lang_ClassLoader* this, struct Hjava_lang_Class* class)
+java_lang_ClassLoader_resolveClass0(struct Hjava_lang_ClassLoader* this UNUSED, struct Hjava_lang_Class* class)
{
errorInfo info;
if (processClass(class, CSTATE_COMPLETE, &info) == false) {
Index: libraries/clib/net/InetAddressImpl.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/net/InetAddressImpl.c,v
retrieving revision 1.21
diff -u -r1.21 InetAddressImpl.c
--- libraries/clib/net/InetAddressImpl.c 31 Dec 2003 15:57:24 -0000 1.21
+++ libraries/clib/net/InetAddressImpl.c 13 Apr 2004 09:42:53 -0000
@@ -123,7 +123,7 @@
*/
HArrayOfArray*
gnu_java_net_SysInetAddressImpl_getHostByName(
- struct Hgnu_java_net_SysInetAddressImpl *this,
+ struct Hgnu_java_net_SysInetAddressImpl *this UNUSED,
struct Hjava_lang_String* jStr)
{
#if defined(HAVE_GETADDRINFO)
@@ -171,7 +171,7 @@
}
retval = (HArrayOfArray *)
- newArrayChecked(ObjectClass, count, &einfo);
+ newArrayChecked(ObjectClass, (size_t)count, &einfo);
curr = ai;
while( curr && retval )
{
@@ -355,7 +355,7 @@
*/
struct Hjava_lang_String*
gnu_java_net_SysInetAddressImpl_getHostByAddr(
- struct Hgnu_java_net_SysInetAddressImpl *this,
+ struct Hgnu_java_net_SysInetAddressImpl *this UNUSED,
HArrayOfByte *addr)
{
#if defined(HAVE_GETADDRINFO)
@@ -371,7 +371,7 @@
int iLockRoot;
errorInfo einfo;
char *hostname;
- int sin_len;
+ unsigned int sin_len;
hostname = gc_malloc(NI_MAXHOST, GC_ALLOC_FIXED);
switch( addr->length )
Index: libraries/clib/security/digest.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/security/digest.c,v
retrieving revision 1.6
diff -u -r1.6 digest.c
--- libraries/clib/security/digest.c 19 Jun 2000 11:46:46 -0000 1.6
+++ libraries/clib/security/digest.c 13 Apr 2004 09:42:54 -0000
@@ -147,21 +147,21 @@
#else
void JNICALL
-Java_kaffe_security_provider_MD2_Init(JNIEnv *env, jobject this)
+Java_kaffe_security_provider_MD2_Init(JNIEnv *env, jobject this UNUSED)
{
supportDisabled(env);
}
void JNICALL
-Java_kaffe_security_provider_MD2_Update(JNIEnv *env, jobject this,
- jbyteArray buf, jint off, jint len)
+Java_kaffe_security_provider_MD2_Update(JNIEnv *env, jobject this UNUSED,
+ jbyteArray buf UNUSED, jint off UNUSED, jint len UNUSED)
{
supportDisabled(env);
}
void JNICALL
-Java_kaffe_security_provider_MD2_Final(JNIEnv *env, jobject this,
- jbyteArray buf, jint off)
+Java_kaffe_security_provider_MD2_Final(JNIEnv *env, jobject this UNUSED,
+ jbyteArray buf UNUSED, jint off UNUSED)
{
supportDisabled(env);
}
@@ -275,21 +275,21 @@
#else
void JNICALL
-Java_kaffe_security_provider_MD4_Init(JNIEnv *env, jobject this)
+Java_kaffe_security_provider_MD4_Init(JNIEnv *env, jobject this UNUSED)
{
supportDisabled(env);
}
void JNICALL
-Java_kaffe_security_provider_MD4_Update(JNIEnv *env, jobject this,
- jbyteArray buf, jint off, jint len)
+Java_kaffe_security_provider_MD4_Update(JNIEnv *env, jobject this UNUSED,
+ jbyteArray buf UNUSED, jint off UNUSED, jint len UNUSED)
{
supportDisabled(env);
}
void JNICALL
-Java_kaffe_security_provider_MD4_Final(JNIEnv *env, jobject this,
- jbyteArray buf, jint off)
+Java_kaffe_security_provider_MD4_Final(JNIEnv *env, jobject this UNUSED,
+ jbyteArray buf UNUSED, jint off UNUSED)
{
supportDisabled(env);
}
@@ -356,7 +356,7 @@
}
/* Get data byte array data */
- if (off < 0 || off + len > (*env)->GetArrayLength(env, buf)) {
+ if (off < 0 || len < 0 || off + len > (*env)->GetArrayLength(env, buf)) {
(*env)->ThrowNew(env, aiobClass, "out of range");
return;
}
@@ -366,7 +366,7 @@
}
/* Update with new data and release array data */
- MD5Update((MD5_CTX *) ctxBytes, bufBytes + off, len);
+ MD5Update((MD5_CTX *) ctxBytes, bufBytes + off, (unsigned)len);
(*env)->ReleaseByteArrayElements(env, ctxArray, ctxBytes, 0);
(*env)->ReleaseByteArrayElements(env, buf, bufBytes, JNI_ABORT);
}
@@ -455,7 +455,7 @@
}
/* Get data byte array data */
- if (off < 0 || off + len > (*env)->GetArrayLength(env, buf)) {
+ if (off < 0 || len < 0 || off + len > (*env)->GetArrayLength(env, buf)) {
(*env)->ThrowNew(env, aiobClass, "out of range");
return;
}
@@ -465,7 +465,7 @@
}
/* Update with new data and release array data */
- SHA1Update((SHA1_CTX *) ctxBytes, bufBytes + off, len);
+ SHA1Update((SHA1_CTX *) ctxBytes, bufBytes + off, (unsigned)len);
(*env)->ReleaseByteArrayElements(env, ctxArray, ctxBytes, 0);
(*env)->ReleaseByteArrayElements(env, buf, bufBytes, JNI_ABORT);
}
Index: libraries/clib/zip/Deflater.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/zip/Deflater.c,v
retrieving revision 1.13
diff -u -r1.13 Deflater.c
--- libraries/clib/zip/Deflater.c 2 Nov 2003 16:01:56 -0000 1.13
+++ libraries/clib/zip/Deflater.c 13 Apr 2004 09:42:55 -0000
@@ -28,13 +28,16 @@
java_util_zip_Deflater_setDictionary(struct Hjava_util_zip_Deflater* this, HArrayOfByte* buf, jint from, jint len)
{
int r;
- z_stream* dstream;
+ z_stream* dstream;
- dstream = GET_STREAM(this);
+ dstream = GET_STREAM(this);
- r = deflateSetDictionary (dstream, &unhand_array(buf)->body[from], len);
- if (r < 0) {
- SignalError("java.lang.Error", dstream->msg ? dstream->msg : "unknown error");
+ // XXX What happens if out of bounds ?
+ if (from >= 0 && len > 0 && from + len <= obj_length(buf)) {
+ r = deflateSetDictionary (dstream, &unhand_array(buf)->body[from], (unsigned)len);
+ if (r < 0) {
+ SignalError("java.lang.Error", dstream->msg ? dstream->msg : "unknown error");
+ }
}
}
@@ -43,9 +46,9 @@
{
int r;
int ilen;
- z_stream* dstream;
+ z_stream* dstream;
- dstream = GET_STREAM(this);
+ dstream = GET_STREAM(this);
ilen = unhand(this)->len;
@@ -117,13 +120,13 @@
}
static voidpf
-kaffe_zalloc(voidpf opaque, uInt items, uInt size) {
+kaffe_zalloc(voidpf opaque UNUSED, uInt items, uInt size) {
/* allocate through the garbage collector interface */
return KMALLOC(items*size);
}
static void
-kaffe_zfree(voidpf opaque, voidpf address) {
+kaffe_zfree(voidpf opaque UNUSED, voidpf address) {
/* dispose through the garbage collector interface */
KFREE(address);
}
@@ -132,7 +135,7 @@
java_util_zip_Deflater_init(struct Hjava_util_zip_Deflater* this, jbool val)
{
int r;
- z_stream* dstream;
+ z_stream* dstream;
dstream = KMALLOC(sizeof(*dstream));
dstream->next_in = 0;
Index: libraries/clib/zip/Inflater.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/zip/Inflater.c,v
retrieving revision 1.12
diff -u -r1.12 Inflater.c
--- libraries/clib/zip/Inflater.c 16 Aug 2002 18:04:31 -0000 1.12
+++ libraries/clib/zip/Inflater.c 13 Apr 2004 09:42:55 -0000
@@ -32,9 +32,12 @@
z_stream* dstream;
dstream = GET_STREAM(this);
- r = inflateSetDictionary (dstream, &unhand_array(buf)->body[from], len);
- if (r < 0) {
- SignalError("java.lang.Error", dstream->msg ? dstream->msg : "unknown error");
+ // XXX What happens if out of bounds ?
+ if (from >= 0 && len > 0 && from + len <= obj_length(buf)) {
+ r = inflateSetDictionary (dstream, &unhand_array(buf)->body[from], (unsigned)len);
+ if (r < 0) {
+ SignalError("java.lang.Error", dstream->msg ? dstream->msg : "unknown error");
+ }
}
}
@@ -117,13 +120,13 @@
}
static voidpf
-kaffe_zalloc(voidpf opaque, uInt items, uInt size) {
+kaffe_zalloc(voidpf opaque UNUSED, uInt items, uInt size) {
/* allocate through the garbage collector interface */
return KMALLOC(items*size);
}
static void
-kaffe_zfree(voidpf opaque, voidpf address) {
+kaffe_zfree(voidpf opaque UNUSED, voidpf address) {
/* dispose through the garbage collector interface */
KFREE(address);
}
--------------000707040209000604040708
Content-Type: text/plain;
name="fix_traditional-2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="fix_traditional-2.diff"
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<k; i++ ) {
- if ( memcmp( &a[i], p, m2) == 0 )
+ if ( memcmp( &a[i], p, (size_t)m2) == 0 )
return i;
}
}
@@ -86,7 +86,7 @@
k= n - m;
for ( i=offset; i < k; ) {
- if ( memcmp( &a[i], p, m2) == 0 )
+ if ( memcmp( &a[i], p, (size_t)m2) == 0 )
return i;
i += bs[ (unsigned char)a[i+m] ];
}
Index: libraries/clib/native/System.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/System.c,v
retrieving revision 1.42
diff -u -r1.42 System.c
--- libraries/clib/native/System.c 12 Apr 2004 11:40:07 -0000 1.42
+++ libraries/clib/native/System.c 13 Apr 2004 11:28:29 -0000
@@ -69,7 +69,7 @@
char *proxy;
char *start, *p;
char c;
- int len;
+ unsigned int len;
/* Build HTTP proxy properties from $http_proxy and $no_proxy
@@ -496,12 +496,12 @@
if (sclass == dclass) {
#if defined(HAVE_MEMMOVE)
- memmove((void*)out, (void*)in, len);
+ memmove((void*)out, (void*)in, (size_t)len);
#else
/* Do it ourself */
#if defined(HAVE_MEMCPY)
if (src != dst) {
- memcpy((void*)out, (void*)in, len);
+ memcpy((void*)out, (void*)in, (size_t)len);
} else
#endif
if (out < in) {
Index: libraries/clib/net/PlainDatagramSocketImpl.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/net/PlainDatagramSocketImpl.c,v
retrieving revision 1.42
diff -u -r1.42 PlainDatagramSocketImpl.c
--- libraries/clib/net/PlainDatagramSocketImpl.c 12 Apr 2004 11:40:08 -0000 1.42
+++ libraries/clib/net/PlainDatagramSocketImpl.c 13 Apr 2004 11:28:30 -0000
@@ -58,7 +58,7 @@
#if defined(KAFFE_VMDEBUG) && !defined(NDEBUG)
/* Generate a string for an inet addr (in host form). */
static char *
-ip2str(jint addr)
+ip2str(uint32 addr)
{
static char addrbuf[16];
unsigned int top = (addr >> 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 <native.h>
#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));
}
--------------000707040209000604040708
Content-Type: text/plain;
name="fix_unused_param.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="fix_unused_param.diff"
Index: libraries/clib/io/File.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/io/File.c,v
retrieving revision 1.21
diff -u -r1.21 File.c
--- libraries/clib/io/File.c 31 Aug 2003 17:16:49 -0000 1.21
+++ libraries/clib/io/File.c 13 Apr 2004 09:38:21 -0000
@@ -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: libraries/clib/management/Debug.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/management/Debug.c,v
retrieving revision 1.3
diff -u -r1.3 Debug.c
--- libraries/clib/management/Debug.c 11 Feb 2000 11:13:53 -0000 1.3
+++ libraries/clib/management/Debug.c 13 Apr 2004 09:38:21 -0000
@@ -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: libraries/clib/management/JIT.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/management/JIT.c,v
retrieving revision 1.4
diff -u -r1.4 JIT.c
--- libraries/clib/management/JIT.c 28 Jul 2003 16:03:43 -0000 1.4
+++ libraries/clib/management/JIT.c 13 Apr 2004 09:38:21 -0000
@@ -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: libraries/clib/management/XProfiler.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/management/XProfiler.c,v
retrieving revision 1.1
diff -u -r1.1 XProfiler.c
--- libraries/clib/management/XProfiler.c 23 May 2000 17:55:37 -0000 1.1
+++ libraries/clib/management/XProfiler.c 13 Apr 2004 09:38:21 -0000
@@ -20,21 +20,21 @@
#include "../../../kaffe/kaffevm/stringSupport.h"
#include <native.h>
-void Java_kaffe_management_XProfiler_on(JNIEnv *env, jclass clazz)
+void Java_kaffe_management_XProfiler_on(JNIEnv *env UNUSED, jclass clazz UNUSED)
{
#if defined(KAFFE_XPROFILER)
xProfilingOn();
#endif
}
-void Java_kaffe_management_XProfiler_off(JNIEnv *env, jclass clazz)
+void Java_kaffe_management_XProfiler_off(JNIEnv *env UNUSED, jclass clazz UNUSED)
{
#if defined(KAFFE_XPROFILER)
xProfilingOff();
#endif
}
-void Java_kaffe_management_XProfiler_stage(JNIEnv *env, jclass clazz,
+void Java_kaffe_management_XProfiler_stage(JNIEnv *env UNUSED, jclass clazz UNUSED,
jstring _stage_name)
{
#if defined(KAFFE_XPROFILER)
Index: libraries/clib/native/ByteToCharIconv.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/ByteToCharIconv.c,v
retrieving revision 1.9
diff -u -r1.9 ByteToCharIconv.c
--- libraries/clib/native/ByteToCharIconv.c 24 Mar 2004 19:26:32 -0000 1.9
+++ libraries/clib/native/ByteToCharIconv.c 13 Apr 2004 09:38:22 -0000
@@ -60,7 +60,7 @@
}
void
-Java_kaffe_io_ByteToCharIconv_close0 (JNIEnv* env, jobject r, jobject cd)
+Java_kaffe_io_ByteToCharIconv_close0 (JNIEnv* env UNUSED, jobject r UNUSED, jobject cd)
{
#if defined(HAVE_ICONV)
iconv_close ((iconv_t)cd);
Index: libraries/clib/native/CharToByteIconv.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/CharToByteIconv.c,v
retrieving revision 1.7
diff -u -r1.7 CharToByteIconv.c
--- libraries/clib/native/CharToByteIconv.c 24 Mar 2004 19:26:32 -0000 1.7
+++ libraries/clib/native/CharToByteIconv.c 13 Apr 2004 09:38:22 -0000
@@ -58,7 +58,7 @@
}
void
-Java_kaffe_io_CharToByteIconv_close0 (JNIEnv* env, jobject r, jobject cd)
+Java_kaffe_io_CharToByteIconv_close0 (JNIEnv* env UNUSED, jobject r UNUSED, jobject cd)
{
#if defined(HAVE_ICONV)
iconv_close ((iconv_t)cd);
Index: libraries/clib/native/Compiler.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Compiler.c,v
retrieving revision 1.5
diff -u -r1.5 Compiler.c
--- libraries/clib/native/Compiler.c 26 Mar 2004 22:58:44 -0000 1.5
+++ libraries/clib/native/Compiler.c 13 Apr 2004 09:38:22 -0000
@@ -23,19 +23,19 @@
}
jbool
-java_lang_Compiler_compileClass(struct Hjava_lang_Class* class)
+java_lang_Compiler_compileClass(struct Hjava_lang_Class* class UNUSED)
{
unimp("java.lang.Compiler:compilerClass unimplemented");
}
jbool
-java_lang_Compiler_compileClasses(struct Hjava_lang_String* str)
+java_lang_Compiler_compileClasses(struct Hjava_lang_String* str UNUSED)
{
unimp("java.lang.Compiler:compileClasses unimplemented");
}
struct Hjava_lang_Object*
-java_lang_Compiler_command(struct Hjava_lang_Object* obj)
+java_lang_Compiler_command(struct Hjava_lang_Object* obj UNUSED)
{
unimp("java.lang.Compiler:command unimplemented");
}
Index: libraries/clib/native/MemoryAdvice.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/MemoryAdvice.c,v
retrieving revision 1.2
diff -u -r1.2 MemoryAdvice.c
--- libraries/clib/native/MemoryAdvice.c 19 Jan 2000 10:59:20 -0000 1.2
+++ libraries/clib/native/MemoryAdvice.c 13 Apr 2004 09:38:22 -0000
@@ -16,7 +16,7 @@
#include "../../../kaffe/kaffevm/gc.h"
void
-Java_kaffe_lang_MemoryAdvice_register0(JNIEnv* env, jobject this)
+Java_kaffe_lang_MemoryAdvice_register0(JNIEnv* env UNUSED, jobject this UNUSED)
{
/* Not implemented in Desktop edition yet */
}
Index: libraries/clib/native/PrimordialClassLoader.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/PrimordialClassLoader.c,v
retrieving revision 1.1
diff -u -r1.1 PrimordialClassLoader.c
--- libraries/clib/native/PrimordialClassLoader.c 24 May 2003 20:09:04 -0000 1.1
+++ libraries/clib/native/PrimordialClassLoader.c 13 Apr 2004 09:38:22 -0000
@@ -32,7 +32,7 @@
* Load a system class.
*/
struct Hjava_lang_Class*
-kaffe_lang_PrimordialClassLoader_findClass0(Hkaffe_lang_PrimordialClassLoader* this, Hjava_lang_String* jStr)
+kaffe_lang_PrimordialClassLoader_findClass0(Hkaffe_lang_PrimordialClassLoader* this UNUSED, Hjava_lang_String* jStr)
{
Hjava_lang_Class *clazz = 0;
errorInfo info;
Index: libraries/clib/native/Runtime.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Runtime.c,v
retrieving revision 1.21
diff -u -r1.21 Runtime.c
--- libraries/clib/native/Runtime.c 13 Sep 2003 12:30:47 -0000 1.21
+++ libraries/clib/native/Runtime.c 13 Apr 2004 09:38:22 -0000
@@ -31,7 +31,7 @@
* Exit this VM
*/
void
-java_lang_Runtime_exit0(struct Hjava_lang_Runtime* r, jint v)
+java_lang_Runtime_exit0(struct Hjava_lang_Runtime* r UNUSED, jint v)
{
EXIT (v);
}
@@ -40,7 +40,7 @@
* Exec another program.
*/
struct Hjava_lang_Process*
-java_lang_Runtime_execInternal(struct Hjava_lang_Runtime* this,
+java_lang_Runtime_execInternal(struct Hjava_lang_Runtime* this UNUSED,
HArrayOfObject* argv, HArrayOfObject* arge, Hjava_io_File* dir)
{
return (struct Hjava_lang_Process*)execute_java_constructor(
@@ -53,7 +53,7 @@
* Free memory.
*/
jlong
-java_lang_Runtime_freeMemory(struct Hjava_lang_Runtime* this)
+java_lang_Runtime_freeMemory(struct Hjava_lang_Runtime* this UNUSED)
{
/* This is a particularly inaccurate guess - it's basically how
* much more memory we can claim from the heap, and ignores any
@@ -67,7 +67,7 @@
* Maximally available memory.
*/
jlong
-java_lang_Runtime_maxMemory(struct Hjava_lang_Runtime* this)
+java_lang_Runtime_maxMemory(struct Hjava_lang_Runtime* this UNUSED)
{
return (gc_heap_limit);
}
@@ -76,7 +76,7 @@
* Total memory.
*/
jlong
-java_lang_Runtime_totalMemory(struct Hjava_lang_Runtime* this)
+java_lang_Runtime_totalMemory(struct Hjava_lang_Runtime* this UNUSED)
{
return (gc_heap_total);
}
@@ -85,7 +85,7 @@
* Run the garbage collector.
*/
void
-java_lang_Runtime_gc(struct Hjava_lang_Runtime* this)
+java_lang_Runtime_gc(struct Hjava_lang_Runtime* this UNUSED)
{
invokeGC();
}
@@ -95,7 +95,7 @@
* Finalising is part of the garbage collection system - so just run that.
*/
void
-java_lang_Runtime_runFinalization(struct Hjava_lang_Runtime* this)
+java_lang_Runtime_runFinalization(struct Hjava_lang_Runtime* this UNUSED)
{
invokeGC();
}
@@ -104,7 +104,7 @@
* Enable/disable tracing of instructions.
*/
void
-java_lang_Runtime_traceInstructions(struct Hjava_lang_Runtime* this, jboolean on)
+java_lang_Runtime_traceInstructions(struct Hjava_lang_Runtime* this UNUSED, jboolean on)
{
if (on == true) {
SignalError("java.lang.RuntimeException", "Cannot trace instructions");
@@ -115,7 +115,7 @@
* Enable/disable tracing of method calls.
*/
void
-java_lang_Runtime_traceMethodCalls(struct Hjava_lang_Runtime* this, jboolean on)
+java_lang_Runtime_traceMethodCalls(struct Hjava_lang_Runtime* this UNUSED, jboolean on)
{
if (on == true) {
SignalError("java.lang.RuntimeException", "Cannot trace method calls");
@@ -132,7 +132,7 @@
}
jint
-Java_sun_misc_VM_getState(JNIEnv* env, jobject vm)
+Java_sun_misc_VM_getState(JNIEnv* env UNUSED, jobject vm UNUSED)
{
return (0);
}
Index: libraries/clib/native/Thread.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Thread.c,v
retrieving revision 1.15
diff -u -r1.15 Thread.c
--- libraries/clib/native/Thread.c 19 Jan 2000 10:59:20 -0000 1.15
+++ libraries/clib/native/Thread.c 13 Apr 2004 09:38:22 -0000
@@ -74,7 +74,7 @@
* Destroy a thread (it had better be myself!!)
*/
void
-java_lang_Thread_destroy0(struct Hjava_lang_Thread* this)
+java_lang_Thread_destroy0(struct Hjava_lang_Thread* this UNUSED)
{
exitThread();
}
--------------000707040209000604040708--