[kaffe] CVS kaffe (hkraemer): small fix for setting user properties
and objectinputstream
Kaffe CVS
cvs-commits at kaffe.org
Thu Jul 8 03:05:44 PDT 2004
PatchSet 4908
Date: 2004/07/08 10:00:07
Author: hkraemer
Branch: HEAD
Tag: (none)
Log:
small fix for setting user properties and objectinputstream
Members:
ChangeLog:1.2474->1.2475
libraries/clib/io/ObjectInputStream.c:1.3->1.4
libraries/clib/native/System.c:1.49->1.50
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2474 kaffe/ChangeLog:1.2475
--- kaffe/ChangeLog:1.2474 Thu Jul 8 09:04:54 2004
+++ kaffe/ChangeLog Thu Jul 8 10:00:07 2004
@@ -1,3 +1,16 @@
+2004-07-08 Helmer Kraemer <hkraemer at freenet.de>
+
+ * libraries/clib/native/System.c (java_lang_System_initProperties):
+ don't free prop->value, since it's in the same string as prop->key
+
+ * libraries/clib/io/ObjectInputStream.c (getFieldAddress): new function
+ (java_io_VMObjectStreamClass_setBooleanNative, java_io_VMObjectStreamClass_setByteNative,
+ java_io_VMObjectStreamClass_setCharNative, java_io_VMObjectStreamClass_setShortNative,
+ java_io_VMObjectStreamClass_setIntNative, java_io_VMObjectStreamClass_setLongNative,
+ java_io_VMObjectStreamClass_setFloatNative, java_io_VMObjectStreamClass_setDoubleNative,
+ java_io_VMObjectStreamClass_setObjectNative): don't use java_lang_reflect_Field_*
+ methods for setting the field, since they're in another libtool module
+
2004-07-08 Dalibor Topic <robilad at kaffe.org>
Yoshiharu Oba <ooba at gk.avkk.yamaha.co.jp>
Index: kaffe/libraries/clib/io/ObjectInputStream.c
diff -u kaffe/libraries/clib/io/ObjectInputStream.c:1.3 kaffe/libraries/clib/io/ObjectInputStream.c:1.4
--- kaffe/libraries/clib/io/ObjectInputStream.c:1.3 Mon Jul 5 16:40:51 2004
+++ kaffe/libraries/clib/io/ObjectInputStream.c Thu Jul 8 10:00:13 2004
@@ -83,13 +83,22 @@
return (meth != NULL);
}
+static void*
+getFieldAddress (struct Hjava_lang_reflect_Field* sfield, struct Hjava_lang_Object *obj)
+{
+ if (unhand(sfield)->slot < CLASS_NSFIELDS(OBJECT_CLASS(obj))) {
+ SignalError ("java.lang.IllegalArgumentException", "");
+ }
+
+ return (void *)((uintp)obj + FIELD_BOFFSET(CLASS_FIELDS(OBJECT_CLASS(obj)) + unhand(sfield)->slot));
+}
void java_io_VMObjectStreamClass_setBooleanNative
(struct Hjava_lang_reflect_Field* sfield,
struct Hjava_lang_Object* obj,
jboolean value)
{
- java_lang_reflect_Field_setBoolean0(sfield, obj, value);
+ *(jboolean *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setByteNative
@@ -97,7 +106,7 @@
struct Hjava_lang_Object* obj,
jbyte value)
{
- java_lang_reflect_Field_setByte0(sfield, obj, value);
+ *(jbyte *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setCharNative
@@ -105,7 +114,7 @@
struct Hjava_lang_Object* obj,
jchar value)
{
- java_lang_reflect_Field_setChar0(sfield, obj, value);
+ *(jchar *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setShortNative
@@ -113,7 +122,7 @@
struct Hjava_lang_Object* obj,
jshort value)
{
- java_lang_reflect_Field_setShort0(sfield, obj, value);
+ *(jshort *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setIntNative
@@ -121,7 +130,7 @@
struct Hjava_lang_Object* obj,
jint value)
{
- java_lang_reflect_Field_setInt0(sfield, obj, value);
+ *(jint *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setLongNative
@@ -129,7 +138,7 @@
struct Hjava_lang_Object* obj,
jlong value)
{
- java_lang_reflect_Field_setLong0(sfield, obj, value);
+ *(jlong *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setFloatNative
@@ -137,7 +146,7 @@
struct Hjava_lang_Object* obj,
jfloat value)
{
- java_lang_reflect_Field_setFloat0(sfield, obj, value);
+ *(jfloat *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setDoubleNative
@@ -145,7 +154,7 @@
struct Hjava_lang_Object* obj,
jdouble value)
{
- java_lang_reflect_Field_setDouble0(sfield, obj, value);
+ *(jdouble *)getFieldAddress (sfield, obj) = value;
}
void java_io_VMObjectStreamClass_setObjectNative
@@ -153,5 +162,5 @@
struct Hjava_lang_Object* obj,
struct Hjava_lang_Object* value)
{
- java_lang_reflect_Field_setObject0(sfield, obj, value);
+ *(struct Hjava_lang_Object **)getFieldAddress (sfield, obj) = value;
}
Index: kaffe/libraries/clib/native/System.c
diff -u kaffe/libraries/clib/native/System.c:1.49 kaffe/libraries/clib/native/System.c:1.50
--- kaffe/libraries/clib/native/System.c:1.49 Tue Jul 6 16:26:42 2004
+++ kaffe/libraries/clib/native/System.c Thu Jul 8 10:00:12 2004
@@ -373,7 +373,6 @@
userProperty *nextProperty = prop->next;
free(prop->key);
- free(prop->value);
free(prop);
prop = nextProperty;
}
More information about the kaffe
mailing list