|
From: <br...@us...> - 2009-06-18 04:28:05
|
Revision: 3919
http://openvrml.svn.sourceforge.net/openvrml/?rev=3919&view=rev
Author: braden
Date: 2009-06-18 04:26:38 +0000 (Thu, 18 Jun 2009)
Log Message:
-----------
Conditionally apply "const" when using the JNI functions SetFloatArrayRegion and SetDoubleArrayRegion.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
trunk/src/script/java.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-17 05:33:18 UTC (rev 3918)
+++ trunk/ChangeLog 2009-06-18 04:26:38 UTC (rev 3919)
@@ -1,3 +1,14 @@
+2009-06-18 Braden McDaniel <br...@en...>
+
+ Conditionally apply "const" when using the JNI functions
+ SetFloatArrayRegion and SetDoubleArrayRegion.
+
+ * configure.ac: Check to see whether JNI function signatures use
+ "const".
+ * src/script/java.cpp: Use OPENVRML_JNI_CONST to conditionally
+ apply "const" when using SetFloatArrayRegion and
+ SetDoubleArrayRegion.
+
2009-06-17 Braden McDaniel <br...@en...>
* configure.ac: Fixed error message to note missing GtkGLExt
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-06-17 05:33:18 UTC (rev 3918)
+++ trunk/configure.ac 2009-06-18 04:26:38 UTC (rev 3919)
@@ -91,6 +91,25 @@
AC_CHECK_HEADER([jni.h], [have_jni=yes])
#
+# Some jni.h implementations (well, GCJ, at least), don't apply const
+# in function signatures.
+#
+AS_IF([test X$have_jni != Xno],
+ [AC_MSG_CHECKING([if JNI function signatures use const])
+ AC_CACHE_VAL([ov_cv_jni_const],
+[AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [#include <jni.h>],
+ [void (*fn)(jfloatArray, jsize, jsize, const jfloat *) = &JNIEnv::SetFloatArrayRegion])],
+ [ov_cv_jni_const=const],
+ [ov_cv_jni_const= ])
+AC_LANG_POP])
+ AS_IF([test -n "$ov_cv_jni_const"],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
+])
+
+#
# Allow users to specify any Boost library name suffix
#
AC_ARG_VAR([BOOST_LIB_SUFFIX], [Boost library name suffix])
@@ -365,6 +384,8 @@
AS_IF([test X$enable_script_node_java != Xno],
[AS_IF([test X$have_jni != Xyes],
[AC_MSG_FAILURE([The Java Native Interface is required for Script node Java support.])])
+AC_DEFINE_UNQUOTED([OPENVRML_JNI_CONST], [$ov_cv_jni_const],
+ [const for JNI function signatures.])
AS_IF([test -z "$JAVA_HOME"],
[AC_MSG_WARN([JAVA_HOME has not been set. JAVA_HOME must be set at run time to locate libjvm.])],
[ov_save_LDFLAGS=$LDFLAGS
Modified: trunk/src/script/java.cpp
===================================================================
--- trunk/src/script/java.cpp 2009-06-17 05:33:18 UTC (rev 3918)
+++ trunk/src/script/java.cpp 2009-06-18 04:26:38 UTC (rev 3919)
@@ -4492,20 +4492,22 @@
template <> struct set_array_region_t<jfloat> {
static void (JNIEnv::* const value)(
- array_type<jfloat>::type, jsize, jsize, const jfloat *);
+ array_type<jfloat>::type, jsize, jsize,
+ OPENVRML_JNI_CONST jfloat *);
};
void (JNIEnv::* const set_array_region_t<jfloat>::value)(
- array_type<jfloat>::type, jsize, jsize, const jfloat *) =
+ array_type<jfloat>::type, jsize, jsize, OPENVRML_JNI_CONST jfloat *) =
&JNIEnv::SetFloatArrayRegion;
template <> struct set_array_region_t<jdouble> {
static void (JNIEnv::* const value)(
- array_type<jdouble>::type, jsize, jsize, const jdouble *);
+ array_type<jdouble>::type, jsize, jsize,
+ OPENVRML_JNI_CONST jdouble *);
};
void (JNIEnv::* const set_array_region_t<jdouble>::value)(
- array_type<jdouble>::type, jsize, jsize, const jdouble *) =
+ array_type<jdouble>::type, jsize, jsize, OPENVRML_JNI_CONST jdouble *) =
&JNIEnv::SetDoubleArrayRegion;
template <typename T>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|