summaryrefslogtreecommitdiffstats
path: root/bindings/java
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2008-09-23 09:13:09 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2008-09-23 09:13:09 +0000
commit152ec6d42e639266000c9a4ea2da1cc920f7df78 (patch)
tree1766587f15ddab73b9ea2ae2f56cf854c4ed4a0e /bindings/java
parentdb5d229004d3ccab34c23c0c9b2d29e64f717865 (diff)
downloadlasso-152ec6d42e639266000c9a4ea2da1cc920f7df78.tar.gz
lasso-152ec6d42e639266000c9a4ea2da1cc920f7df78.tar.xz
lasso-152ec6d42e639266000c9a4ea2da1cc920f7df78.zip
Many fix to compile with --enable-wsf and --enable-debugging and also to
remove valgrind errors through python tests. 1. Rename lasso_wsf_profile_new_full for java bindings (cannot subclass in overrides of static methods). 2. Add const modifiers to many functon signatures in bindings/python/wrapper_top.c. 3. add initialisation of private_data->encryption_sym_key_type (to please valgrind) in instance_init of LassoProvider. 4. Add new macro to assign xmlNode, we consider xmlNode to be an immutable value, and always use xmlCopyNode for assignment. The macros is called named lasso_assign_node. 5. Fix segfault, when using xmlSec to encrypt the newly created encrypted node replace the original node inside the xmlDoc structure, and the original node is freed automatically. So you cannot borrow the encrypted if you do not remove it from xmlDoc first.
Diffstat (limited to 'bindings/java')
-rw-r--r--bindings/java/wrapper_top.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/bindings/java/wrapper_top.c b/bindings/java/wrapper_top.c
index e98f149e..5c7d6907 100644
--- a/bindings/java/wrapper_top.c
+++ b/bindings/java/wrapper_top.c
@@ -20,19 +20,19 @@ typedef int (*Converter)(JNIEnv *env, void *from, jobject *to);
typedef int *(*OutConverter)(JNIEnv *env, jobject from, gpointer *to);
/* Static declarations */
-G_GNUC_UNUSED static int gpointer_equal(gpointer p1, gpointer p2);
-G_GNUC_UNUSED static int new_object_with_gobject(JNIEnv *env, GObject *obj, char *clsName, jobject *jobj);
+G_GNUC_UNUSED static int gpointer_equal(const gpointer p1, const gpointer p2);
+G_GNUC_UNUSED static int new_object_with_gobject(JNIEnv *env, GObject *obj, const char *clsName, jobject *jobj);
G_GNUC_UNUSED static int jstring_to_local_string(JNIEnv *env, jstring jstr, const char **str);
G_GNUC_UNUSED static void release_local_string(JNIEnv *env, jstring str, const char *utf_str);
-G_GNUC_UNUSED static int get_jlong_field(JNIEnv *env, jobject obj, char *field, jlong *dest);
-G_GNUC_UNUSED static jclass get_jclass_by_name(JNIEnv *env, char *name);
+G_GNUC_UNUSED static int get_jlong_field(JNIEnv *env, jobject obj, const char *field, jlong *dest);
+G_GNUC_UNUSED static jclass get_jclass_by_name(JNIEnv *env, const char *name);
G_GNUC_UNUSED static int get_array_element(JNIEnv *env, jobjectArray arr, jsize i, jobject *dest);
G_GNUC_UNUSED static int set_array_element(JNIEnv *env, jobjectArray arr, jsize i, jobject value);
G_GNUC_UNUSED static int get_array_size(JNIEnv *env, jobjectArray arr, jsize *dest);
-G_GNUC_UNUSED static int create_object_array(JNIEnv *env, char *clsName, jsize size, jobjectArray *jarr);
+G_GNUC_UNUSED static int create_object_array(JNIEnv *env, const char *clsName, jsize size, jobjectArray *jarr);
G_GNUC_UNUSED static jobject get_shadow_object(JNIEnv *env, GObject *obj);
G_GNUC_UNUSED static void set_shadow_object(JNIEnv *env, GObject *obj, jobject shadow_object);
-G_GNUC_UNUSED static void exception(JNIEnv *env, char *message);
+G_GNUC_UNUSED static void exception(JNIEnv *env, const char *message);
G_GNUC_UNUSED static int string_to_jstring(JNIEnv *env, const char* str, jstring *jstr);
G_GNUC_UNUSED static int string_to_jstring_and_free(JNIEnv *env, char* str, jstring *jstr);
G_GNUC_UNUSED static int jstring_to_string(JNIEnv *env, jstring jstr, char **str);
@@ -45,7 +45,7 @@ G_GNUC_UNUSED static int gobject_to_jobject_and_ref(JNIEnv *env, GObject *obj, j
G_GNUC_UNUSED static int jobject_to_gobject(JNIEnv *env, jobject obj, GObject **gobj);
G_GNUC_UNUSED static int jobject_to_gobject_for_list(JNIEnv *env, jobject obj, GObject **gobj);
G_GNUC_UNUSED static void free_glist(GList **list, GFunc free_function);
-G_GNUC_UNUSED static int get_list(JNIEnv *env, char *clsName, GList *list, Converter convert, jobjectArray *jarr);
+G_GNUC_UNUSED static int get_list(JNIEnv *env, const char *clsName, const GList *list, Converter convert, jobjectArray *jarr);
G_GNUC_UNUSED static int set_list(JNIEnv *env, GList **list, jobjectArray jarr, GFunc free_function, OutConverter convert);
G_GNUC_UNUSED static int remove_from_list(JNIEnv *env,GList **list,jobject obj,GFunc free_function,GCompareFunc compare,OutConverter convert);
G_GNUC_UNUSED static int add_to_list(JNIEnv* env, GList** list, jobject obj, OutConverter convert);
@@ -81,11 +81,12 @@ G_GNUC_UNUSED static void throw_by_name(JNIEnv *env, const char *name, const cha
static int
-gpointer_equal(gpointer p1, gpointer p2) {
+gpointer_equal(const gpointer p1, const gpointer p2) {
return p1 != p2;
}
+
static int
-new_object_with_gobject(JNIEnv *env, GObject *obj, char *clsName, jobject *jobj) {
+new_object_with_gobject(JNIEnv *env, GObject *obj, const char *clsName, jobject *jobj) {
jclass cls;
jmethodID mid;
@@ -96,6 +97,7 @@ new_object_with_gobject(JNIEnv *env, GObject *obj, char *clsName, jobject *jobj)
g_return_val_if_fail((*jobj = (*env)->NewObject(env, cls, mid, PTR_TO_JLONG(obj))), 0);
return 1;
}
+
/** Convert a java string to a jstring */
static int
jstring_to_local_string(JNIEnv *env, jstring jstr, const char **str)
@@ -110,6 +112,7 @@ jstring_to_local_string(JNIEnv *env, jstring jstr, const char **str)
}
return 1;
}
+
/** Release a local string. IT'S MANDATORY TO CALL THIS !!! */
static void
release_local_string(JNIEnv *env, jstring str, const char *utf_str) {
@@ -119,8 +122,9 @@ release_local_string(JNIEnv *env, jstring str, const char *utf_str) {
(*env)->ReleaseStringUTFChars(env, str, utf_str);
}
}
+
static int
-get_jlong_field(JNIEnv *env, jobject obj, char *field, jlong *dest)
+get_jlong_field(JNIEnv *env, jobject obj, const char *field, jlong *dest)
{
jclass cls;
jfieldID fid;
@@ -136,15 +140,17 @@ get_jlong_field(JNIEnv *env, jobject obj, char *field, jlong *dest)
}
static jclass
-get_jclass_by_name(JNIEnv *env, char *name) {
+get_jclass_by_name(JNIEnv *env, const char *name) {
return (*env)->FindClass(env,name);
}
+
static int
get_array_element(JNIEnv *env, jobjectArray arr, jsize i, jobject *dest) {
*dest = (*env)->GetObjectArrayElement(env, arr, i);
g_return_val_if_fail(! (*env)->ExceptionCheck(env), 0);
return 1;
}
+
static int
set_array_element(JNIEnv *env, jobjectArray arr, jsize i, jobject value) {
(*env)->SetObjectArrayElement(env, arr, i, value);
@@ -158,7 +164,7 @@ get_array_size(JNIEnv *env, jobjectArray jarr, jsize *dest) {
return 1;
}
static int
-create_object_array(JNIEnv *env, char *clsName, jsize size, jobjectArray *jarr) {
+create_object_array(JNIEnv *env, const char *clsName, jsize size, jobjectArray *jarr) {
jclass cls;
g_error_if_fail(env && clsName && jarr);
@@ -219,7 +225,7 @@ set_shadow_object(JNIEnv *env, GObject *obj, jobject shadow_object) {
}
/** Throw a new RuntimeException containing this message. */
static void
-exception(JNIEnv *env, char *message) {
+exception(JNIEnv *env, const char *message) {
jclass cls = (*env)->FindClass(env, "java/lang/RuntimeException");
if (cls != NULL) {
throw_by_name(env, "java/lang/RuntimeException", message);
@@ -462,12 +468,12 @@ free_glist(GList **list, GFunc free_function) {
* Can throw. If list is null or empty, return NULL.
*/
static int
-get_list(JNIEnv *env, char *clsName, GList *list, Converter convert, jobjectArray *jarr) {
+get_list(JNIEnv *env, const char *clsName, const GList *list, Converter convert, jobjectArray *jarr) {
jsize l,i;
jclass cls;
g_error_if_fail (env && clsName && convert);
- l = g_list_length(list);
+ l = g_list_length((GList*)list);
if (!l) {
*jarr = NULL;
goto out;