summaryrefslogtreecommitdiff
path: root/native/jni/classpath
diff options
context:
space:
mode:
authorTorsten Rupp <rupp@aicas.com>2003-07-16 09:39:48 +0000
committerTorsten Rupp <rupp@aicas.com>2003-07-16 09:39:48 +0000
commit2cddd4a46d2af2a641e46720d8eacbe278df8dfd (patch)
tree456a1a9099db3e7a361efaefe1f5030d78465362 /native/jni/classpath
parentfcf5f77bfca28ac1d51493117df567ced9bd4e5e (diff)
downloadclasspath-2cddd4a46d2af2a641e46720d8eacbe278df8dfd.tar.gz
Fixed some prototypes
Diffstat (limited to 'native/jni/classpath')
-rw-r--r--native/jni/classpath/jcl.c13
-rw-r--r--native/jni/classpath/jcl.h4
2 files changed, 10 insertions, 7 deletions
diff --git a/native/jni/classpath/jcl.c b/native/jni/classpath/jcl.c
index 66c756e0f..15204a715 100644
--- a/native/jni/classpath/jcl.c
+++ b/native/jni/classpath/jcl.c
@@ -35,9 +35,12 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+/* do not move; needed here because of some macro definitions */
+#include "jamaica_config.h"
+
+#include <stdlib.h>
#include <stdio.h>
#include <jcl.h>
-#include <malloc.h>
static char errstr[4098]; // this way the memory is pre-allocated, so that we do not have to worry if we are out of memory.
@@ -91,13 +94,13 @@ JNIEXPORT void JNICALL JCL_free(JNIEnv * env, void * p) {
}
}
-JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv * env, jstring s) {
- char* cstr;
+JNIEXPORT const char * JNICALL JCL_jstring_to_cstring(JNIEnv * env, jstring s) {
+ const char* cstr;
if(s == NULL) {
JCL_ThrowException(env, "java/lang/NullPointerException","Null string");
return NULL;
}
- cstr = (char*)(*env)->GetStringUTFChars(env, s, NULL);
+ cstr = (const char*)(*env)->GetStringUTFChars(env, s, NULL);
if(cstr == NULL) {
JCL_ThrowException(env, "java/lang/InternalError", "GetStringUTFChars() failed.");
return NULL;
@@ -105,7 +108,7 @@ JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv * env, jstring s) {
return cstr;
}
-JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv * env, jstring s, char * cstr) {
+JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv * env, jstring s, const char * cstr) {
(*env)->ReleaseStringUTFChars(env, s, cstr);
}
diff --git a/native/jni/classpath/jcl.h b/native/jni/classpath/jcl.h
index a7d00b47c..e337ed755 100644
--- a/native/jni/classpath/jcl.h
+++ b/native/jni/classpath/jcl.h
@@ -47,8 +47,8 @@ JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char *
JNIEXPORT void * JNICALL JCL_malloc(JNIEnv *env, size_t size);
JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size);
JNIEXPORT void JNICALL JCL_free(JNIEnv *env, void * p);
-JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv *env, jstring s);
-JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv *env, jstring s, char * cstr);
+JNIEXPORT const char * JNICALL JCL_jstring_to_cstring(JNIEnv *env, jstring s);
+JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv *env, jstring s, const char * cstr);
JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv *env, jobject o);
JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv *env, jobject o);