Hm. Ok. 'mincore' is declared to take an 'unsigned char *' on GNU,
but a 'char *' on Darwin. pinskia suggested on IRC that casting the
argument to 'void *' would be a good enough workaround, so I'm
checking this little change in.
2005-07-30 Casey Marshall <[EMAIL PROTECTED]>
* native/jni/java-nio/java_nio_MappedByteBuffer.c
(Java_java_nio_MappedByteBufferImpl_isLoadedImpl): cast argument 3
to 'mincore' to 'void *' to avoid warnings on GNU.
On Jul 30, 2005, at 1:39 PM, Casey Marshall wrote:
This patch fixes the warnings I introduced into the java-nio JNI
library with my recent changes, and fixes the crash I was seeing on
OS X 10.4.
2005-07-30 Casey Marshall <[EMAIL PROTECTED]>
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(Java_gnu_java_nio_channels_FileChannelImpl_mapImpl):
eliminate various compiler warnings; mark 'buffer' as 'volatile;'
throw an exception if we can't get a constructor method ID.
* native/jni/java-nio/java_nio_MappedByteBufferImpl.c:
include 'stdlib.h.'
(get_raw_values): eliminate compiler warnings.
(Java_java_nio_MappedByteBufferImpl_isLoadedImpl): likewise.
* native/jni/java-nio/java_nio_VMDirectByteBuffer.c
(Java_java_nio_VMDirectByteBuffer_put__Lgnu_classpath_RawData_2I_3BII)
:
eliminate compiler warning.
<nio.patch.txt>
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: native/jni/java-nio/java_nio_MappedByteBufferImpl.c
===================================================================
RCS file:
/cvsroot/classpath/classpath/native/jni/java-nio/java_nio_MappedByteBufferImpl.c,v
retrieving revision 1.7
diff -u -b -B -r1.7 java_nio_MappedByteBufferImpl.c
--- native/jni/java-nio/java_nio_MappedByteBufferImpl.c 30 Jul 2005 20:40:30
-0000 1.7
+++ native/jni/java-nio/java_nio_MappedByteBufferImpl.c 31 Jul 2005 00:52:13
-0000
@@ -186,7 +186,18 @@
return JNI_FALSE;
count = (size_t) ((size + pagesize - 1) / pagesize);
vec = (char *) malloc (count * sizeof (unsigned char));
+
+ /*
+ * Darwin (and BSD?) define argument 3 of 'mincore' to be 'char *',
+ * while GNU libc defines it to be 'unsigned char *'. Casting the
+ * argument to 'void *' fixes this, but not with C++. So you might
+ * be SOL if you compile this with g++ (!) on GNU with -Werror.
+ */
+#ifdef __cplusplus
if (mincore (address, size, vec) != 0)
+#else
+ if (mincore (address, size, (void *) vec) != 0)
+#endif /* __cplusplus */
{
free (vec);
JCL_ThrowException (env, IO_EXCEPTION, strerror (errno));
_______________________________________________
Classpath mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath