GetStringUTFChars returns "const char *" which is much more logical and seems to be the right thing. JNI 1.1 spec says it should return "const jbyte *". I search a little bit with google and jni.h in other open source projects use "const char *" too. Now I really wonder what we should do ? Should we leave it like it is and cast to "const char *" in all instances we use GetStringUTFChars in out own code or should we just apply the attached patch to change our jni.h.
Sun's own jni.h uses "const char*"
This may be a typo in the JNI 1.1 spec as the corresponding ReleaseStringUTFChars takes a "const char*" too.
The Java Native Interface Programmer's Guide and Specification
uses jbyte* in $3.2.1 example http://java.sun.com/docs/books/jni/html/objtypes.html . The latest JNI docs from 1.4.2 also use jbyte :
http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/functions.html#wp17265
The JNI tutorial uses a const char * in its example here
http://java.sun.com/docs/books/tutorial/native1.1/implementing/string.html
Given that jbyte is signed 8 bits and a char can be signed or unsigned (and doesn't have to be 8 bits), I'm not quite sure what the implications of a change in the prototype are.
cheers, dalibor topic
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath

