I'm checking this in to Classpath and also libgcj svn.
Anthony was seeing a runtime failure in GdkScreenGraphicsDevice. We
tracked it down to a bug in the JNI code -- the JNI code was creating
an 'int' array but filling it with a call to a 'short'-array function.
libgcj's JNI implementation detects this.
This code is still somewhat bogus in that it assumes that a C 'short'
is the same as a jshort. This is probably true on most platforms in
common use today, but it is the kind of thing that should probably be
at least protected by an assertion (preferably compile-time) of some
sort.
Tom
2006-08-09 Tom Tromey <[EMAIL PROTECTED]>
PR classpath/28666:
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
(Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModes):
Create a 'short' array.
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c,v
retrieving revision 1.1
diff -u -r1.1 gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c 6 Jun
2006 10:04:15 -0000 1.1
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c 9 Aug
2006 17:35:40 -0000
@@ -248,8 +248,8 @@
/* Retrieves refresh rate information. */
rates = XRRConfigRates(config, i, &nrates);
- /* Create a Java int array and put them in. */
- shortArray = (*env)->NewIntArray(env, nrates);
+ /* Create a Java short array and put them in. */
+ shortArray = (*env)->NewShortArray(env, nrates);
(*env)->SetShortArrayRegion(env, shortArray, 0, nrates, (jshort
*) rates);
/* Create a GdkScreenGraphicsDevice.X11DisplayMode instance. */