[gjs] Squash compiler warnings
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] Squash compiler warnings
- Date: Wed, 22 May 2013 21:12:11 +0000 (UTC)
commit 4be9a24cc55a9ebc4ce56468b09d699ca4e11eba
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun May 19 23:27:28 2013 +0200
Squash compiler warnings
Use the right JSHandle* types in getters and setters, and fix
a number of other minor issues.
https://bugzilla.gnome.org/show_bug.cgi?id=700668
gi/boxed.c | 34 +++++++++++++++++-----------------
gi/object.c | 34 +++++++++++++++++-----------------
gi/param.c | 18 +++++++++---------
gi/repo.c | 3 ++-
gi/union.c | 4 +++-
gi/union.h | 2 +-
gi/value.c | 3 +++
7 files changed, 52 insertions(+), 46 deletions(-)
---
diff --git a/gi/boxed.c b/gi/boxed.c
index 86ce443..8e94438 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -628,10 +628,10 @@ get_nested_interface_object (JSContext *context,
}
static JSBool
-boxed_field_getter (JSContext *context,
- JSObject **obj,
- jsid *id,
- jsval *value)
+boxed_field_getter (JSContext *context,
+ JSHandleObject obj,
+ JSHandleId id,
+ JSMutableHandleValue value)
{
Boxed *priv;
GIFieldInfo *field_info;
@@ -639,11 +639,11 @@ boxed_field_getter (JSContext *context,
GArgument arg;
gboolean success = FALSE;
- priv = priv_from_js(context, *obj);
+ priv = priv_from_js(context, *obj._);
if (!priv)
return JS_FALSE;
- field_info = get_field_info(context, priv, *id);
+ field_info = get_field_info(context, priv, *id._);
if (!field_info)
return JS_FALSE;
@@ -664,9 +664,9 @@ boxed_field_getter (JSContext *context,
if (g_base_info_get_type (interface_info) == GI_INFO_TYPE_STRUCT ||
g_base_info_get_type (interface_info) == GI_INFO_TYPE_BOXED) {
- success = get_nested_interface_object (context, *obj, priv,
+ success = get_nested_interface_object (context, *obj._, priv,
field_info, type_info, interface_info,
- value);
+ value._);
g_base_info_unref ((GIBaseInfo *)interface_info);
@@ -683,7 +683,7 @@ boxed_field_getter (JSContext *context,
goto out;
}
- if (!gjs_value_from_g_argument (context, value,
+ if (!gjs_value_from_g_argument (context, value._,
type_info,
&arg,
TRUE))
@@ -808,20 +808,20 @@ out:
}
static JSBool
-boxed_field_setter (JSContext *context,
- JSObject **obj,
- jsid *id,
- JSBool strict,
- jsval *value)
+boxed_field_setter (JSContext *context,
+ JSHandleObject obj,
+ JSHandleId id,
+ JSBool strict,
+ JSMutableHandleValue value)
{
Boxed *priv;
GIFieldInfo *field_info;
gboolean success = FALSE;
- priv = priv_from_js(context, *obj);
+ priv = priv_from_js(context, *obj._);
if (!priv)
return JS_FALSE;
- field_info = get_field_info(context, priv, *id);
+ field_info = get_field_info(context, priv, *id._);
if (!field_info)
return JS_FALSE;
@@ -832,7 +832,7 @@ boxed_field_setter (JSContext *context,
goto out;
}
- success = boxed_set_field_from_value (context, priv, field_info, *value);
+ success = boxed_set_field_from_value (context, priv, field_info, *value._);
out:
g_base_info_unref ((GIBaseInfo *)field_info);
diff --git a/gi/object.c b/gi/object.c
index 1462cbf..7410caf 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -244,10 +244,10 @@ proto_priv_from_js(JSContext *context,
* Return value is JS_FALSE on OOM/exception.
*/
static JSBool
-object_instance_get_prop(JSContext *context,
- JSObject **obj,
- jsid *id,
- jsval *value_p)
+object_instance_get_prop(JSContext *context,
+ JSHandleObject obj,
+ JSHandleId id,
+ JSMutableHandleValue value_p)
{
ObjectInstance *priv;
char *name;
@@ -256,12 +256,12 @@ object_instance_get_prop(JSContext *context,
GValue gvalue = { 0, };
JSBool ret = JS_TRUE;
- if (!gjs_get_string_id(context, *id, &name))
+ if (!gjs_get_string_id(context, *id._, &name))
return JS_TRUE; /* not resolved, but no error */
- priv = priv_from_js(context, *obj);
+ priv = priv_from_js(context, *obj._);
gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
- "Get prop '%s' hook obj %p priv %p", name, obj, priv);
+ "Get prop '%s' hook obj %p priv %p", name, *obj._, priv);
if (priv == NULL) {
/* If we reach this point, either object_instance_new_resolve
@@ -297,7 +297,7 @@ object_instance_get_prop(JSContext *context,
g_value_init(&gvalue, G_PARAM_SPEC_VALUE_TYPE(param));
g_object_get_property(priv->gobj, param->name,
&gvalue);
- if (!gjs_value_from_g_value(context, value_p, &gvalue)) {
+ if (!gjs_value_from_g_value(context, value_p._, &gvalue)) {
g_value_unset(&gvalue);
ret = JS_FALSE;
goto out;
@@ -313,23 +313,23 @@ object_instance_get_prop(JSContext *context,
* be set. Return value is JS_FALSE on OOM/exception.
*/
static JSBool
-object_instance_set_prop(JSContext *context,
- JSObject **obj,
- jsid *id,
- JSBool strict,
- jsval *value_p)
+object_instance_set_prop(JSContext *context,
+ JSHandleObject obj,
+ JSHandleId id,
+ JSBool strict,
+ JSMutableHandleValue value_p)
{
ObjectInstance *priv;
char *name;
GParameter param = { NULL, { 0, }};
JSBool ret = JS_TRUE;
- if (!gjs_get_string_id(context, *id, &name))
+ if (!gjs_get_string_id(context, *id._, &name))
return JS_TRUE; /* not resolved, but no error */
- priv = priv_from_js(context, *obj);
+ priv = priv_from_js(context, *obj._);
gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
- "Set prop '%s' hook obj %p priv %p", name, obj, priv);
+ "Set prop '%s' hook obj %p priv %p", name, *obj._, priv);
if (priv == NULL) {
/* see the comment in object_instance_get_prop() on this */
@@ -339,7 +339,7 @@ object_instance_set_prop(JSContext *context,
goto out;
switch (init_g_param_from_property(context, name,
- *value_p,
+ *value_p._,
G_TYPE_FROM_INSTANCE(priv->gobj),
¶m,
FALSE /* constructing */)) {
diff --git a/gi/param.c b/gi/param.c
index 4ccdb9c..303cec4 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -68,10 +68,10 @@ find_field_info(GIObjectInfo *info,
* Return value is JS_FALSE on OOM/exception.
*/
static JSBool
-param_get_prop(JSContext *context,
- JSObject **obj,
- jsid *id,
- jsval *value_p)
+param_get_prop(JSContext *context,
+ JSHandleObject obj,
+ JSHandleId id,
+ JSMutableHandleValue value_p)
{
JSBool success;
Param *priv;
@@ -83,10 +83,10 @@ param_get_prop(JSContext *context,
GITypeInfo *type_info = NULL;
GIArgument arg;
- if (!gjs_get_string_id(context, *id, &name))
+ if (!gjs_get_string_id(context, *id._, &name))
return JS_TRUE; /* not something we affect, but no error */
- priv = priv_from_js(context, *obj);
+ priv = priv_from_js(context, *obj._);
if (priv == NULL) {
g_free(name);
@@ -101,7 +101,7 @@ param_get_prop(JSContext *context,
if (info == NULL) {
/* We may have a non-introspectable GParamSpec subclass here. Just return VOID. */
- *value_p = JSVAL_VOID;
+ *value_p._ = JSVAL_VOID;
success = JS_TRUE;
goto out;
}
@@ -116,7 +116,7 @@ param_get_prop(JSContext *context,
}
if (field_info == NULL) {
- *value_p = JSVAL_VOID;
+ *value_p._ = JSVAL_VOID;
success = JS_TRUE;
goto out;
}
@@ -130,7 +130,7 @@ param_get_prop(JSContext *context,
goto out;
}
- if (!gjs_value_from_g_argument(context, value_p, type_info, &arg, TRUE))
+ if (!gjs_value_from_g_argument(context, value_p._, type_info, &arg, TRUE))
goto out;
success = JS_TRUE;
diff --git a/gi/repo.c b/gi/repo.c
index 9d667f0..6338478 100644
--- a/gi/repo.c
+++ b/gi/repo.c
@@ -486,7 +486,8 @@ gjs_define_info(JSContext *context,
gjs_define_boxed_class(context, in_object, (GIBoxedInfo*) info);
break;
case GI_INFO_TYPE_UNION:
- gjs_define_union_class(context, in_object, (GIUnionInfo*) info);
+ if (!gjs_define_union_class(context, in_object, (GIUnionInfo*) info))
+ return JS_FALSE;
break;
case GI_INFO_TYPE_ENUM:
if (g_enum_info_get_error_domain((GIEnumInfo*) info)) {
diff --git a/gi/union.c b/gi/union.c
index ffeb7e6..d634870 100644
--- a/gi/union.c
+++ b/gi/union.c
@@ -333,7 +333,7 @@ static JSFunctionSpec gjs_union_proto_funcs[] = {
{ NULL }
};
-void
+JSBool
gjs_define_union_class(JSContext *context,
JSObject *in_object,
GIUnionInfo *info)
@@ -393,6 +393,8 @@ gjs_define_union_class(JSContext *context,
value = OBJECT_TO_JSVAL(gjs_gtype_create_gtype_wrapper(context, gtype));
JS_DefineProperty(context, constructor, "$gtype", value,
NULL, NULL, JSPROP_PERMANENT);
+
+ return JS_TRUE;
}
JSObject*
diff --git a/gi/union.h b/gi/union.h
index 94744ce..cf5157a 100644
--- a/gi/union.h
+++ b/gi/union.h
@@ -30,7 +30,7 @@
G_BEGIN_DECLS
-void gjs_define_union_class (JSContext *context,
+JSBool gjs_define_union_class (JSContext *context,
JSObject *in_object,
GIUnionInfo *info);
void* gjs_c_union_from_union (JSContext *context,
diff --git a/gi/value.c b/gi/value.c
index 9d6e633..cc3638f 100644
--- a/gi/value.c
+++ b/gi/value.c
@@ -84,6 +84,9 @@ closure_marshal(GClosure *closure,
gjs_set_values(context, argv, argc, JSVAL_VOID);
gjs_root_value_locations(context, argv, argc);
+ } else {
+ /* squash a compiler warning */
+ argv = NULL;
}
JS_AddValueRoot(context, &rval);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]