[java-atk-wrapper] JNI: Use guint type not gint
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] JNI: Use guint type not gint
- Date: Sun, 8 Mar 2015 17:59:36 +0000 (UTC)
commit da3b29a808538a651a13d86df3e905b7507b988d
Author: Magdalen Berns <m berns thismagpie com>
Date: Sun Mar 8 17:58:05 2015 +0000
JNI: Use guint type not gint
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=745823
jni/src/jawimpl.c | 46 ++++++++++++++--------------------------------
1 files changed, 14 insertions(+), 32 deletions(-)
---
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index 4ba354a..f4fb3a6 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -111,6 +111,8 @@ object_table_lookup (JNIEnv *jniEnv, jobject ac)
"()I" );
gint hash_key = (gint)(*jniEnv)->CallIntMethod( jniEnv, ac, jmid );
gpointer value = NULL;
+ if (objectTable==NULL)
+ return NULL;
value = g_hash_table_lookup(objectTable, (gpointer)&hash_key);
return (JawImpl*)value;
@@ -234,10 +236,12 @@ jaw_impl_get_instance (JNIEnv *jniEnv, jobject ac)
{
JawImpl *jaw_impl;
jniEnv = jaw_util_get_jni_env();
+
+ if (jniEnv == NULL)
+ return NULL;
+
if (objectTable == NULL)
- {
objectTable = g_hash_table_new (NULL, NULL);
- }
jaw_impl = object_table_lookup(jniEnv, ac);
@@ -246,8 +250,8 @@ jaw_impl_get_instance (JNIEnv *jniEnv, jobject ac)
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, ac);
if (global_ac != NULL)
{
- gint tflag = jaw_util_get_tflag_from_jobj(jniEnv, global_ac);
- jaw_impl = g_object_new(JAW_TYPE_IMPL(tflag), NULL );
+ guint tflag = jaw_util_get_tflag_from_jobj(jniEnv, global_ac);
+ jaw_impl = (JawImpl*)g_object_new(JAW_TYPE_IMPL(tflag), NULL);
if (jaw_impl != NULL)
{
JawObject *jaw_obj = JAW_OBJECT(jaw_impl);
@@ -279,11 +283,6 @@ jaw_impl_find_instance (JNIEnv *jniEnv, jobject ac)
{
JawImpl *jaw_impl;
- if (objectTable == NULL)
- {
- objectTable = g_hash_table_new (NULL, NULL);
- }
-
jaw_impl = object_table_lookup(jniEnv, ac);
if (jaw_impl == NULL)
{
@@ -398,49 +397,31 @@ jaw_impl_get_type (guint tflag)
type = g_type_register_static(JAW_TYPE_OBJECT, className, &tinfo, 0);
if (tflag & INTERFACE_ACTION)
- {
g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info);
- }
if (tflag & INTERFACE_COMPONENT)
- {
g_type_add_interface_static (type, ATK_TYPE_COMPONENT,&atk_component_info);
- }
if (tflag & INTERFACE_TEXT)
- {
g_type_add_interface_static (type, ATK_TYPE_TEXT,&atk_text_info);
- }
if (tflag & INTERFACE_EDITABLE_TEXT)
- {
g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
- }
if (tflag & INTERFACE_HYPERTEXT)
- {
g_type_add_interface_static (type, ATK_TYPE_HYPERTEXT,&atk_hypertext_info);
- }
if (tflag & INTERFACE_IMAGE)
- {
g_type_add_interface_static (type, ATK_TYPE_IMAGE, &atk_image_info);
- }
if (tflag & INTERFACE_SELECTION)
- {
g_type_add_interface_static (type, ATK_TYPE_SELECTION, &atk_selection_info);
- }
if (tflag & INTERFACE_VALUE)
- {
g_type_add_interface_static (type, ATK_TYPE_VALUE, &atk_value_info);
- }
if (tflag & INTERFACE_TABLE)
- {
g_type_add_interface_static (type, ATK_TYPE_TABLE, &atk_table_info);
- }
g_hash_table_insert(typeTable, (gpointer)&tflag, (gpointer)type);
}
@@ -521,7 +502,7 @@ jaw_impl_get_interface_data (JawObject *jaw_obj, guint iface)
{
JawImpl *jaw_impl = (JawImpl*)jaw_obj;
- if (jaw_impl->ifaceTable == NULL)
+ if (jaw_impl->ifaceTable == NULL || jaw_impl == NULL)
return NULL;
JawInterfaceInfo *info = g_hash_table_lookup(jaw_impl->ifaceTable, (gpointer)&iface);
@@ -616,7 +597,7 @@ jaw_impl_ref_child (AtkObject *atk_obj, gint i)
AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac );
if (G_OBJECT(obj) != NULL)
- g_object_ref (G_OBJECT(obj));
+ g_object_ref(G_OBJECT(obj));
return obj;
}
@@ -740,8 +721,8 @@ jaw_impl_ref_relation_set (AtkObject *atk_obj)
for (i = 0; i < jarr_size; i++)
{
jobject jrel = (*jniEnv)->GetObjectArrayElement(jniEnv, jrel_arr, i);
- jclass classAccessibleRelation = (*jniEnv)->FindClass( jniEnv,
- "javax/accessibility/AccessibleRelation");
+ jclass classAccessibleRelation = (*jniEnv)->FindClass(jniEnv,
+ "javax/accessibility/AccessibleRelation");
jmid = (*jniEnv)->GetMethodID(jniEnv,
classAccessibleRelation,
"getKey",
@@ -779,7 +760,8 @@ jaw_impl_ref_relation_set (AtkObject *atk_obj)
}
if(atk_obj->relation_set == NULL)
return NULL;
- g_object_ref (atk_obj->relation_set);
+ if (G_OBJECT(atk_obj->relation_set) != NULL)
+ g_object_ref (atk_obj->relation_set);
return atk_obj->relation_set;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]