[gjs/wip/ptomato/mozjs31prep: 1/5] js: Discontinue usage of JSBool
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep: 1/5] js: Discontinue usage of JSBool
- Date: Sun, 18 Sep 2016 03:14:09 +0000 (UTC)
commit d274b27a182a36fe1d797f179fbc9bbeb62334ef
Author: Philip Chimento <philip endlessm com>
Date: Thu Sep 1 18:41:38 2016 -0700
js: Discontinue usage of JSBool
In mozjs31, JSBool and its values JS_TRUE and JS_FALSE are discontinued
in favor of regular C++ bool, true, and false. In order to ease porting
to mozjs31, we switch to C++ booleans everywhere.
Almost everywhere, that is. In some cases bool *, or function pointers
with bool return types, will not automatically be cast. We therefore leave
a few instances of JSBool in the code. These will be removed when the
actual port to mozjs31 happens.
Fixes a few formatting glitches in lines of code that were touched
anyway.
gi/arg.cpp | 322 ++++++++++++++++++-------------------
gi/arg.h | 116 +++++++-------
gi/boxed.cpp | 114 +++++++-------
gi/boxed.h | 4 +-
gi/enumeration.cpp | 24 ++--
gi/enumeration.h | 10 +-
gi/foreign.cpp | 46 +++---
gi/foreign.h | 64 ++++----
gi/function.cpp | 89 +++++------
gi/function.h | 4 +-
gi/fundamental.cpp | 54 +++---
gi/fundamental.h | 10 +-
gi/gerror.cpp | 62 ++++----
gi/gerror.h | 4 +-
gi/gtype.cpp | 12 +-
gi/gtype.h | 6 +-
gi/interface.cpp | 26 ++--
gi/interface.h | 16 +-
gi/ns.cpp | 20 ++--
gi/object.cpp | 212 ++++++++++++------------
gi/object.h | 12 +-
gi/param.cpp | 26 ++--
gi/param.h | 4 +-
gi/proxyutils.cpp | 6 +-
gi/proxyutils.h | 14 +-
gi/repo.cpp | 48 +++---
gi/repo.h | 4 +-
gi/union.cpp | 40 +++---
gi/union.h | 6 +-
gi/value.cpp | 134 ++++++++--------
gi/value.h | 6 +-
gjs/byteArray.cpp | 136 ++++++++--------
gjs/byteArray.h | 6 +-
gjs/compat.h | 12 +-
gjs/context.cpp | 24 ++--
gjs/coverage.cpp | 31 ++--
gjs/gi.cpp | 2 +-
gjs/gi.h | 4 +-
gjs/importer.cpp | 123 +++++++-------
gjs/importer.h | 6 +-
gjs/jsapi-dynamic-class.cpp | 14 +-
gjs/jsapi-util-error.cpp | 6 +-
gjs/jsapi-util-string.cpp | 34 ++--
gjs/jsapi-util.cpp | 86 +++++-----
gjs/jsapi-util.h | 66 ++++----
gjs/native.cpp | 4 +-
gjs/native.h | 10 +-
gjs/runtime.cpp | 24 ++--
gjs/runtime.h | 2 +-
gjs/stack.cpp | 6 +-
modules/cairo-context.cpp | 218 +++++++++++++-------------
modules/cairo-gradient.cpp | 16 +-
modules/cairo-image-surface.cpp | 48 +++---
modules/cairo-linear-gradient.cpp | 6 +-
modules/cairo-module.h | 4 +-
modules/cairo-pattern.cpp | 8 +-
modules/cairo-pdf-surface.cpp | 6 +-
modules/cairo-private.h | 2 +-
modules/cairo-ps-surface.cpp | 6 +-
modules/cairo-radial-gradient.cpp | 6 +-
modules/cairo-region.cpp | 60 ++++----
modules/cairo-solid-pattern.cpp | 16 +-
modules/cairo-surface-pattern.cpp | 40 +++---
modules/cairo-surface.cpp | 34 ++--
modules/cairo-svg-surface.cpp | 6 +-
modules/cairo.cpp | 36 ++--
modules/console.cpp | 24 ++--
modules/console.h | 10 +-
modules/system.cpp | 39 +++---
modules/system.h | 4 +-
test/gjs-tests.cpp | 4 +-
71 files changed, 1343 insertions(+), 1361 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 72ac37a..9a1e951 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -40,7 +40,7 @@
#include <util/log.h>
-JSBool
+bool
_gjs_flags_value_is_valid(JSContext *context,
GType gtype,
gint64 value)
@@ -51,7 +51,7 @@ _gjs_flags_value_is_valid(JSContext *context,
/* FIXME: Do proper value check for flags with GType's */
if (gtype == G_TYPE_NONE)
- return JS_TRUE;
+ return true;
klass = g_type_class_ref(gtype);
@@ -61,7 +61,7 @@ _gjs_flags_value_is_valid(JSContext *context,
gjs_throw(context,
"0x%" G_GINT64_MODIFIER "x is not a valid value for flags %s",
value, g_type_name(G_TYPE_FROM_CLASS(klass)));
- return JS_FALSE;
+ return false;
}
while (tmpval) {
@@ -70,27 +70,27 @@ _gjs_flags_value_is_valid(JSContext *context,
gjs_throw(context,
"0x%x is not a valid value for flags %s",
(guint32)value, g_type_name(G_TYPE_FROM_CLASS(klass)));
- return JS_FALSE;
+ return false;
}
tmpval &= ~v->value;
}
g_type_class_unref(klass);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
_gjs_enum_value_is_valid(JSContext *context,
GIEnumInfo *enum_info,
gint64 value)
{
- JSBool found;
+ bool found;
int n_values;
int i;
n_values = g_enum_info_get_n_values(enum_info);
- found = JS_FALSE;
+ found = false;
for (i = 0; i < n_values; ++i) {
GIValueInfo *value_info;
@@ -101,7 +101,7 @@ _gjs_enum_value_is_valid(JSContext *context,
g_base_info_unref((GIBaseInfo *)value_info);
if (enum_value == value) {
- found = JS_TRUE;
+ found = true;
break;
}
}
@@ -226,7 +226,7 @@ type_needs_release (GITypeInfo *type_info,
/* Check if an argument of the given needs to be released if we obtained it
* from out argument (or the return value), and we're transferring ownership
*/
-static JSBool
+static bool
type_needs_out_release(GITypeInfo *type_info,
GITypeTag type_tag)
{
@@ -273,7 +273,7 @@ type_needs_out_release(GITypeInfo *type_info,
}
}
-static JSBool
+static bool
gjs_array_to_g_list(JSContext *context,
jsval array_value,
unsigned int length,
@@ -299,7 +299,7 @@ gjs_array_to_g_list(JSContext *context,
*/
gjs_throw(context,
"Container transfer for in parameters not supported");
- return JS_FALSE;
+ return false;
}
transfer = GI_TRANSFER_NOTHING;
@@ -314,7 +314,7 @@ gjs_array_to_g_list(JSContext *context,
gjs_throw(context,
"Missing array element %u",
i);
- return JS_FALSE;
+ return false;
}
/* FIXME we don't know if the list elements can be NULL.
@@ -329,7 +329,7 @@ gjs_array_to_g_list(JSContext *context,
transfer,
FALSE,
&elem_arg)) {
- return JS_FALSE;
+ return false;
}
if (list_type == GI_TYPE_TAG_GLIST) {
@@ -347,10 +347,10 @@ gjs_array_to_g_list(JSContext *context,
*list_p = list;
*slist_p = slist;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_object_to_g_hash(JSContext *context,
jsval hash_value,
GITypeInfo *key_param_info,
@@ -375,7 +375,7 @@ gjs_object_to_g_hash(JSContext *context,
*/
gjs_throw(context,
"Container transfer for in parameters not supported");
- return JS_FALSE;
+ return false;
}
transfer = GI_TRANSFER_NOTHING;
@@ -383,11 +383,11 @@ gjs_object_to_g_hash(JSContext *context,
iter = JS_NewPropertyIterator(context, props);
if (iter == NULL)
- return JS_FALSE;
+ return false;
prop_id = JSID_VOID;
if (!JS_NextProperty(context, iter, &prop_id))
- return JS_FALSE;
+ return false;
/* Don't use key/value destructor functions here, because we can't
* construct correct ones in general if the value type is complex.
@@ -428,14 +428,14 @@ gjs_object_to_g_hash(JSContext *context,
}
*hash_p = result;
- return JS_TRUE;
+ return true;
free_hash_and_fail:
g_hash_table_destroy(result);
- return JS_FALSE;
+ return false;
}
-JSBool
+bool
gjs_array_from_strv(JSContext *context,
jsval *value_p,
const char **strv)
@@ -443,11 +443,11 @@ gjs_array_from_strv(JSContext *context,
JSObject *obj;
jsval elem;
guint i;
- JSBool result = JS_FALSE;
+ bool result = false;
obj = JS_NewArrayObject(context, 0, NULL);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
@@ -464,7 +464,7 @@ gjs_array_from_strv(JSContext *context,
}
}
- result = JS_TRUE;
+ result = true;
out:
JS_RemoveValueRoot(context, &elem);
@@ -472,7 +472,7 @@ out:
return result;
}
-JSBool
+bool
gjs_array_to_strv(JSContext *context,
jsval array_value,
unsigned int length,
@@ -493,27 +493,27 @@ gjs_array_to_strv(JSContext *context,
gjs_throw(context,
"Missing array element %u",
i);
- return JS_FALSE;
+ return false;
}
if (!JSVAL_IS_STRING(elem)) {
gjs_throw(context,
"Invalid element in string array");
g_strfreev(result);
- return JS_FALSE;
+ return false;
}
if (!gjs_string_to_utf8(context, elem, (char **)&(result[i]))) {
g_strfreev(result);
- return JS_FALSE;
+ return false;
}
}
*arr_p = result;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_string_to_intarray(JSContext *context,
jsval string_val,
GITypeInfo *param_info,
@@ -530,28 +530,28 @@ gjs_string_to_intarray(JSContext *context,
case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8:
if (!gjs_string_to_utf8(context, string_val, &result))
- return JS_FALSE;
+ return false;
*arr_p = result;
*length = strlen(result);
- return JS_TRUE;
+ return true;
case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_UINT16:
if (!gjs_string_get_uint16_data(context, string_val,
&result16, length))
- return JS_FALSE;
+ return false;
*arr_p = result16;
- return JS_TRUE;
+ return true;
default:
/* can't convert a string to this type */
gjs_throw(context, "Cannot convert string to array of '%s'",
g_type_tag_to_string (element_type));
- return JS_FALSE;
+ return false;
}
}
-static JSBool
+static bool
gjs_array_to_intarray(JSContext *context,
jsval array_value,
unsigned int length,
@@ -569,7 +569,7 @@ gjs_array_to_intarray(JSContext *context,
for (i = 0; i < length; ++i) {
jsval elem;
- JSBool success;
+ bool success;
elem = JSVAL_VOID;
if (!JS_GetElement(context, JSVAL_TO_OBJECT(array_value),
@@ -578,7 +578,7 @@ gjs_array_to_intarray(JSContext *context,
gjs_throw(context,
"Missing array element %u",
i);
- return JS_FALSE;
+ return false;
}
/* do whatever sign extension is appropriate */
@@ -590,7 +590,7 @@ gjs_array_to_intarray(JSContext *context,
g_free(result);
gjs_throw(context,
"Invalid element in int array");
- return JS_FALSE;
+ return false;
}
/* Note that this is truncating assignment. */
switch (intsize) {
@@ -607,10 +607,10 @@ gjs_array_to_intarray(JSContext *context,
*arr_p = result;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_gtypearray_to_array(JSContext *context,
jsval array_value,
unsigned int length,
@@ -631,7 +631,7 @@ gjs_gtypearray_to_array(JSContext *context,
i, &elem)) {
g_free(result);
gjs_throw(context, "Missing array element %u", i);
- return JS_FALSE;
+ return false;
}
if (!JSVAL_IS_OBJECT(elem))
@@ -646,15 +646,15 @@ gjs_gtypearray_to_array(JSContext *context,
*arr_p = result;
- return JS_TRUE;
+ return true;
err:
g_free(result);
gjs_throw(context, "Invalid element in GType array");
- return JS_FALSE;
+ return false;
}
-static JSBool
+static bool
gjs_array_to_floatarray(JSContext *context,
jsval array_value,
unsigned int length,
@@ -670,7 +670,7 @@ gjs_array_to_floatarray(JSContext *context,
for (i = 0; i < length; ++i) {
jsval elem;
double val;
- JSBool success;
+ bool success;
elem = JSVAL_VOID;
if (!JS_GetElement(context, JSVAL_TO_OBJECT(array_value),
@@ -679,7 +679,7 @@ gjs_array_to_floatarray(JSContext *context,
gjs_throw(context,
"Missing array element %u",
i);
- return JS_FALSE;
+ return false;
}
/* do whatever sign extension is appropriate */
@@ -689,7 +689,7 @@ gjs_array_to_floatarray(JSContext *context,
g_free(result);
gjs_throw(context,
"Invalid element in array");
- return JS_FALSE;
+ return false;
}
/* Note that this is truncating assignment. */
@@ -704,10 +704,10 @@ gjs_array_to_floatarray(JSContext *context,
*arr_p = result;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_array_to_ptrarray(JSContext *context,
jsval array_value,
unsigned int length,
@@ -726,7 +726,7 @@ gjs_array_to_ptrarray(JSContext *context,
GIArgument arg;
arg.v_pointer = NULL;
- JSBool success;
+ bool success;
elem = JSVAL_VOID;
if (!JS_GetElement(context, JSVAL_TO_OBJECT(array_value),
@@ -735,7 +735,7 @@ gjs_array_to_ptrarray(JSContext *context,
gjs_throw(context,
"Missing array element %u",
i);
- return JS_FALSE;
+ return false;
}
success = gjs_value_to_g_argument (context,
@@ -751,17 +751,17 @@ gjs_array_to_ptrarray(JSContext *context,
g_free(array);
gjs_throw(context,
"Invalid element in array");
- return JS_FALSE;
+ return false;
}
array[i] = arg.v_pointer;
}
*arr_p = array;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_array_to_flat_gvalue_array(JSContext *context,
jsval array_value,
unsigned int length,
@@ -769,7 +769,7 @@ gjs_array_to_flat_gvalue_array(JSContext *context,
{
GValue *values = g_new0(GValue, length);
unsigned int i;
- JSBool result = JS_TRUE;
+ bool result = true;
for (i = 0; i < length; i ++) {
jsval elem;
@@ -781,7 +781,7 @@ gjs_array_to_flat_gvalue_array(JSContext *context,
gjs_throw(context,
"Missing array element %u",
i);
- return JS_FALSE;
+ return false;
}
result = gjs_value_to_g_value(context, elem, &values[i]);
@@ -796,7 +796,7 @@ gjs_array_to_flat_gvalue_array(JSContext *context,
return result;
}
-static JSBool
+static bool
gjs_array_from_flat_gvalue_array(JSContext *context,
gpointer array,
unsigned int length,
@@ -805,7 +805,7 @@ gjs_array_from_flat_gvalue_array(JSContext *context,
GValue *values = (GValue *)array;
unsigned int i;
jsval *elems = g_newa(jsval, length);
- JSBool result = JS_TRUE;
+ bool result = true;
for (i = 0; i < length; i ++) {
GValue *value = &values[i];
@@ -873,7 +873,7 @@ is_gvalue_flat_array(GITypeInfo *param_info,
return result;
}
-static JSBool
+static bool
gjs_array_to_array(JSContext *context,
jsval array_value,
gsize length,
@@ -946,7 +946,7 @@ gjs_array_to_array(JSContext *context,
default:
gjs_throw(context,
"Unhandled array element type %d", element_type);
- return JS_FALSE;
+ return false;
}
}
@@ -1075,7 +1075,7 @@ throw_invalid_argument(JSContext *context,
g_free(display_name);
}
-static JSBool
+static bool
gjs_array_to_explicit_array_internal(JSContext *context,
jsval value,
GITypeInfo *type_info,
@@ -1086,7 +1086,7 @@ gjs_array_to_explicit_array_internal(JSContext *context,
gpointer *contents,
gsize *length_p)
{
- JSBool ret = JS_FALSE;
+ bool ret = false;
GITypeInfo *param_info;
jsid length_name;
JSBool found_length;
@@ -1136,14 +1136,14 @@ gjs_array_to_explicit_array_internal(JSContext *context,
goto out;
}
- ret = JS_TRUE;
+ ret = true;
out:
g_base_info_unref((GIBaseInfo*) param_info);
return ret;
}
-JSBool
+bool
gjs_value_to_g_argument(JSContext *context,
jsval value,
GITypeInfo *type_info,
@@ -1166,7 +1166,7 @@ gjs_value_to_g_argument(JSContext *context,
g_type_tag_to_string(type_tag));
nullable_type = FALSE;
- wrong = FALSE; /* return JS_FALSE */
+ wrong = FALSE; /* return false */
out_of_range = FALSE;
report_type_mismatch = FALSE; /* wrong=TRUE, and still need to gjs_throw a type problem */
@@ -1331,8 +1331,7 @@ gjs_value_to_g_argument(JSContext *context,
if (JSVAL_IS_NULL(value)) {
arg->v_pointer = NULL;
} else if (JSVAL_IS_OBJECT(value)) {
- if (gjs_typecheck_gerror(context, JSVAL_TO_OBJECT(value),
- JS_TRUE)) {
+ if (gjs_typecheck_gerror(context, JSVAL_TO_OBJECT(value), true)) {
arg->v_pointer = gjs_gerror_from_error(context,
JSVAL_TO_OBJECT(value));
@@ -1371,7 +1370,7 @@ gjs_value_to_g_argument(JSContext *context,
switch(interface_type) {
case GI_INFO_TYPE_STRUCT:
if (g_struct_info_is_foreign((GIStructInfo*)interface_info)) {
- JSBool ret;
+ bool ret;
ret = gjs_struct_foreign_convert_to_g_argument(
context, value, interface_info, arg_name,
arg_type, transfer, may_be_null, arg);
@@ -1458,7 +1457,7 @@ gjs_value_to_g_argument(JSContext *context,
&& gjs_typecheck_bytearray(context, obj, FALSE)) {
arg->v_pointer = gjs_byte_array_get_bytes(context, obj);
} else if (g_type_is_a(gtype, G_TYPE_ERROR)) {
- if (!gjs_typecheck_gerror(context, JSVAL_TO_OBJECT(value), JS_TRUE)) {
+ if (!gjs_typecheck_gerror(context, JSVAL_TO_OBJECT(value), true)) {
arg->v_pointer = NULL;
wrong = TRUE;
} else {
@@ -1467,8 +1466,7 @@ gjs_value_to_g_argument(JSContext *context,
}
} else {
if (!gjs_typecheck_boxed(context, JSVAL_TO_OBJECT(value),
- interface_info, gtype,
- JS_TRUE)) {
+ interface_info, gtype, true)) {
arg->v_pointer = NULL;
wrong = TRUE;
} else {
@@ -1492,7 +1490,7 @@ gjs_value_to_g_argument(JSContext *context,
} else if (interface_type == GI_INFO_TYPE_UNION) {
if (gjs_typecheck_union(context, JSVAL_TO_OBJECT(value),
- interface_info, gtype, JS_TRUE)) {
+ interface_info, gtype, true)) {
arg->v_pointer = gjs_c_union_from_union(context,
JSVAL_TO_OBJECT(value));
@@ -1514,7 +1512,7 @@ gjs_value_to_g_argument(JSContext *context,
} else if (gtype != G_TYPE_NONE) {
if (g_type_is_a(gtype, G_TYPE_OBJECT)) {
- if (gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, JS_TRUE)) {
+ if (gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, true)) {
arg->v_pointer = gjs_g_object_from_object(context,
JSVAL_TO_OBJECT(value));
@@ -1525,7 +1523,7 @@ gjs_value_to_g_argument(JSContext *context,
wrong = TRUE;
}
} else if (g_type_is_a(gtype, G_TYPE_PARAM)) {
- if (gjs_typecheck_param(context, JSVAL_TO_OBJECT(value), gtype, JS_TRUE)) {
+ if (gjs_typecheck_param(context, JSVAL_TO_OBJECT(value), gtype, true)) {
arg->v_pointer = gjs_g_param_from_param(context, JSVAL_TO_OBJECT(value));
if (transfer != GI_TRANSFER_NOTHING)
g_param_spec_ref(G_PARAM_SPEC(arg->v_pointer));
@@ -1548,7 +1546,7 @@ gjs_value_to_g_argument(JSContext *context,
interface_type);
}
} else if (G_TYPE_IS_INSTANTIATABLE(gtype)) {
- if (gjs_typecheck_fundamental(context, JSVAL_TO_OBJECT(value), gtype, JS_TRUE)) {
+ if (gjs_typecheck_fundamental(context, JSVAL_TO_OBJECT(value), gtype, true)) {
arg->v_pointer = gjs_g_fundamental_from_object(context,
JSVAL_TO_OBJECT(value));
@@ -1561,19 +1559,19 @@ gjs_value_to_g_argument(JSContext *context,
} else if (G_TYPE_IS_INTERFACE(gtype)) {
/* Could be a GObject interface that's missing a prerequisite, or could
be a fundamental */
- if (gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, JS_FALSE)) {
+ if (gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, false)) {
arg->v_pointer = gjs_g_object_from_object(context, JSVAL_TO_OBJECT(value));
if (transfer != GI_TRANSFER_NOTHING)
g_object_ref(arg->v_pointer);
- } else if (gjs_typecheck_fundamental(context, JSVAL_TO_OBJECT(value), gtype,
JS_FALSE)) {
+ } else if (gjs_typecheck_fundamental(context, JSVAL_TO_OBJECT(value), gtype, false))
{
arg->v_pointer = gjs_g_fundamental_from_object(context, JSVAL_TO_OBJECT(value));
if (transfer != GI_TRANSFER_NOTHING)
gjs_fundamental_ref(context, arg->v_pointer);
} else {
/* Call again with throw=TRUE to set the exception */
- gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, JS_TRUE);
+ gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, true);
arg->v_pointer = NULL;
wrong = TRUE;
}
@@ -1822,14 +1820,14 @@ gjs_value_to_g_argument(JSContext *context,
if (report_type_mismatch) {
throw_invalid_argument(context, value, type_info, arg_name, arg_type);
}
- return JS_FALSE;
+ return false;
} else if (G_UNLIKELY(out_of_range)) {
gchar *display_name = get_argument_display_name (arg_name, arg_type);
gjs_throw(context, "value is out of range for %s (type %s)",
display_name,
g_type_tag_to_string(type_tag));
g_free (display_name);
- return JS_FALSE;
+ return false;
} else if (nullable_type &&
arg->v_pointer == NULL &&
!may_be_null) {
@@ -1839,9 +1837,9 @@ gjs_value_to_g_argument(JSContext *context,
display_name,
g_type_tag_to_string(type_tag));
g_free (display_name);
- return JS_FALSE;
+ return false;
} else {
- return JS_TRUE;
+ return true;
}
}
@@ -1967,7 +1965,7 @@ gjs_g_argument_init_default(JSContext *context,
}
}
-JSBool
+bool
gjs_value_to_arg(JSContext *context,
jsval value,
GIArgInfo *arg_info,
@@ -1987,7 +1985,7 @@ gjs_value_to_arg(JSContext *context,
arg);
}
-JSBool
+bool
gjs_value_to_explicit_array (JSContext *context,
jsval value,
GIArgInfo *arg_info,
@@ -2009,7 +2007,7 @@ gjs_value_to_explicit_array (JSContext *context,
length_p);
}
-static JSBool
+static bool
gjs_array_from_g_list (JSContext *context,
jsval *value_p,
GITypeTag list_tag,
@@ -2021,18 +2019,18 @@ gjs_array_from_g_list (JSContext *context,
unsigned int i;
jsval elem;
GArgument arg;
- JSBool result;
+ bool result;
obj = JS_NewArrayObject(context, 0, NULL);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
elem = JSVAL_VOID;
JS_AddValueRoot(context, &elem);
- result = JS_FALSE;
+ result = false;
i = 0;
if (list_tag == GI_TYPE_TAG_GLIST) {
@@ -2069,7 +2067,7 @@ gjs_array_from_g_list (JSContext *context,
}
}
- result = JS_TRUE;
+ result = true;
out:
JS_RemoveValueRoot(context, &elem);
@@ -2077,7 +2075,7 @@ gjs_array_from_g_list (JSContext *context,
return result;
}
-static JSBool
+static bool
gjs_array_from_carray_internal (JSContext *context,
jsval *value_p,
GITypeInfo *param_info,
@@ -2087,11 +2085,11 @@ gjs_array_from_carray_internal (JSContext *context,
JSObject *obj;
jsval elem;
GArgument arg;
- JSBool result;
+ bool result;
GITypeTag element_type;
guint i;
- result = JS_FALSE;
+ result = false;
element_type = g_type_info_get_tag(param_info);
@@ -2107,14 +2105,14 @@ gjs_array_from_carray_internal (JSContext *context,
obj = gjs_byte_array_from_byte_array (context, &gbytearray);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
obj = JS_NewArrayObject(context, 0, NULL);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
@@ -2211,7 +2209,7 @@ gjs_array_from_carray_internal (JSContext *context,
#undef ITERATE
- result = JS_TRUE;
+ result = true;
finally:
JS_RemoveValueRoot(context, &elem);
@@ -2219,7 +2217,7 @@ finally:
return result;
}
-static JSBool
+static bool
gjs_array_from_fixed_size_array (JSContext *context,
jsval *value_p,
GITypeInfo *type_info,
@@ -2227,7 +2225,7 @@ gjs_array_from_fixed_size_array (JSContext *context,
{
gint length;
GITypeInfo *param_info;
- JSBool res;
+ bool res;
length = g_type_info_get_array_fixed_size(type_info);
@@ -2242,7 +2240,7 @@ gjs_array_from_fixed_size_array (JSContext *context,
return res;
}
-JSBool
+bool
gjs_value_from_explicit_array(JSContext *context,
jsval *value_p,
GITypeInfo *type_info,
@@ -2250,7 +2248,7 @@ gjs_value_from_explicit_array(JSContext *context,
int length)
{
GITypeInfo *param_info;
- JSBool res;
+ bool res;
param_info = g_type_info_get_param_type(type_info, 0);
@@ -2261,7 +2259,7 @@ gjs_value_from_explicit_array(JSContext *context,
return res;
}
-static JSBool
+static bool
gjs_array_from_boxed_array (JSContext *context,
jsval *value_p,
GIArrayType array_type,
@@ -2298,7 +2296,7 @@ gjs_array_from_boxed_array (JSContext *context,
return gjs_array_from_carray_internal(context, value_p, param_info, length, data);
}
-static JSBool
+static bool
gjs_array_from_zero_terminated_c_array (JSContext *context,
jsval *value_p,
GITypeInfo *param_info,
@@ -2307,11 +2305,11 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
JSObject *obj;
jsval elem;
GArgument arg;
- JSBool result;
+ bool result;
GITypeTag element_type;
guint i;
- result = JS_FALSE;
+ result = false;
element_type = g_type_info_get_tag(param_info);
@@ -2324,14 +2322,14 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
obj = gjs_byte_array_from_byte_array (context, &gbytearray);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
obj = JS_NewArrayObject(context, 0, NULL);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
@@ -2398,7 +2396,7 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
#undef ITERATE
- result = JS_TRUE;
+ result = true;
finally:
JS_RemoveValueRoot(context, &elem);
@@ -2407,7 +2405,7 @@ finally:
}
-static JSBool
+static bool
gjs_object_from_g_hash (JSContext *context,
jsval *value_p,
GITypeInfo *key_param_info,
@@ -2420,17 +2418,17 @@ gjs_object_from_g_hash (JSContext *context,
char *keyutf8 = NULL;
jsval keyjs, valjs;
GArgument keyarg, valarg;
- JSBool result;
+ bool result;
// a NULL hash table becomes a null JS value
if (hash==NULL) {
*value_p = JSVAL_NULL;
- return JS_TRUE;
+ return true;
}
obj = JS_NewObject(context, NULL, NULL, NULL);
if (obj == NULL)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
JS_AddObjectRoot(context, &obj);
@@ -2444,7 +2442,7 @@ gjs_object_from_g_hash (JSContext *context,
keystr = NULL;
JS_AddStringRoot(context, &keystr);
- result = JS_FALSE;
+ result = false;
g_hash_table_iter_init(&iter, hash);
while (g_hash_table_iter_next
@@ -2474,7 +2472,7 @@ gjs_object_from_g_hash (JSContext *context,
keyutf8 = NULL;
}
- result = JS_TRUE;
+ result = true;
out:
if (keyutf8) g_free(keyutf8);
@@ -2486,7 +2484,7 @@ gjs_object_from_g_hash (JSContext *context,
return result;
}
-JSBool
+bool
gjs_value_from_g_argument (JSContext *context,
jsval *value_p,
GITypeInfo *type_info,
@@ -2562,7 +2560,7 @@ gjs_value_from_g_argument (JSContext *context,
gjs_throw(context,
"Invalid unicode codepoint %" G_GUINT32_FORMAT,
arg->v_uint32);
- return JS_FALSE;
+ return false;
} else {
bytes = g_unichar_to_utf8 (arg->v_uint32, utf8);
return gjs_string_from_utf8 (context, (char*)utf8, bytes, value_p);
@@ -2576,7 +2574,7 @@ gjs_value_from_g_argument (JSContext *context,
/* For NULL we'll return JSVAL_NULL, which is already set
* in *value_p
*/
- return JS_TRUE;
+ return true;
}
case GI_TYPE_TAG_UTF8:
if (arg->v_pointer)
@@ -2585,7 +2583,7 @@ gjs_value_from_g_argument (JSContext *context,
/* For NULL we'll return JSVAL_NULL, which is already set
* in *value_p
*/
- return JS_TRUE;
+ return true;
}
case GI_TYPE_TAG_ERROR:
@@ -2594,12 +2592,12 @@ gjs_value_from_g_argument (JSContext *context,
JSObject *obj = gjs_error_from_gerror(context, (GError *) arg->v_pointer, FALSE);
if (obj) {
*value_p = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
case GI_TYPE_TAG_INTERFACE:
@@ -2647,7 +2645,7 @@ gjs_value_from_g_argument (JSContext *context,
goto out;
} else if (interface_type == GI_INFO_TYPE_STRUCT &&
g_struct_info_is_foreign((GIStructInfo*)interface_info)) {
- JSBool ret;
+ bool ret;
ret = gjs_struct_foreign_convert_from_g_argument(context, value_p, interface_info, arg);
g_base_info_unref(interface_info);
return ret;
@@ -2661,7 +2659,7 @@ gjs_value_from_g_argument (JSContext *context,
if (interface_type == GI_INFO_TYPE_STRUCT &&
g_struct_info_is_gtype_struct((GIStructInfo*)interface_info)) {
- JSBool ret;
+ bool ret;
/* XXX: here we make the implicit assumption that GTypeClass is the same
as GTypeInterface. This is true for the GType field, which is what we
@@ -2748,7 +2746,7 @@ gjs_value_from_g_argument (JSContext *context,
"Type %s registered for unexpected interface_type %d",
g_type_name(gtype),
interface_type);
- return JS_FALSE;
+ return false;
} else if (g_type_is_a(gtype, G_TYPE_PARAM)) {
JSObject *obj;
obj = gjs_param_from_g_param(context, G_PARAM_SPEC(arg->v_pointer));
@@ -2770,7 +2768,7 @@ gjs_value_from_g_argument (JSContext *context,
g_base_info_unref( (GIBaseInfo*) interface_info);
if (JSVAL_IS_VOID(value))
- return JS_FALSE;
+ return false;
*value_p = value;
}
@@ -2783,7 +2781,7 @@ gjs_value_from_g_argument (JSContext *context,
if (g_type_info_is_zero_terminated(type_info)) {
GITypeInfo *param_info;
- JSBool result;
+ bool result;
param_info = g_type_info_get_param_type(type_info, 0);
g_assert(param_info != NULL);
@@ -2807,7 +2805,7 @@ gjs_value_from_g_argument (JSContext *context,
(GByteArray*)arg->v_pointer);
if (!array) {
gjs_throw(context, "Couldn't convert GByteArray to a ByteArray");
- return JS_FALSE;
+ return false;
}
*value_p = OBJECT_TO_JSVAL(array);
} else {
@@ -2881,13 +2879,13 @@ gjs_value_from_g_argument (JSContext *context,
default:
g_warning("Unhandled type %s converting GArgument to JavaScript",
g_type_tag_to_string(type_tag));
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
-static JSBool gjs_g_arg_release_internal(JSContext *context,
+static bool gjs_g_arg_release_internal(JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
GITypeTag type_tag,
@@ -2897,7 +2895,7 @@ typedef struct {
JSContext *context;
GITypeInfo *key_param_info, *val_param_info;
GITransfer transfer;
- JSBool failed;
+ bool failed;
} GHR_closure;
static gboolean
@@ -2910,13 +2908,13 @@ gjs_ghr_helper(gpointer key, gpointer val, gpointer user_data) {
c->key_param_info,
g_type_info_get_tag(c->key_param_info),
&key_arg))
- c->failed = JS_TRUE;
+ c->failed = true;
if (!gjs_g_arg_release_internal(c->context, c->transfer,
c->val_param_info,
g_type_info_get_tag(c->val_param_info),
&val_arg))
- c->failed = JS_TRUE;
+ c->failed = true;
return TRUE;
}
@@ -2926,18 +2924,18 @@ gjs_ghr_helper(gpointer key, gpointer val, gpointer user_data) {
*/
#define TRANSFER_IN_NOTHING (GI_TRANSFER_EVERYTHING + 1)
-static JSBool
+static bool
gjs_g_arg_release_internal(JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
GITypeTag type_tag,
GArgument *arg)
{
- JSBool failed;
+ bool failed;
g_assert(transfer != GI_TRANSFER_NOTHING);
- failed = JS_FALSE;
+ failed = false;
switch (type_tag) {
case GI_TYPE_TAG_VOID:
@@ -3026,7 +3024,7 @@ gjs_g_arg_release_internal(JSContext *context,
} else if (gtype == G_TYPE_NONE) {
if (transfer != TRANSFER_IN_NOTHING) {
gjs_throw(context, "Don't know how to release GArgument: not an object or boxed type");
- failed = JS_TRUE;
+ failed = true;
}
} else if (G_TYPE_IS_INSTANTIATABLE(gtype)) {
if (transfer != TRANSFER_IN_NOTHING)
@@ -3034,7 +3032,7 @@ gjs_g_arg_release_internal(JSContext *context,
} else {
gjs_throw(context, "Unhandled GType %s releasing GArgument",
g_type_name(gtype));
- failed = JS_TRUE;
+ failed = true;
}
out:
@@ -3061,7 +3059,7 @@ gjs_g_arg_release_internal(JSContext *context,
param_info,
g_type_info_get_tag(param_info),
&elem)) {
- failed = JS_TRUE;
+ failed = true;
}
}
@@ -3094,7 +3092,7 @@ gjs_g_arg_release_internal(JSContext *context,
"Releasing a flat GValue array that was not fixed-size or was nested"
"inside another container. This is not supported (and will leak)");
g_base_info_unref(param_info);
- return JS_FALSE;
+ return false;
}
for (i = 0; i < len; i++) {
@@ -3105,7 +3103,7 @@ gjs_g_arg_release_internal(JSContext *context,
g_free(arg->v_pointer);
g_base_info_unref(param_info);
- return JS_TRUE;
+ return true;
}
switch (element_type) {
@@ -3146,7 +3144,7 @@ gjs_g_arg_release_internal(JSContext *context,
param_info,
element_type,
&elem)) {
- failed = JS_TRUE;
+ failed = true;
}
}
} else {
@@ -3175,7 +3173,7 @@ gjs_g_arg_release_internal(JSContext *context,
gjs_throw(context,
"Releasing a C array with explicit length, that was nested"
"inside another container. This is not supported (and will leak)");
- failed = JS_TRUE;
+ failed = true;
}
g_base_info_unref((GIBaseInfo*) param_info);
@@ -3233,7 +3231,7 @@ gjs_g_arg_release_internal(JSContext *context,
gjs_throw(context,
"Don't know how to release GArray element-type %d",
element_type);
- failed = JS_TRUE;
+ failed = true;
}
g_base_info_unref((GIBaseInfo*) param_info);
@@ -3288,7 +3286,7 @@ gjs_g_arg_release_internal(JSContext *context,
param_info,
g_type_info_get_tag(param_info),
&elem)) {
- failed = JS_TRUE;
+ failed = true;
}
}
@@ -3306,7 +3304,7 @@ gjs_g_arg_release_internal(JSContext *context,
GHR_closure c = {
context, NULL, NULL,
transfer,
- JS_FALSE
+ false
};
c.key_param_info = g_type_info_get_param_type(type_info, 0);
@@ -3330,13 +3328,13 @@ gjs_g_arg_release_internal(JSContext *context,
default:
g_warning("Unhandled type %s releasing GArgument",
g_type_tag_to_string(type_tag));
- return JS_FALSE;
+ return false;
}
return !failed;
}
-JSBool
+bool
gjs_g_argument_release(JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
@@ -3345,7 +3343,7 @@ gjs_g_argument_release(JSContext *context,
GITypeTag type_tag;
if (transfer == GI_TRANSFER_NOTHING)
- return JS_TRUE;
+ return true;
type_tag = g_type_info_get_tag( (GITypeInfo*) type_info);
@@ -3356,7 +3354,7 @@ gjs_g_argument_release(JSContext *context,
return gjs_g_arg_release_internal(context, transfer, type_info, type_tag, arg);
}
-JSBool
+bool
gjs_g_argument_release_in_arg(JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
@@ -3371,7 +3369,7 @@ gjs_g_argument_release_in_arg(JSContext *context,
* an error and we won't get here.
*/
if (transfer != GI_TRANSFER_NOTHING)
- return JS_TRUE;
+ return true;
type_tag = g_type_info_get_tag( (GITypeInfo*) type_info);
@@ -3383,10 +3381,10 @@ gjs_g_argument_release_in_arg(JSContext *context,
return gjs_g_arg_release_internal(context, (GITransfer) TRANSFER_IN_NOTHING,
type_info, type_tag, arg);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_g_argument_release_in_array (JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
@@ -3397,11 +3395,11 @@ gjs_g_argument_release_in_array (JSContext *context,
gpointer *array;
GArgument elem;
guint i;
- JSBool ret = JS_TRUE;
+ bool ret = true;
GITypeTag type_tag;
if (transfer != GI_TRANSFER_NOTHING)
- return JS_TRUE;
+ return true;
gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
"Releasing GArgument array in param");
@@ -3423,7 +3421,7 @@ gjs_g_argument_release_in_array (JSContext *context,
elem.v_pointer = array[i];
if (!gjs_g_arg_release_internal(context, (GITransfer) TRANSFER_IN_NOTHING,
param_type, type_tag, &elem)) {
- ret = JS_FALSE;
+ ret = false;
break;
}
}
@@ -3435,7 +3433,7 @@ gjs_g_argument_release_in_array (JSContext *context,
return ret;
}
-JSBool
+bool
gjs_g_argument_release_out_array (JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
@@ -3446,11 +3444,11 @@ gjs_g_argument_release_out_array (JSContext *context,
gpointer *array;
GArgument elem;
guint i;
- JSBool ret = JS_TRUE;
+ bool ret = true;
GITypeTag type_tag;
if (transfer == GI_TRANSFER_NOTHING)
- return JS_TRUE;
+ return true;
gjs_debug_marshal(GJS_DEBUG_GFUNCTION,
"Releasing GArgument array out param");
@@ -3469,7 +3467,7 @@ gjs_g_argument_release_out_array (JSContext *context,
param_type,
type_tag,
&elem)) {
- ret = JS_FALSE;
+ ret = false;
}
}
}
diff --git a/gi/arg.h b/gi/arg.h
index 66621ad..92cd92d 100644
--- a/gi/arg.h
+++ b/gi/arg.h
@@ -42,79 +42,79 @@ typedef enum {
GJS_ARGUMENT_ARRAY_ELEMENT
} GjsArgumentType;
-JSBool gjs_value_to_arg (JSContext *context,
- jsval value,
- GIArgInfo *arg_info,
- GArgument *arg);
-
-JSBool gjs_value_to_explicit_array (JSContext *context,
- jsval value,
- GIArgInfo *arg_info,
- GArgument *arg,
- gsize *length_p);
+bool gjs_value_to_arg (JSContext *context,
+ jsval value,
+ GIArgInfo *arg_info,
+ GArgument *arg);
+
+bool gjs_value_to_explicit_array (JSContext *context,
+ jsval value,
+ GIArgInfo *arg_info,
+ GArgument *arg,
+ gsize *length_p);
void gjs_g_argument_init_default (JSContext *context,
GITypeInfo *type_info,
GArgument *arg);
-JSBool gjs_value_to_g_argument (JSContext *context,
- jsval value,
- GITypeInfo *type_info,
- const char *arg_name,
- GjsArgumentType argument_type,
- GITransfer transfer,
- gboolean may_be_null,
- GArgument *arg);
-
-JSBool gjs_value_from_g_argument (JSContext *context,
- jsval *value_p,
- GITypeInfo *type_info,
- GArgument *arg,
- gboolean copy_structs);
-JSBool gjs_value_from_explicit_array (JSContext *context,
- jsval *value_p,
- GITypeInfo *type_info,
- GArgument *arg,
- int length);
-
-JSBool gjs_g_argument_release (JSContext *context,
- GITransfer transfer,
- GITypeInfo *type_info,
- GArgument *arg);
-JSBool gjs_g_argument_release_out_array (JSContext *context,
- GITransfer transfer,
- GITypeInfo *type_info,
- guint length,
- GArgument *arg);
-JSBool gjs_g_argument_release_in_array (JSContext *context,
- GITransfer transfer,
- GITypeInfo *type_info,
- guint length,
- GArgument *arg);
-JSBool gjs_g_argument_release_in_arg (JSContext *context,
+bool gjs_value_to_g_argument (JSContext *context,
+ jsval value,
+ GITypeInfo *type_info,
+ const char *arg_name,
+ GjsArgumentType argument_type,
+ GITransfer transfer,
+ gboolean may_be_null,
+ GArgument *arg);
+
+bool gjs_value_from_g_argument (JSContext *context,
+ jsval *value_p,
+ GITypeInfo *type_info,
+ GArgument *arg,
+ gboolean copy_structs);
+bool gjs_value_from_explicit_array (JSContext *context,
+ jsval *value_p,
+ GITypeInfo *type_info,
+ GArgument *arg,
+ int length);
+
+bool gjs_g_argument_release (JSContext *context,
+ GITransfer transfer,
+ GITypeInfo *type_info,
+ GArgument *arg);
+bool gjs_g_argument_release_out_array (JSContext *context,
+ GITransfer transfer,
+ GITypeInfo *type_info,
+ guint length,
+ GArgument *arg);
+bool gjs_g_argument_release_in_array (JSContext *context,
GITransfer transfer,
GITypeInfo *type_info,
+ guint length,
GArgument *arg);
+bool gjs_g_argument_release_in_arg (JSContext *context,
+ GITransfer transfer,
+ GITypeInfo *type_info,
+ GArgument *arg);
-JSBool _gjs_flags_value_is_valid (JSContext *context,
- GType gtype,
- gint64 value);
+bool _gjs_flags_value_is_valid (JSContext *context,
+ GType gtype,
+ gint64 value);
-JSBool _gjs_enum_value_is_valid (JSContext *context,
- GIEnumInfo *enum_info,
- gint64 value);
+bool _gjs_enum_value_is_valid (JSContext *context,
+ GIEnumInfo *enum_info,
+ gint64 value);
gint64 _gjs_enum_from_int (GIEnumInfo *enum_info,
int int_value);
-JSBool gjs_array_from_strv (JSContext *context,
- jsval *value_p,
- const char **strv);
+bool gjs_array_from_strv (JSContext *context,
+ jsval *value_p,
+ const char **strv);
-JSBool gjs_array_to_strv (JSContext *context,
- jsval array_value,
- unsigned int length,
- void **arr_p);
+bool gjs_array_to_strv (JSContext *context,
+ jsval array_value,
+ unsigned int length,
+ void **arr_p);
G_END_DECLS
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 5de8fa8..4d038c1 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -60,16 +60,16 @@ typedef struct {
static gboolean struct_is_simple(GIStructInfo *info);
-static JSBool boxed_set_field_from_value(JSContext *context,
- Boxed *priv,
- GIFieldInfo *field_info,
- jsval value);
+static bool boxed_set_field_from_value(JSContext *context,
+ Boxed *priv,
+ GIFieldInfo *field_info,
+ jsval value);
extern struct JSClass gjs_boxed_class;
GJS_DEFINE_PRIV_FROM_JS(Boxed, gjs_boxed_class)
-static JSBool
+static bool
gjs_define_static_methods(JSContext *context,
JSObject *constructor,
GType gtype,
@@ -101,7 +101,7 @@ gjs_define_static_methods(JSContext *context,
g_base_info_unref((GIBaseInfo*) meth_info);
}
- return JS_TRUE;
+ return true;
}
/*
@@ -117,7 +117,7 @@ gjs_define_static_methods(JSContext *context,
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
boxed_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -126,10 +126,10 @@ boxed_new_resolve(JSContext *context,
{
Boxed *priv;
char *name;
- JSBool ret = JS_FALSE;
+ bool ret = false;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p",
@@ -183,7 +183,7 @@ boxed_new_resolve(JSContext *context,
* hooks, not this resolve hook.
*/
}
- ret = JS_TRUE;
+ ret = true;
out:
g_free(name);
@@ -193,7 +193,7 @@ boxed_new_resolve(JSContext *context,
/* Check to see if jsval passed in is another Boxed object of the same,
* and if so, retrieves the Boxed private structure for it.
*/
-static JSBool
+static bool
boxed_get_copy_source(JSContext *context,
Boxed *priv,
jsval value,
@@ -202,17 +202,17 @@ boxed_get_copy_source(JSContext *context,
Boxed *source_priv;
if (!JSVAL_IS_OBJECT(value))
- return JS_FALSE;
+ return false;
if (!priv_from_js_with_typecheck(context, JSVAL_TO_OBJECT(value), &source_priv))
- return JS_FALSE;
+ return false;
if (!g_base_info_equal((GIBaseInfo*) priv->info, (GIBaseInfo*) source_priv->info))
- return JS_FALSE;
+ return false;
*source_priv_out = source_priv;
- return JS_TRUE;
+ return true;
}
static void
@@ -255,7 +255,7 @@ get_field_map(GIStructInfo *struct_info)
* properties to set as fieds of the object. We don't require that every field
* of the object be set.
*/
-static JSBool
+static bool
boxed_init_from_props(JSContext *context,
JSObject *obj,
Boxed *priv,
@@ -270,7 +270,7 @@ boxed_init_from_props(JSContext *context,
if (!JSVAL_IS_OBJECT(props_value)) {
gjs_throw(context, "argument should be a hash with fields to set");
- return JS_FALSE;
+ return false;
}
props = JSVAL_TO_OBJECT(props_value);
@@ -278,7 +278,7 @@ boxed_init_from_props(JSContext *context,
iter = JS_NewPropertyIterator(context, props);
if (iter == NULL) {
gjs_throw(context, "Failed to create property iterator for fields hash");
- return JS_FALSE;
+ return false;
}
if (!priv->field_map)
@@ -325,7 +325,7 @@ boxed_init_from_props(JSContext *context,
return success;
}
-static JSBool
+static bool
boxed_invoke_constructor(JSContext *context,
JSObject *obj,
jsid constructor_name,
@@ -338,16 +338,16 @@ boxed_invoke_constructor(JSContext *context,
constructor_const = gjs_context_get_const_string(context, GJS_STRING_CONSTRUCTOR);
if (!gjs_object_require_property(context, obj, NULL, constructor_const, &js_constructor))
- return JS_FALSE;
+ return false;
if (!gjs_object_require_property(context, JSVAL_TO_OBJECT(js_constructor), NULL,
constructor_name, &js_constructor_func))
- return JS_FALSE;
+ return false;
return gjs_call_function_value(context, NULL, js_constructor_func, argc, argv, rval);
}
-static JSBool
+static bool
boxed_new(JSContext *context,
JSObject *obj, /* "this" for constructor */
Boxed *priv,
@@ -383,7 +383,7 @@ boxed_new(JSContext *context,
gjs_throw(context, "Failed to invoke boxed constructor: %s", error->message);
g_clear_error(&error);
g_base_info_unref((GIBaseInfo*) func_info);
- return JS_FALSE;
+ return false;
}
g_base_info_unref((GIBaseInfo*) func_info);
@@ -397,7 +397,7 @@ boxed_new(JSContext *context,
} else if (priv->can_allocate_directly) {
boxed_new_direct(priv);
} else if (priv->default_constructor >= 0) {
- JSBool retval;
+ bool retval;
/* for simplicity, we simply delegate all the work to the actual JS constructor
function (which we retrieve from the JS constructor, that is, Namespace.BoxedType,
@@ -407,18 +407,18 @@ boxed_new(JSContext *context,
} else {
gjs_throw(context, "Unable to construct struct type %s since it has no default constructor and
cannot be allocated directly",
g_base_info_get_name((GIBaseInfo*) priv->info));
- return JS_FALSE;
+ return false;
}
/* If we reach this code, we need to init from a map of fields */
if (argc == 0)
- return JS_TRUE;
+ return true;
if (argc > 1) {
gjs_throw(context, "Constructor with multiple arguments not supported for %s",
g_base_info_get_name((GIBaseInfo *)priv->info));
- return JS_FALSE;
+ return false;
}
return boxed_init_from_props (context, obj, priv, argv[0]);
@@ -432,7 +432,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
JSObject *proto;
Boxed *source_priv;
jsval actual_rval;
- JSBool retval;
+ bool retval;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(boxed);
@@ -457,7 +457,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
if (proto_priv == NULL) {
gjs_debug(GJS_DEBUG_GBOXED,
"Bad prototype set on boxed? Must match JSClass of object. JS error should have been
reported.");
- return JS_FALSE;
+ return false;
}
*priv = *proto_priv;
@@ -471,14 +471,14 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
priv->gboxed = g_boxed_copy(priv->gtype, source_priv->gboxed);
GJS_NATIVE_CONSTRUCTOR_FINISH(boxed);
- return JS_TRUE;
+ return true;
} else if (priv->can_allocate_directly) {
boxed_new_direct (priv);
memcpy(priv->gboxed, source_priv->gboxed,
g_struct_info_get_size (priv->info));
GJS_NATIVE_CONSTRUCTOR_FINISH(boxed);
- return JS_TRUE;
+ return true;
}
}
@@ -575,7 +575,7 @@ get_field_info (JSContext *context,
return NULL;
}
-static JSBool
+static bool
get_nested_interface_object (JSContext *context,
JSObject *parent_obj,
Boxed *parent_priv,
@@ -595,7 +595,7 @@ get_nested_interface_object (JSContext *context,
g_base_info_get_name ((GIBaseInfo *)parent_priv->info),
g_base_info_get_name ((GIBaseInfo *)field_info));
- return JS_FALSE;
+ return false;
}
proto = gjs_lookup_generic_prototype(context, (GIBoxedInfo*) interface_info);
@@ -608,7 +608,7 @@ get_nested_interface_object (JSContext *context,
gjs_get_import_global (context));
if (obj == NULL)
- return JS_FALSE;
+ return false;
GJS_INC_COUNTER(boxed);
priv = g_slice_new0(Boxed);
@@ -629,7 +629,7 @@ get_nested_interface_object (JSContext *context,
OBJECT_TO_JSVAL (parent_obj));
*value = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -646,11 +646,11 @@ boxed_field_getter (JSContext *context,
priv = priv_from_js(context, obj);
if (!priv)
- return JS_FALSE;
+ return false;
field_info = get_field_info(context, priv, id);
if (!field_info)
- return JS_FALSE;
+ return false;
type_info = g_field_info_get_type (field_info);
@@ -702,7 +702,7 @@ out:
return success;
}
-static JSBool
+static bool
set_nested_interface_object (JSContext *context,
Boxed *parent_priv,
GIFieldInfo *field_info,
@@ -720,7 +720,7 @@ set_nested_interface_object (JSContext *context,
g_base_info_get_name ((GIBaseInfo *)parent_priv->info),
g_base_info_get_name ((GIBaseInfo *)field_info));
- return JS_FALSE;
+ return false;
}
proto = gjs_lookup_generic_prototype(context, (GIBoxedInfo*) interface_info);
@@ -732,11 +732,11 @@ set_nested_interface_object (JSContext *context,
if (!boxed_get_copy_source(context, proto_priv, value, &source_priv)) {
JSObject *tmp_object = gjs_construct_object_dynamic(context, proto, 1, &value);
if (!tmp_object)
- return JS_FALSE;
+ return false;
source_priv = priv_from_js(context, tmp_object);
if (!source_priv)
- return JS_FALSE;
+ return false;
}
offset = g_field_info_get_offset (field_info);
@@ -744,10 +744,10 @@ set_nested_interface_object (JSContext *context,
source_priv->gboxed,
g_struct_info_get_size (source_priv->info));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
boxed_set_field_from_value(JSContext *context,
Boxed *priv,
GIFieldInfo *field_info,
@@ -824,10 +824,10 @@ boxed_field_setter (JSContext *context,
priv = priv_from_js(context, obj);
if (!priv)
- return JS_FALSE;
+ return false;
field_info = get_field_info(context, priv, id);
if (!field_info)
- return JS_FALSE;
+ return false;
if (priv->gboxed == NULL) { /* direct access to proto field */
gjs_throw(context, "Can't set field %s.%s on prototype",
@@ -843,7 +843,7 @@ out:
return success;
}
-static JSBool
+static bool
define_boxed_class_fields (JSContext *context,
Boxed *priv,
JSObject *proto)
@@ -885,13 +885,13 @@ define_boxed_class_fields (JSContext *context,
g_base_info_unref ((GIBaseInfo *)field);
if (!result)
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
to_string_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -900,7 +900,7 @@ to_string_func(JSContext *context,
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
Boxed *priv;
- JSBool ret = JS_FALSE;
+ bool ret = false;
jsval retval;
if (!priv_from_js_with_typecheck(context, obj, &priv))
@@ -910,7 +910,7 @@ to_string_func(JSContext *context,
priv->gtype, priv->gboxed, &retval))
goto out;
- ret = JS_TRUE;
+ ret = true;
rec.rval().set(retval);
out:
return ret;
@@ -1267,18 +1267,18 @@ gjs_c_struct_from_boxed(JSContext *context,
return priv->gboxed;
}
-JSBool
+bool
gjs_typecheck_boxed(JSContext *context,
JSObject *object,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw_error)
+ bool throw_error)
{
Boxed *priv;
- JSBool result;
+ bool result;
if (!do_base_typecheck(context, object, throw_error))
- return JS_FALSE;
+ return false;
priv = priv_from_js(context, object);
@@ -1290,7 +1290,7 @@ gjs_typecheck_boxed(JSContext *context,
g_base_info_get_name( (GIBaseInfo*) priv->info));
}
- return JS_FALSE;
+ return false;
}
if (expected_type != G_TYPE_NONE)
@@ -1298,7 +1298,7 @@ gjs_typecheck_boxed(JSContext *context,
else if (expected_info != NULL)
result = g_base_info_equal((GIBaseInfo*) priv->info, (GIBaseInfo*) expected_info);
else
- result = JS_TRUE;
+ result = true;
if (!result && throw_error) {
if (expected_info != NULL) {
diff --git a/gi/boxed.h b/gi/boxed.h
index 65448f7..e5d320f 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -51,11 +51,11 @@ JSObject* gjs_boxed_from_c_struct (JSContext *context,
GIStructInfo *info,
void *gboxed,
GjsBoxedCreationFlags flags);
-JSBool gjs_typecheck_boxed (JSContext *context,
+bool gjs_typecheck_boxed (JSContext *context,
JSObject *obj,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw_error);
+ bool throw_error);
G_END_DECLS
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index 598a11a..e21bf5b 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -61,7 +61,7 @@ gjs_lookup_enumeration(JSContext *context,
return JSVAL_TO_OBJECT(value);
}
-static JSBool
+static bool
gjs_define_enum_value(JSContext *context,
JSObject *in_object,
GIValueInfo *info)
@@ -99,14 +99,14 @@ gjs_define_enum_value(JSContext *context,
gjs_throw(context, "Unable to define enumeration value %s %" G_GINT64_FORMAT " (no memory most
likely)",
fixed_name, value_val);
g_free(fixed_name);
- return JS_FALSE;
+ return false;
}
g_free(fixed_name);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_define_enum_values(JSContext *context,
JSObject *in_object,
GIEnumInfo *info)
@@ -128,7 +128,7 @@ gjs_define_enum_values(JSContext *context,
g_base_info_unref( (GIBaseInfo*) value_info);
if (failed) {
- return JS_FALSE;
+ return false;
}
}
@@ -137,10 +137,10 @@ gjs_define_enum_values(JSContext *context,
JS_DefineProperty(context, in_object, "$gtype", value,
NULL, NULL, JSPROP_PERMANENT);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_define_enum_static_methods(JSContext *context,
JSObject *constructor,
GIEnumInfo *enum_info)
@@ -172,10 +172,10 @@ gjs_define_enum_static_methods(JSContext *context,
g_base_info_unref((GIBaseInfo*) meth_info);
}
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_define_enumeration(JSContext *context,
JSObject *in_object,
GIEnumInfo *info)
@@ -206,7 +206,7 @@ gjs_define_enumeration(JSContext *context,
gjs_get_import_global (context));
if (!gjs_define_enum_values(context, enum_obj, info))
- return JS_FALSE;
+ return false;
gjs_define_enum_static_methods (context, enum_obj, info);
gjs_debug(GJS_DEBUG_GENUM,
@@ -219,8 +219,8 @@ gjs_define_enumeration(JSContext *context,
NULL, NULL,
GJS_MODULE_PROP_FLAGS)) {
gjs_throw(context, "Unable to define enumeration property (no memory most likely)");
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
diff --git a/gi/enumeration.h b/gi/enumeration.h
index 89f6d46..991e18a 100644
--- a/gi/enumeration.h
+++ b/gi/enumeration.h
@@ -32,13 +32,13 @@
G_BEGIN_DECLS
-JSBool gjs_define_enum_values (JSContext *context,
+bool gjs_define_enum_values (JSContext *context,
JSObject *in_object,
GIEnumInfo *info);
-JSBool gjs_define_enum_static_methods(JSContext *context,
- JSObject *constructor,
- GIEnumInfo *enum_info);
-JSBool gjs_define_enumeration (JSContext *context,
+bool gjs_define_enum_static_methods (JSContext *context,
+ JSObject *constructor,
+ GIEnumInfo *enum_info);
+bool gjs_define_enumeration (JSContext *context,
JSObject *in_object,
GIEnumInfo *info);
JSObject* gjs_lookup_enumeration (JSContext *context,
diff --git a/gi/foreign.cpp b/gi/foreign.cpp
index 7e2710a..e2b59d2 100644
--- a/gi/foreign.cpp
+++ b/gi/foreign.cpp
@@ -55,7 +55,7 @@ get_foreign_structs(void)
return foreign_structs_table;
}
-static JSBool
+static bool
gjs_foreign_load_foreign_module(JSContext *context,
const gchar *gi_namespace)
{
@@ -70,7 +70,7 @@ gjs_foreign_load_foreign_module(JSContext *context,
continue;
if (foreign_modules[i].loaded)
- return JS_TRUE;
+ return true;
// FIXME: Find a way to check if a module is imported
// and only execute this statement if isn't
@@ -81,30 +81,30 @@ gjs_foreign_load_foreign_module(JSContext *context,
g_printerr("ERROR: %s\n", error->message);
g_free(script);
g_error_free(error);
- return JS_FALSE;
+ return false;
}
g_free(script);
foreign_modules[i].loaded = TRUE;
- return JS_TRUE;
+ return true;
}
- return JS_FALSE;
+ return false;
}
-JSBool
+bool
gjs_struct_foreign_register(const char *gi_namespace,
const char *type_name,
GjsForeignInfo *info)
{
char *canonical_name;
- g_return_val_if_fail(info != NULL, JS_FALSE);
- g_return_val_if_fail(info->to_func != NULL, JS_FALSE);
- g_return_val_if_fail(info->from_func != NULL, JS_FALSE);
+ g_return_val_if_fail(info != NULL, false);
+ g_return_val_if_fail(info->to_func != NULL, false);
+ g_return_val_if_fail(info->from_func != NULL, false);
canonical_name = g_strdup_printf("%s.%s", gi_namespace, type_name);
g_hash_table_insert(get_foreign_structs(), canonical_name, info);
- return JS_TRUE;
+ return true;
}
static GjsForeignInfo *
@@ -137,7 +137,7 @@ gjs_struct_foreign_lookup(JSContext *context,
return retval;
}
-JSBool
+bool
gjs_struct_foreign_convert_to_g_argument(JSContext *context,
jsval value,
GIBaseInfo *interface_info,
@@ -151,16 +151,16 @@ gjs_struct_foreign_convert_to_g_argument(JSContext *context,
foreign = gjs_struct_foreign_lookup(context, interface_info);
if (!foreign)
- return JS_FALSE;
+ return false;
if (!foreign->to_func(context, value, arg_name,
argument_type, transfer, may_be_null, arg))
- return JS_FALSE;
+ return false;
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_struct_foreign_convert_from_g_argument(JSContext *context,
jsval *value_p,
GIBaseInfo *interface_info,
@@ -170,15 +170,15 @@ gjs_struct_foreign_convert_from_g_argument(JSContext *context,
foreign = gjs_struct_foreign_lookup(context, interface_info);
if (!foreign)
- return JS_FALSE;
+ return false;
if (!foreign->from_func(context, value_p, arg))
- return JS_FALSE;
+ return false;
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_struct_foreign_release_g_argument(JSContext *context,
GITransfer transfer,
GIBaseInfo *interface_info,
@@ -188,14 +188,14 @@ gjs_struct_foreign_release_g_argument(JSContext *context,
foreign = gjs_struct_foreign_lookup(context, interface_info);
if (!foreign)
- return JS_FALSE;
+ return false;
if (!foreign->release_func)
- return JS_TRUE;
+ return true;
if (!foreign->release_func(context, transfer, arg))
- return JS_FALSE;
+ return false;
- return JS_TRUE;
+ return true;
}
diff --git a/gi/foreign.h b/gi/foreign.h
index a4d3cf3..5b0aae3 100644
--- a/gi/foreign.h
+++ b/gi/foreign.h
@@ -28,20 +28,20 @@
#include <gjs/gjs.h>
#include "arg.h"
-typedef JSBool (*GjsArgOverrideToGArgumentFunc) (JSContext *context,
- jsval value,
- const char *arg_name,
- GjsArgumentType argument_type,
- GITransfer transfer,
- gboolean may_be_null,
- GArgument *arg);
+typedef bool (*GjsArgOverrideToGArgumentFunc) (JSContext *context,
+ jsval value,
+ const char *arg_name,
+ GjsArgumentType argument_type,
+ GITransfer transfer,
+ gboolean may_be_null,
+ GArgument *arg);
-typedef JSBool (*GjsArgOverrideFromGArgumentFunc) (JSContext *context,
- jsval *value_p,
- GArgument *arg);
-typedef JSBool (*GjsArgOverrideReleaseGArgumentFunc) (JSContext *context,
- GITransfer transfer,
- GArgument *arg);
+typedef bool (*GjsArgOverrideFromGArgumentFunc) (JSContext *context,
+ jsval *value_p,
+ GArgument *arg);
+typedef bool (*GjsArgOverrideReleaseGArgumentFunc) (JSContext *context,
+ GITransfer transfer,
+ GArgument *arg);
typedef struct {
GjsArgOverrideToGArgumentFunc to_func;
@@ -49,25 +49,25 @@ typedef struct {
GjsArgOverrideReleaseGArgumentFunc release_func;
} GjsForeignInfo;
-JSBool gjs_struct_foreign_register (const char *gi_namespace,
- const char *type_name,
- GjsForeignInfo *info);
+bool gjs_struct_foreign_register (const char *gi_namespace,
+ const char *type_name,
+ GjsForeignInfo *info);
-JSBool gjs_struct_foreign_convert_to_g_argument (JSContext *context,
- jsval value,
- GIBaseInfo *interface_info,
- const char *arg_name,
- GjsArgumentType argument_type,
- GITransfer transfer,
- gboolean may_be_null,
- GArgument *arg);
-JSBool gjs_struct_foreign_convert_from_g_argument (JSContext *context,
- jsval *value_p,
- GIBaseInfo *interface_info,
- GArgument *arg);
-JSBool gjs_struct_foreign_release_g_argument (JSContext *context,
- GITransfer transfer,
- GIBaseInfo *interface_info,
- GArgument *arg);
+bool gjs_struct_foreign_convert_to_g_argument (JSContext *context,
+ jsval value,
+ GIBaseInfo *interface_info,
+ const char *arg_name,
+ GjsArgumentType argument_type,
+ GITransfer transfer,
+ gboolean may_be_null,
+ GArgument *arg);
+bool gjs_struct_foreign_convert_from_g_argument (JSContext *context,
+ jsval *value_p,
+ GIBaseInfo *interface_info,
+ GArgument *arg);
+bool gjs_struct_foreign_release_g_argument (JSContext *context,
+ GITransfer transfer,
+ GIBaseInfo *interface_info,
+ GArgument *arg);
#endif /* __GJS_OVERRIDE_H__ */
diff --git a/gi/function.cpp b/gi/function.cpp
index fd9929c..dfc89a7 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -536,7 +536,7 @@ get_length_from_arg (GArgument *arg, GITypeTag tag)
}
}
-static JSBool
+static bool
gjs_fill_method_instance (JSContext *context,
JSObject *obj,
Function *function,
@@ -552,8 +552,8 @@ gjs_fill_method_instance (JSContext *context,
case GI_INFO_TYPE_BOXED:
/* GError must be special cased */
if (g_type_is_a(gtype, G_TYPE_ERROR)) {
- if (!gjs_typecheck_gerror(context, obj, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_gerror(context, obj, true))
+ return false;
out_arg->v_pointer = gjs_gerror_from_error(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
@@ -568,7 +568,7 @@ gjs_fill_method_instance (JSContext *context,
if (gtype == G_TYPE_NONE) {
gjs_throw(context, "Invalid GType class passed for instance parameter");
- return JS_FALSE;
+ return false;
}
/* We use peek here to simplify reference counting (we just ignore
@@ -584,10 +584,8 @@ gjs_fill_method_instance (JSContext *context,
out_arg->v_pointer = klass;
} else {
- if (!gjs_typecheck_boxed(context, obj,
- container, gtype,
- JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_boxed(context, obj, container, gtype, true))
+ return false;
out_arg->v_pointer = gjs_c_struct_from_boxed(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING) {
@@ -595,16 +593,15 @@ gjs_fill_method_instance (JSContext *context,
out_arg->v_pointer = g_boxed_copy (gtype, out_arg->v_pointer);
else {
gjs_throw (context, "Cannot transfer ownership of instance argument for non boxed
structure");
- return JS_FALSE;
+ return false;
}
}
}
break;
case GI_INFO_TYPE_UNION:
- if (!gjs_typecheck_union(context, obj,
- container, gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_union(context, obj, container, gtype, true))
+ return false;
out_arg->v_pointer = gjs_c_union_from_union(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
@@ -614,34 +611,34 @@ gjs_fill_method_instance (JSContext *context,
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
if (g_type_is_a(gtype, G_TYPE_OBJECT)) {
- if (!gjs_typecheck_object(context, obj, gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_object(context, obj, gtype, true))
+ return false;
out_arg->v_pointer = gjs_g_object_from_object(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
g_object_ref (out_arg->v_pointer);
} else if (g_type_is_a(gtype, G_TYPE_PARAM)) {
- if (!gjs_typecheck_param(context, obj, G_TYPE_PARAM, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_param(context, obj, G_TYPE_PARAM, true))
+ return false;
out_arg->v_pointer = gjs_g_param_from_param(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
g_param_spec_ref ((GParamSpec*) out_arg->v_pointer);
} else if (G_TYPE_IS_INTERFACE(gtype)) {
- if (gjs_typecheck_is_object(context, obj, JS_FALSE)) {
- if (!gjs_typecheck_object(context, obj, gtype, JS_TRUE))
- return JS_FALSE;
+ if (gjs_typecheck_is_object(context, obj, false)) {
+ if (!gjs_typecheck_object(context, obj, gtype, true))
+ return false;
out_arg->v_pointer = gjs_g_object_from_object(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
g_object_ref (out_arg->v_pointer);
} else {
- if (!gjs_typecheck_fundamental(context, obj, gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_fundamental(context, obj, gtype, true))
+ return false;
out_arg->v_pointer = gjs_g_fundamental_from_object(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
gjs_fundamental_ref (context, out_arg->v_pointer);
}
} else if (G_TYPE_IS_INSTANTIATABLE(gtype)) {
- if (!gjs_typecheck_fundamental(context, obj, gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_fundamental(context, obj, gtype, true))
+ return false;
out_arg->v_pointer = gjs_g_fundamental_from_object(context, obj);
if (transfer == GI_TRANSFER_EVERYTHING)
gjs_fundamental_ref (context, out_arg->v_pointer);
@@ -650,7 +647,7 @@ gjs_fill_method_instance (JSContext *context,
"%s.%s is not an object instance neither a fundamental instance of a supported
type",
g_base_info_get_namespace(container),
g_base_info_get_name(container));
- return JS_FALSE;
+ return false;
}
break;
@@ -658,7 +655,7 @@ gjs_fill_method_instance (JSContext *context,
g_assert_not_reached();
}
- return JS_TRUE;
+ return true;
}
/*
@@ -667,7 +664,7 @@ gjs_fill_method_instance (JSContext *context,
* you can decide to keep the return values in #GArgument format by
* providing a @r_value argument.
*/
-static JSBool
+static bool
gjs_invoke_c_function(JSContext *context,
Function *function,
JSObject *obj, /* "this" object */
@@ -750,7 +747,7 @@ gjs_invoke_c_function(JSContext *context,
g_base_info_get_name( (GIBaseInfo*) function->info),
function->expected_js_argc,
js_argc);
- return JS_FALSE;
+ return false;
}
g_callable_info_load_return_type( (GICallableInfo*) function->info, &return_info);
@@ -768,7 +765,7 @@ gjs_invoke_c_function(JSContext *context,
if (is_method) {
if (!gjs_fill_method_instance(context, obj,
function, &in_arg_cvalues[0]))
- return JS_FALSE;
+ return false;
ffi_arg_pointers[0] = &in_arg_cvalues[0];
++c_arg_pos;
}
@@ -1289,11 +1286,11 @@ release:
if (!failed && did_throw_gerror) {
gjs_throw_g_error(context, local_error);
- return JS_FALSE;
+ return false;
} else if (failed) {
- return JS_FALSE;
+ return false;
} else {
- return JS_TRUE;
+ return true;
}
}
@@ -1306,7 +1303,7 @@ function_call(JSContext *context,
JSObject *object = JSVAL_TO_OBJECT(js_argv.thisv());
JSObject *callee = &js_argv.callee();
- JSBool success;
+ bool success;
Function *priv;
jsval retval;
@@ -1317,7 +1314,7 @@ function_call(JSContext *context,
JS_GetTypeName(context, JS_TypeOfValue(context, OBJECT_TO_JSVAL(object))));
if (priv == NULL)
- return JS_TRUE; /* we are the prototype, or have the wrong class */
+ return true; /* we are the prototype, or have the wrong class */
success = gjs_invoke_c_function(context, priv, object, js_argc, js_argv.array(), &retval, NULL);
@@ -1361,7 +1358,7 @@ function_finalize(JSFreeOp *fop,
g_slice_free(Function, priv);
}
-static JSBool
+static bool
get_num_arguments (JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -1376,7 +1373,7 @@ get_num_arguments (JSContext *context,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_FALSE;
+ return false;
n_args = g_callable_info_get_n_args(priv->info);
n_jsargs = 0;
@@ -1394,7 +1391,7 @@ get_num_arguments (JSContext *context,
retval = INT_TO_JSVAL(n_jsargs);
rec.rval().set(retval);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -1407,7 +1404,7 @@ function_to_string (JSContext *context,
gboolean free;
JSObject *self;
jsval retval;
- JSBool ret = JS_FALSE;
+ bool ret = false;
int i, n_args, n_jsargs;
GString *arg_names_str;
gchar *arg_names;
@@ -1417,7 +1414,7 @@ function_to_string (JSContext *context,
if (!self) {
gjs_throw(context, "this cannot be null");
- return JS_FALSE;
+ return false;
}
priv = priv_from_js (context, self);
@@ -1467,7 +1464,7 @@ function_to_string (JSContext *context,
out:
if (gjs_string_from_utf8(context, string, -1, &retval)) {
rec.rval().set(retval);
- ret = JS_TRUE;
+ ret = true;
}
if (free)
@@ -1610,7 +1607,7 @@ init_cached_function_data (JSContext *context,
g_base_info_get_namespace( (GIBaseInfo*) info),
g_base_info_get_name( (GIBaseInfo*) info));
g_base_info_unref(interface_info);
- return JS_FALSE;
+ return false;
}
}
}
@@ -1627,7 +1624,7 @@ init_cached_function_data (JSContext *context,
gjs_throw(context, "Function %s.%s has an array with different-direction length arg,
not supported",
g_base_info_get_namespace( (GIBaseInfo*) info),
g_base_info_get_name( (GIBaseInfo*) info));
- return JS_FALSE;
+ return false;
}
function->param_types[array_length_pos] = PARAM_SKIPPED;
@@ -1657,7 +1654,7 @@ init_cached_function_data (JSContext *context,
g_base_info_ref((GIBaseInfo*) function->info);
- return JS_TRUE;
+ return true;
}
static JSObject*
@@ -1784,7 +1781,7 @@ gjs_define_function(JSContext *context,
}
-JSBool
+bool
gjs_invoke_c_function_uncached (JSContext *context,
GIFunctionInfo *info,
JSObject *obj,
@@ -1793,18 +1790,18 @@ gjs_invoke_c_function_uncached (JSContext *context,
jsval *rval)
{
Function function;
- JSBool result;
+ bool result;
memset (&function, 0, sizeof (Function));
if (!init_cached_function_data (context, &function, 0, info))
- return JS_FALSE;
+ return false;
result = gjs_invoke_c_function (context, &function, obj, argc, argv, rval, NULL);
uninit_cached_function_data (&function);
return result;
}
-JSBool
+bool
gjs_invoke_constructor_from_c (JSContext *context,
JSObject *constructor,
JSObject *obj,
diff --git a/gi/function.h b/gi/function.h
index 24c23f2..2419f22 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -66,14 +66,14 @@ JSObject* gjs_define_function (JSContext *context,
GType gtype,
GICallableInfo *info);
-JSBool gjs_invoke_c_function_uncached (JSContext *context,
+bool gjs_invoke_c_function_uncached (JSContext *context,
GIFunctionInfo *info,
JSObject *obj,
unsigned argc,
jsval *argv,
jsval *rval);
-JSBool gjs_invoke_constructor_from_c (JSContext *context,
+bool gjs_invoke_constructor_from_c (JSContext *context,
JSObject *constructor,
JSObject *obj,
unsigned argc,
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 87b2293..53d5246 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -225,7 +225,7 @@ find_fundamental_constructor(JSContext *context,
/**/
-static JSBool
+static bool
fundamental_instance_new_resolve_interface(JSContext *context,
JS::HandleObject obj,
JS::MutableHandleObject objp,
@@ -233,12 +233,12 @@ fundamental_instance_new_resolve_interface(JSContext *context,
char *name)
{
GIFunctionInfo *method_info;
- JSBool ret;
+ bool ret;
GType *interfaces;
guint n_interfaces;
guint i;
- ret = JS_TRUE;
+ ret = true;
interfaces = g_type_interfaces(proto_priv->gtype, &n_interfaces);
for (i = 0; i < n_interfaces; i++) {
GIBaseInfo *base_info;
@@ -267,7 +267,7 @@ fundamental_instance_new_resolve_interface(JSContext *context,
(GICallableInfo *) method_info)) {
objp.set(obj);
} else {
- ret = JS_FALSE;
+ ret = false;
}
}
@@ -292,7 +292,7 @@ fundamental_instance_new_resolve_interface(JSContext *context,
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
fundamental_instance_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -301,10 +301,10 @@ fundamental_instance_new_resolve(JSContext *context,
{
FundamentalInstance *priv;
char *name;
- JSBool ret = JS_FALSE;
+ bool ret = false;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
gjs_debug_jsprop(GJS_DEBUG_GFUNDAMENTAL,
@@ -339,7 +339,7 @@ fundamental_instance_new_resolve(JSContext *context,
g_base_info_get_namespace((GIBaseInfo *) proto_priv->info),
g_base_info_get_name((GIBaseInfo *) proto_priv->info));
g_base_info_unref((GIBaseInfo *) method_info);
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -373,13 +373,13 @@ fundamental_instance_new_resolve(JSContext *context,
*/
}
- ret = JS_TRUE;
+ ret = true;
out:
g_free(name);
return ret;
}
-static JSBool
+static bool
fundamental_invoke_constructor(FundamentalInstance *priv,
JSContext *context,
JSObject *obj,
@@ -389,7 +389,7 @@ fundamental_invoke_constructor(FundamentalInstance *priv,
{
jsval js_constructor, js_constructor_func;
jsid constructor_const;
- JSBool ret = JS_FALSE;
+ bool ret = false;
constructor_const = gjs_context_get_const_string(context, GJS_STRING_CONSTRUCTOR);
if (!gjs_object_require_property(context, obj, NULL,
@@ -441,7 +441,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(fundamental_instance)
object, priv);
if (!fundamental_invoke_constructor(priv, context, object, argc, argv.array(), &ret_value))
- return JS_FALSE;
+ return false;
associate_js_instance_to_fundamental(context, object, ret_value.v_pointer, FALSE);
@@ -451,11 +451,11 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(fundamental_instance)
g_callable_info_get_caller_owns((GICallableInfo*)
priv->prototype->constructor_info),
&return_info,
&ret_value))
- return JS_FALSE;
+ return false;
GJS_NATIVE_CONSTRUCTOR_FINISH(fundamental_instance);
- return JS_TRUE;
+ return true;
}
static void
@@ -495,7 +495,7 @@ fundamental_finalize(JSFreeOp *fop,
}
}
-static JSBool
+static bool
to_string_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -504,7 +504,7 @@ to_string_func(JSContext *context,
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
FundamentalInstance *priv;
- JSBool ret = JS_FALSE;
+ bool ret = false;
jsval retval;
if (!priv_from_js_with_typecheck(context, obj, &priv))
@@ -528,7 +528,7 @@ to_string_func(JSContext *context,
goto out;
}
- ret = JS_TRUE;
+ ret = true;
rec.rval().set(retval);
out:
return ret;
@@ -640,7 +640,7 @@ gjs_lookup_fundamental_prototype_from_gtype(JSContext *context,
return proto;
}
-JSBool
+bool
gjs_define_fundamental_class(JSContext *context,
JSObject *in_object,
GIObjectInfo *info,
@@ -744,7 +744,7 @@ gjs_define_fundamental_class(JSContext *context,
if (prototype_p)
*prototype_p = prototype;
- return JS_TRUE;
+ return true;
}
JSObject*
@@ -839,25 +839,25 @@ gjs_g_fundamental_from_object(JSContext *context,
return priv->gfundamental;
}
-JSBool
+bool
gjs_typecheck_is_fundamental(JSContext *context,
JSObject *object,
- JSBool throw_error)
+ bool throw_error)
{
return do_base_typecheck(context, object, throw_error);
}
-JSBool
+bool
gjs_typecheck_fundamental(JSContext *context,
JSObject *object,
GType expected_gtype,
- JSBool throw_error)
+ bool throw_error)
{
FundamentalInstance *priv;
- JSBool result;
+ bool result;
if (!do_base_typecheck(context, object, throw_error))
- return JS_FALSE;
+ return false;
priv = priv_from_js(context, object);
g_assert(priv != NULL);
@@ -871,13 +871,13 @@ gjs_typecheck_fundamental(JSContext *context,
proto_priv->info ? g_base_info_get_name((GIBaseInfo *) proto_priv->info) :
g_type_name(proto_priv->gtype));
}
- return JS_FALSE;
+ return false;
}
if (expected_gtype != G_TYPE_NONE)
result = g_type_is_a(priv->prototype->gtype, expected_gtype);
else
- result = JS_TRUE;
+ result = true;
if (!result && throw_error) {
if (priv->prototype->info) {
diff --git a/gi/fundamental.h b/gi/fundamental.h
index 50e1086..5098912 100644
--- a/gi/fundamental.h
+++ b/gi/fundamental.h
@@ -31,7 +31,7 @@
G_BEGIN_DECLS
-JSBool gjs_define_fundamental_class (JSContext *context,
+bool gjs_define_fundamental_class (JSContext *context,
JSObject *in_object,
GIObjectInfo *info,
JSObject **constructor_p,
@@ -44,13 +44,13 @@ void* gjs_g_fundamental_from_object (JSContext *context,
JSObject *gjs_fundamental_from_g_value (JSContext *context,
const GValue *value,
GType gtype);
-JSBool gjs_typecheck_fundamental (JSContext *context,
+bool gjs_typecheck_fundamental (JSContext *context,
JSObject *object,
GType expected_gtype,
- JSBool throw_error);
-JSBool gjs_typecheck_is_fundamental (JSContext *context,
+ bool throw_error);
+bool gjs_typecheck_is_fundamental (JSContext *context,
JSObject *object,
- JSBool throw_error);
+ bool throw_error);
void* gjs_fundamental_ref (JSContext *context,
void *fobj);
void gjs_fundamental_unref (JSContext *context,
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 39786d7..9a69bc2 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -68,7 +68,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
/* Check early to avoid allocating memory for nothing */
if (argc != 1 || !JSVAL_IS_OBJECT(argv[0])) {
gjs_throw(context, "Invalid parameters passed to GError constructor, expected one object");
- return JS_FALSE;
+ return false;
}
GJS_NATIVE_CONSTRUCTOR_PRELUDE(error);
@@ -95,7 +95,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
if (proto_priv == NULL) {
gjs_debug(GJS_DEBUG_GERROR,
"Bad prototype set on GError? Must match JSClass of object. JS error should have been
reported.");
- return JS_FALSE;
+ return false;
}
priv->info = proto_priv->info;
@@ -106,12 +106,12 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
code_name = gjs_context_get_const_string(context, GJS_STRING_CODE);
if (!gjs_object_require_property(context, JSVAL_TO_OBJECT(argv[0]),
"GError constructor", message_name, &v_message))
- return JS_FALSE;
+ return false;
if (!gjs_object_require_property(context, JSVAL_TO_OBJECT(argv[0]),
"GError constructor", code_name, &v_code))
- return JS_FALSE;
+ return false;
if (!gjs_string_to_utf8 (context, v_message, &message))
- return JS_FALSE;
+ return false;
priv->gerror = g_error_new_literal(priv->domain, JSVAL_TO_INT(v_code),
message);
@@ -123,7 +123,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
GJS_NATIVE_CONSTRUCTOR_FINISH(boxed);
- return JS_TRUE;
+ return true;
}
static void
@@ -149,7 +149,7 @@ error_finalize(JSFreeOp *fop,
g_slice_free(Error, priv);
}
-static JSBool
+static bool
error_get_domain(JSContext *context, JS::HandleObject obj,
JS::HandleId id, JS::MutableHandleValue vp)
{
@@ -158,13 +158,13 @@ error_get_domain(JSContext *context, JS::HandleObject obj,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_FALSE;
+ return false;
vp.set(INT_TO_JSVAL(priv->domain));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
error_get_message(JSContext *context, JS::HandleObject obj,
JS::HandleId id, JS::MutableHandleValue vp)
{
@@ -173,18 +173,18 @@ error_get_message(JSContext *context, JS::HandleObject obj,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_FALSE;
+ return false;
if (priv->gerror == NULL) {
/* Object is prototype, not instance */
gjs_throw(context, "Can't get a field from a GError prototype");
- return JS_FALSE;
+ return false;
}
return gjs_string_from_utf8(context, priv->gerror->message, -1, vp.address());
}
-static JSBool
+static bool
error_get_code(JSContext *context, JS::HandleObject obj,
JS::HandleId id, JS::MutableHandleValue vp)
{
@@ -193,19 +193,19 @@ error_get_code(JSContext *context, JS::HandleObject obj,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_FALSE;
+ return false;
if (priv->gerror == NULL) {
/* Object is prototype, not instance */
gjs_throw(context, "Can't get a field from a GError prototype");
- return JS_FALSE;
+ return false;
}
vp.set(INT_TO_JSVAL(priv->gerror->code));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
error_to_string(JSContext *context, unsigned argc, jsval *vp)
{
jsval v_self;
@@ -213,24 +213,24 @@ error_to_string(JSContext *context, unsigned argc, jsval *vp)
Error *priv;
jsval v_out;
gchar *descr;
- JSBool retval;
+ bool retval;
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
v_self = rec.thisv();
if (!JSVAL_IS_OBJECT(v_self)) {
/* Lie a bit here... */
gjs_throw(context, "GLib.Error.prototype.toString() called on a non object");
- return JS_FALSE;
+ return false;
}
self = JSVAL_TO_OBJECT(v_self);
priv = priv_from_js(context, self);
if (priv == NULL)
- return JS_FALSE;
+ return false;
v_out = JSVAL_VOID;
- retval = JS_FALSE;
+ retval = false;
/* We follow the same pattern as standard JS errors, at the expense of
hiding some useful information */
@@ -253,14 +253,14 @@ error_to_string(JSContext *context, unsigned argc, jsval *vp)
}
rec.rval().set(v_out);
- retval = JS_TRUE;
+ retval = true;
out:
g_free(descr);
return retval;
}
-static JSBool
+static bool
error_constructor_value_of(JSContext *context, unsigned argc, jsval *vp)
{
jsval v_self, v_prototype;
@@ -273,7 +273,7 @@ error_constructor_value_of(JSContext *context, unsigned argc, jsval *vp)
if (!JSVAL_IS_OBJECT(v_self)) {
/* Lie a bit here... */
gjs_throw(context, "GLib.Error.valueOf() called on a non object");
- return JS_FALSE;
+ return false;
}
prototype_name = gjs_context_get_const_string(context, GJS_STRING_PROTOTYPE);
@@ -282,18 +282,18 @@ error_constructor_value_of(JSContext *context, unsigned argc, jsval *vp)
"constructor",
prototype_name,
&v_prototype))
- return JS_FALSE;
+ return false;
if (!JSVAL_IS_OBJECT(v_prototype)) {
gjs_throw(context, "GLib.Error.valueOf() called on something that is not"
" a constructor");
- return JS_FALSE;
+ return false;
}
priv = priv_from_js(context, JSVAL_TO_OBJECT(v_prototype));
if (priv == NULL)
- return JS_FALSE;
+ return false;
v_out = INT_TO_JSVAL(priv->domain);
@@ -535,7 +535,7 @@ gjs_gerror_from_error(JSContext *context,
/* If this is a plain GBoxed (i.e. a GError without metadata),
delegate marshalling.
*/
- if (gjs_typecheck_boxed (context, obj, NULL, G_TYPE_ERROR, JS_FALSE))
+ if (gjs_typecheck_boxed (context, obj, NULL, G_TYPE_ERROR, false))
return (GError*) gjs_c_struct_from_boxed (context, obj);
priv = priv_from_js(context, obj);
@@ -554,12 +554,12 @@ gjs_gerror_from_error(JSContext *context,
return priv->gerror;
}
-JSBool
+bool
gjs_typecheck_gerror (JSContext *context,
JSObject *obj,
- JSBool throw_error)
+ bool throw_error)
{
- if (gjs_typecheck_boxed (context, obj, NULL, G_TYPE_ERROR, JS_FALSE))
+ if (gjs_typecheck_boxed (context, obj, NULL, G_TYPE_ERROR, false))
return TRUE;
return do_base_typecheck(context, obj, throw_error);
diff --git a/gi/gerror.h b/gi/gerror.h
index ce25477..38cfa2f 100644
--- a/gi/gerror.h
+++ b/gi/gerror.h
@@ -39,9 +39,9 @@ GError* gjs_gerror_from_error (JSContext *context,
JSObject* gjs_error_from_gerror (JSContext *context,
GError *gerror,
gboolean add_stack);
-JSBool gjs_typecheck_gerror (JSContext *context,
+bool gjs_typecheck_gerror (JSContext *context,
JSObject *obj,
- JSBool throw_error);
+ bool throw_error);
G_END_DECLS
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index a797194..9c3e8c5 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -61,7 +61,7 @@ gjs_gtype_finalize(JSFreeOp *fop,
g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), NULL);
}
-static JSBool
+static bool
to_string_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -71,7 +71,7 @@ to_string_func(JSContext *context,
GType gtype;
gchar *strval;
- JSBool ret;
+ bool ret;
jsval retval;
gtype = GPOINTER_TO_SIZE(priv_from_js(context, obj));
@@ -88,14 +88,14 @@ to_string_func(JSContext *context,
return ret;
}
-static JSBool
+static bool
get_name_func (JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
JS::MutableHandleValue vp)
{
GType gtype;
- JSBool ret;
+ bool ret;
jsval retval;
JS::CallReceiver rec = JS::CallReceiverFromVp(vp.address());
@@ -204,10 +204,10 @@ gjs_gtype_get_actual_gtype (JSContext *context,
return _gjs_gtype_get_actual_gtype(context, object, 2);
}
-JSBool
+bool
gjs_typecheck_gtype (JSContext *context,
JSObject *obj,
- JSBool throw_error)
+ bool throw_error)
{
return do_base_typecheck(context, obj, throw_error);
}
diff --git a/gi/gtype.h b/gi/gtype.h
index bde87ff..8a885e6 100644
--- a/gi/gtype.h
+++ b/gi/gtype.h
@@ -42,9 +42,9 @@ JSObject * gjs_gtype_create_gtype_wrapper (JSContext *context,
GType gjs_gtype_get_actual_gtype (JSContext *context,
JSObject *object);
-JSBool gjs_typecheck_gtype (JSContext *context,
- JSObject *obj,
- JSBool throw_error);
+bool gjs_typecheck_gtype (JSContext *context,
+ JSObject *obj,
+ bool throw_error);
const char *gjs_get_names_from_gtype_and_gi_info(GType gtype,
GIBaseInfo *info,
diff --git a/gi/interface.cpp b/gi/interface.cpp
index 44cc6e5..f0e93b9 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -69,7 +69,7 @@ interface_finalize(JSFreeOp *fop,
g_slice_free(Interface, priv);
}
-static JSBool
+static bool
gjs_define_static_methods(JSContext *context,
JSObject *constructor,
GType gtype,
@@ -101,10 +101,10 @@ gjs_define_static_methods(JSContext *context,
g_base_info_unref((GIBaseInfo*) meth_info);
}
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
interface_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -113,11 +113,11 @@ interface_new_resolve(JSContext *context,
{
Interface *priv;
char *name;
- JSBool ret = JS_FALSE;
+ bool ret = false;
GIFunctionInfo *method_info;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE;
+ return true;
priv = priv_from_js(context, obj);
@@ -128,7 +128,7 @@ interface_new_resolve(JSContext *context,
* from within GJS. In that case, it has no properties that need to be
* resolved from within C code, as interfaces cannot inherit. */
if (priv->info == NULL) {
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -149,7 +149,7 @@ interface_new_resolve(JSContext *context,
g_base_info_unref((GIBaseInfo*)method_info);
}
- ret = JS_TRUE;
+ ret = true;
out:
g_free (name);
@@ -182,7 +182,7 @@ JSFunctionSpec gjs_interface_proto_funcs[] = {
{ NULL }
};
-JSBool
+bool
gjs_define_interface_class(JSContext *context,
JSObject *in_object,
GIInterfaceInfo *info,
@@ -237,10 +237,10 @@ gjs_define_interface_class(JSContext *context,
if (constructor_p)
*constructor_p = constructor;
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_lookup_interface_constructor(JSContext *context,
GType gtype,
jsval *value_p)
@@ -253,7 +253,7 @@ gjs_lookup_interface_constructor(JSContext *context,
if (interface_info == NULL) {
gjs_throw(context, "Cannot expose non introspectable interface %s",
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
g_assert(g_base_info_get_type(interface_info) ==
@@ -261,10 +261,10 @@ gjs_lookup_interface_constructor(JSContext *context,
constructor = gjs_lookup_generic_constructor(context, interface_info);
if (G_UNLIKELY (constructor == NULL))
- return JS_FALSE;
+ return false;
g_base_info_unref(interface_info);
*value_p = OBJECT_TO_JSVAL(constructor);
- return JS_TRUE;
+ return true;
}
diff --git a/gi/interface.h b/gi/interface.h
index 70e71a7..ed36392 100644
--- a/gi/interface.h
+++ b/gi/interface.h
@@ -31,15 +31,15 @@
G_BEGIN_DECLS
-JSBool gjs_define_interface_class (JSContext *context,
- JSObject *in_object,
- GIInterfaceInfo *info,
- GType gtype,
- JSObject **constructor_p);
+bool gjs_define_interface_class (JSContext *context,
+ JSObject *in_object,
+ GIInterfaceInfo *info,
+ GType gtype,
+ JSObject **constructor_p);
-JSBool gjs_lookup_interface_constructor (JSContext *context,
- GType gtype,
- jsval *value_p);
+bool gjs_lookup_interface_constructor (JSContext *context,
+ GType gtype,
+ jsval *value_p);
G_END_DECLS
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 03e5f8f..f33a28a 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -55,7 +55,7 @@ GJS_DEFINE_PRIV_FROM_JS(Ns, gjs_ns_class)
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
ns_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -66,16 +66,16 @@ ns_new_resolve(JSContext *context,
char *name;
GIRepository *repo;
GIBaseInfo *info;
- JSBool ret = JS_FALSE;
+ bool ret = false;
gboolean defined;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
/* let Object.prototype resolve these */
if (strcmp(name, "valueOf") == 0 ||
strcmp(name, "toString") == 0) {
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -85,7 +85,7 @@ ns_new_resolve(JSContext *context,
name, (void *)obj, priv);
if (priv == NULL) {
- ret = JS_TRUE; /* we are the prototype, or have the wrong class */
+ ret = true; /* we are the prototype, or have the wrong class */
goto out;
}
@@ -97,7 +97,7 @@ ns_new_resolve(JSContext *context,
if (info == NULL) {
/* No property defined, but no error either, so return TRUE */
JS_EndRequest(context);
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -111,7 +111,7 @@ ns_new_resolve(JSContext *context,
g_base_info_unref(info);
if (defined)
objp.set(obj); /* we defined the property in this object */
- ret = JS_TRUE;
+ ret = true;
} else {
gjs_debug(GJS_DEBUG_GNAMESPACE,
"Failed to define info '%s'",
@@ -126,7 +126,7 @@ ns_new_resolve(JSContext *context,
return ret;
}
-static JSBool
+static bool
get_name (JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -134,7 +134,7 @@ get_name (JSContext *context,
{
Ns *priv;
jsval retval;
- JSBool ret = JS_FALSE;
+ bool ret = false;
priv = priv_from_js(context, obj);
@@ -143,7 +143,7 @@ get_name (JSContext *context,
if (gjs_string_from_utf8(context, priv->gi_namespace, -1, &retval)) {
*vp = retval;
- ret = JS_TRUE;
+ ret = true;
}
out:
diff --git a/gi/object.cpp b/gi/object.cpp
index 74121f8..7865ac3 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -103,7 +103,7 @@ static void set_js_obj (GObject *gobj,
static void disassociate_js_gobject (GObject *gobj);
static void invalidate_all_signals (ObjectInstance *priv);
typedef enum {
- SOME_ERROR_OCCURRED = JS_FALSE,
+ SOME_ERROR_OCCURRED = false,
NO_SUCH_G_PROPERTY,
VALUE_WAS_SET
} ValueFromPropertyResult;
@@ -248,7 +248,7 @@ proto_priv_from_js(JSContext *context,
}
/* a hook on getting a property; set value_p to override property's value.
- * Return value is JS_FALSE on OOM/exception.
+ * Return value is false on OOM/exception.
*/
static JSBool
object_instance_get_prop(JSContext *context,
@@ -261,10 +261,10 @@ object_instance_get_prop(JSContext *context,
char *gname;
GParamSpec *param;
GValue gvalue = { 0, };
- JSBool ret = JS_TRUE;
+ bool ret = true;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
@@ -307,7 +307,7 @@ object_instance_get_prop(JSContext *context,
&gvalue);
if (!gjs_value_from_g_value(context, value_p.address(), &gvalue)) {
g_value_unset(&gvalue);
- ret = JS_FALSE;
+ ret = false;
goto out;
}
g_value_unset(&gvalue);
@@ -318,7 +318,7 @@ object_instance_get_prop(JSContext *context,
}
/* a hook on setting a property; set value_p to override property value to
- * be set. Return value is JS_FALSE on OOM/exception.
+ * be set. Return value is false on OOM/exception.
*/
static JSBool
object_instance_set_prop(JSContext *context,
@@ -330,10 +330,10 @@ object_instance_set_prop(JSContext *context,
ObjectInstance *priv;
char *name;
GParameter param = { NULL, { 0, }};
- JSBool ret = JS_TRUE;
+ bool ret = true;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
@@ -353,7 +353,7 @@ object_instance_set_prop(JSContext *context,
¶m,
FALSE /* constructing */)) {
case SOME_ERROR_OCCURRED:
- ret = JS_FALSE;
+ ret = false;
case NO_SUCH_G_PROPERTY:
goto out;
case VALUE_WAS_SET:
@@ -436,7 +436,7 @@ find_vfunc_on_parents(GIObjectInfo *info,
return vfunc;
}
-static JSBool
+static bool
object_instance_new_resolve_no_info(JSContext *context,
JS::HandleObject obj,
JS::MutableHandleObject objp,
@@ -444,12 +444,12 @@ object_instance_new_resolve_no_info(JSContext *context,
char *name)
{
GIFunctionInfo *method_info;
- JSBool ret;
+ bool ret;
GType *interfaces;
guint n_interfaces;
guint i;
- ret = JS_TRUE;
+ ret = true;
interfaces = g_type_interfaces(priv->gtype, &n_interfaces);
for (i = 0; i < n_interfaces; i++) {
GIBaseInfo *base_info;
@@ -477,7 +477,7 @@ object_instance_new_resolve_no_info(JSContext *context,
(GICallableInfo *)method_info)) {
objp.set(obj);
} else {
- ret = JS_FALSE;
+ ret = false;
}
}
@@ -502,7 +502,7 @@ object_instance_new_resolve_no_info(JSContext *context,
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
object_instance_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -512,10 +512,10 @@ object_instance_new_resolve(JSContext *context,
GIFunctionInfo *method_info;
ObjectInstance *priv;
char *name;
- JSBool ret = JS_FALSE;
+ bool ret = false;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
@@ -538,12 +538,12 @@ object_instance_new_resolve(JSContext *context,
* will run afterwards will fail because of the "priv == NULL"
* check there.
*/
- ret = JS_TRUE;
+ ret = true;
goto out;
}
if (priv->gobj != NULL) {
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -580,14 +580,14 @@ object_instance_new_resolve(JSContext *context,
* prototypal inheritance take over. */
if (defined_by_parent && is_vfunc_unchanged(vfunc, priv->gtype)) {
g_base_info_unref((GIBaseInfo *)vfunc);
- ret = JS_TRUE;
+ ret = true;
goto out;
}
gjs_define_function(context, obj, priv->gtype, vfunc);
objp.set(obj);
g_base_info_unref((GIBaseInfo *)vfunc);
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -643,7 +643,7 @@ object_instance_new_resolve(JSContext *context,
g_base_info_unref( (GIBaseInfo*) method_info);
}
- ret = JS_TRUE;
+ ret = true;
out:
g_free(name);
return ret;
@@ -664,7 +664,7 @@ free_g_params(GParameter *params,
/* Set properties from args to constructor (argv[0] is supposed to be
* a hash)
*/
-static JSBool
+static bool
object_instance_props_to_g_parameters(JSContext *context,
JSObject *obj,
unsigned argc,
@@ -748,7 +748,7 @@ object_instance_props_to_g_parameters(JSContext *context,
if (gparams_p)
*gparams_p = (GParameter*) g_array_free(gparams, FALSE);
- return JS_TRUE;
+ return true;
free_array_and_fail:
{
@@ -758,7 +758,7 @@ object_instance_props_to_g_parameters(JSContext *context,
to_free = (GParameter*) g_array_free(gparams, FALSE);
free_g_params(to_free, count);
}
- return JS_FALSE;
+ return false;
}
#define DEBUG_DISPOSE 0
@@ -1239,7 +1239,7 @@ disassociate_js_gobject (GObject *gobj)
#endif
}
-static JSBool
+static bool
object_instance_init (JSContext *context,
JSObject **object,
unsigned argc,
@@ -1261,7 +1261,7 @@ object_instance_init (JSContext *context,
if (!object_instance_props_to_g_parameters(context, *object, argc, argv,
gtype,
¶ms, &n_params)) {
- return JS_FALSE;
+ return false;
}
/* Mark this object in the construction stack, it
@@ -1328,13 +1328,13 @@ object_instance_init (JSContext *context,
priv->info ? g_base_info_get_name((GIBaseInfo*) priv->info) :
g_type_name(gtype)));
out:
- return JS_TRUE;
+ return true;
}
GJS_NATIVE_CONSTRUCTOR_DECLARE(object_instance)
{
GJS_NATIVE_CONSTRUCTOR_VARIABLES(object_instance)
- JSBool ret;
+ bool ret;
jsval initer;
jsval rval;
jsid object_init_name;
@@ -1348,7 +1348,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(object_instance)
object_init_name = gjs_context_get_const_string(context, GJS_STRING_GOBJECT_INIT);
if (!gjs_object_require_property(context, object, "GObject instance", object_init_name, &initer))
- return JS_FALSE;
+ return false;
rval = JSVAL_VOID;
ret = gjs_call_function_value(context, object, initer, argc, argv.array(), &rval);
@@ -1557,7 +1557,7 @@ signal_connection_invalidated (gpointer user_data,
g_slice_free(ConnectData, connect_data);
}
-static JSBool
+static bool
real_connect_func(JSContext *context,
unsigned argc,
jsval *vp,
@@ -1574,23 +1574,23 @@ real_connect_func(JSContext *context,
GQuark signal_detail;
jsval retval;
ConnectData *connect_data;
- JSBool ret = JS_FALSE;
+ bool ret = false;
- if (!do_base_typecheck(context, obj, JS_TRUE))
- return JS_FALSE;
+ if (!do_base_typecheck(context, obj, true))
+ return false;
priv = priv_from_js(context, obj);
gjs_debug_gsignal("connect obj %p priv %p argc %d", obj, priv, argc);
if (priv == NULL) {
throw_priv_is_null_error(context);
- return JS_FALSE; /* wrong class passed in */
+ return false; /* wrong class passed in */
}
if (priv->gobj == NULL) {
/* prototype, not an instance. */
gjs_throw(context, "Can't connect to signals on %s.%s.prototype; only on instances",
priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype));
- return JS_FALSE;
+ return false;
}
/* Best I can tell, there is no way to know if argv[1] is really
@@ -1603,11 +1603,11 @@ real_connect_func(JSContext *context,
!JSVAL_IS_STRING(argv[0]) ||
!JSVAL_IS_OBJECT(argv[1])) {
gjs_throw(context, "connect() takes two args, the signal name and the callback");
- return JS_FALSE;
+ return false;
}
if (!gjs_string_to_utf8(context, argv[0], &signal_name)) {
- return JS_FALSE;
+ return false;
}
if (!g_signal_parse_name(signal_name,
@@ -1646,13 +1646,13 @@ real_connect_func(JSContext *context,
argv.rval().set(retval);
- ret = JS_TRUE;
+ ret = true;
out:
g_free(signal_name);
return ret;
}
-static JSBool
+static bool
connect_after_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -1660,7 +1660,7 @@ connect_after_func(JSContext *context,
return real_connect_func(context, argc, vp, TRUE);
}
-static JSBool
+static bool
connect_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -1668,7 +1668,7 @@ connect_func(JSContext *context,
return real_connect_func(context, argc, vp, FALSE);
}
-static JSBool
+static bool
emit_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -1686,17 +1686,17 @@ emit_func(JSContext *context,
unsigned int i;
gboolean failed;
jsval retval;
- JSBool ret = JS_FALSE;
+ bool ret = false;
- if (!do_base_typecheck(context, obj, JS_TRUE))
- return JS_FALSE;
+ if (!do_base_typecheck(context, obj, true))
+ return false;
priv = priv_from_js(context, obj);
gjs_debug_gsignal("emit obj %p priv %p argc %d", obj, priv, argc);
if (priv == NULL) {
throw_priv_is_null_error(context);
- return JS_FALSE; /* wrong class passed in */
+ return false; /* wrong class passed in */
}
if (priv->gobj == NULL) {
@@ -1704,17 +1704,17 @@ emit_func(JSContext *context,
gjs_throw(context, "Can't emit signal on %s.%s.prototype; only on instances",
priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype));
- return JS_FALSE;
+ return false;
}
if (argc < 1 ||
!JSVAL_IS_STRING(argv[0])) {
gjs_throw(context, "emit() first arg is the signal name");
- return JS_FALSE;
+ return false;
}
if (!gjs_string_to_utf8(context, argv[0], &signal_name))
- return JS_FALSE;
+ return false;
if (!g_signal_parse_name(signal_name,
G_OBJECT_TYPE(priv->gobj),
@@ -1792,7 +1792,7 @@ emit_func(JSContext *context,
return ret;
}
-static JSBool
+static bool
to_string_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -1801,10 +1801,10 @@ to_string_func(JSContext *context,
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
ObjectInstance *priv;
- JSBool ret = JS_FALSE;
+ bool ret = false;
jsval retval;
- if (!do_base_typecheck(context, obj, JS_TRUE))
+ if (!do_base_typecheck(context, obj, true))
goto out;
priv = priv_from_js(context, obj);
@@ -1818,7 +1818,7 @@ to_string_func(JSContext *context,
priv->gtype, priv->gobj, &retval))
goto out;
- ret = JS_TRUE;
+ ret = true;
rec.rval().set(retval);
out:
return ret;
@@ -1844,7 +1844,7 @@ struct JSClass gjs_object_instance_class = {
};
-static JSBool
+static bool
init_func (JSContext *context,
unsigned argc,
jsval *vp)
@@ -1852,7 +1852,7 @@ init_func (JSContext *context,
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
- JSBool ret;
+ bool ret;
if (!do_base_typecheck(context, obj, TRUE))
return FALSE;
@@ -1878,7 +1878,7 @@ JSFunctionSpec gjs_object_instance_proto_funcs[] = {
{ NULL }
};
-JSBool
+bool
gjs_object_define_static_methods(JSContext *context,
JSObject *constructor,
GType gtype,
@@ -1915,7 +1915,7 @@ gjs_object_define_static_methods(JSContext *context,
gtype_struct = g_object_info_get_class_struct(object_info);
if (gtype_struct == NULL)
- return JS_TRUE;
+ return true;
n_methods = g_struct_info_get_n_methods(gtype_struct);
@@ -1931,7 +1931,7 @@ gjs_object_define_static_methods(JSContext *context,
}
g_base_info_unref((GIBaseInfo*) gtype_struct);
- return JS_TRUE;
+ return true;
}
void
@@ -2125,25 +2125,25 @@ gjs_g_object_from_object(JSContext *context,
return priv->gobj;
}
-JSBool
+bool
gjs_typecheck_is_object(JSContext *context,
JSObject *object,
- JSBool throw_error)
+ bool throw_error)
{
return do_base_typecheck(context, object, throw_error);
}
-JSBool
+bool
gjs_typecheck_object(JSContext *context,
JSObject *object,
GType expected_type,
- JSBool throw_error)
+ bool throw_error)
{
ObjectInstance *priv;
- JSBool result;
+ bool result;
if (!do_base_typecheck(context, object, throw_error))
- return JS_FALSE;
+ return false;
priv = priv_from_js(context, object);
@@ -2154,7 +2154,7 @@ gjs_typecheck_object(JSContext *context,
"Did you forget to chain-up from _init()?");
}
- return JS_FALSE;
+ return false;
}
if (priv->gobj == NULL) {
@@ -2165,7 +2165,7 @@ gjs_typecheck_object(JSContext *context,
priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) :
g_type_name(priv->gtype));
}
- return JS_FALSE;
+ return false;
}
g_assert(priv->gtype == G_OBJECT_TYPE(priv->gobj));
@@ -2173,7 +2173,7 @@ gjs_typecheck_object(JSContext *context,
if (expected_type != G_TYPE_NONE)
result = g_type_is_a (priv->gtype, expected_type);
else
- result = JS_TRUE;
+ result = true;
if (!result && throw_error) {
if (priv->info) {
@@ -2269,7 +2269,7 @@ find_vfunc_info (JSContext *context,
g_base_info_unref(struct_info);
}
-static JSBool
+static bool
gjs_hook_up_vfunc(JSContext *cx,
unsigned argc,
jsval *vp)
@@ -2290,10 +2290,10 @@ gjs_hook_up_vfunc(JSContext *cx,
"object", &object,
"name", &name,
"function", &function))
- return JS_FALSE;
+ return false;
- if (!do_base_typecheck(cx, object, JS_TRUE))
- return JS_FALSE;
+ if (!do_base_typecheck(cx, object, true))
+ return false;
priv = priv_from_js(cx, object);
gtype = priv->gtype;
@@ -2345,7 +2345,7 @@ gjs_hook_up_vfunc(JSContext *cx,
gjs_throw(cx, "Could not find definition of virtual function %s", name);
g_free(name);
- return JS_FALSE;
+ return false;
}
find_vfunc_info(cx, gtype, vfunc, name, &implementor_vtable, &field_info);
@@ -2377,7 +2377,7 @@ gjs_hook_up_vfunc(JSContext *cx,
g_base_info_unref(vfunc);
g_free(name);
- return JS_TRUE;
+ return true;
}
static gchar *
@@ -2522,7 +2522,7 @@ gjs_object_set_gproperty (GObject *object,
jsobj_set_gproperty(context, js_obj, value, pspec);
}
-static JSBool
+static bool
gjs_override_property(JSContext *cx,
unsigned argc,
jsval *vp)
@@ -2538,12 +2538,12 @@ gjs_override_property(JSContext *cx,
if (!gjs_parse_call_args(cx, "override_property", "so", args,
"name", &name,
"type", &type))
- return JS_FALSE;
+ return false;
if ((gtype = gjs_gtype_get_actual_gtype(cx, type)) == G_TYPE_INVALID) {
gjs_throw(cx, "Invalid parameter type was not a GType");
g_clear_pointer(&name, g_free);
- return JS_FALSE;
+ return false;
}
if (g_type_is_a(gtype, G_TYPE_INTERFACE)) {
@@ -2561,7 +2561,7 @@ gjs_override_property(JSContext *cx,
gjs_throw(cx, "No such property '%s' to override on type '%s'", name,
g_type_name(gtype));
g_clear_pointer(&name, g_free);
- return JS_FALSE;
+ return false;
}
new_pspec = g_param_spec_override(name, pspec);
@@ -2572,7 +2572,7 @@ gjs_override_property(JSContext *cx,
args.rval().setObject(*gjs_param_from_g_param(cx, new_pspec));
g_param_spec_unref(new_pspec);
- return JS_TRUE;
+ return true;
}
static void
@@ -2771,7 +2771,7 @@ save_properties_for_class_init(JSContext *cx,
}
JS::RootedObject prop_obj(cx, &prop_val.toObject());
- if (!gjs_typecheck_param(cx, prop_obj, G_TYPE_NONE, JS_TRUE)) {
+ if (!gjs_typecheck_param(cx, prop_obj, G_TYPE_NONE, true)) {
g_clear_pointer(&properties_native, g_ptr_array_unref);
return FALSE;
}
@@ -2784,7 +2784,7 @@ save_properties_for_class_init(JSContext *cx,
return TRUE;
}
-static JSBool
+static bool
gjs_register_interface(JSContext *cx,
unsigned argc,
jsval *vp)
@@ -2815,12 +2815,12 @@ gjs_register_interface(JSContext *cx,
"name", &name,
"interfaces", &interfaces,
"properties", &properties))
- return JS_FALSE;
+ return false;
if (!validate_interfaces_and_properties_args(cx, interfaces, properties,
&n_interfaces, &n_properties)) {
g_clear_pointer(&name, g_free);
- return JS_FALSE;
+ return false;
}
iface_types = (GType *) g_alloca(sizeof(GType) * n_interfaces);
@@ -2829,13 +2829,13 @@ gjs_register_interface(JSContext *cx,
is caught early, before registering the GType (which we can't undo) */
if (!get_interface_gtypes(cx, interfaces, n_interfaces, iface_types)) {
g_clear_pointer(&name, g_free);
- return JS_FALSE;
+ return false;
}
if (g_type_from_name(name) != G_TYPE_INVALID) {
gjs_throw(cx, "Type name %s is already registered", name);
g_clear_pointer(&name, g_free);
- return JS_FALSE;
+ return false;
}
type_module = G_TYPE_MODULE(gjs_type_module_get());
@@ -2849,21 +2849,21 @@ gjs_register_interface(JSContext *cx,
g_type_set_qdata(interface_type, gjs_is_custom_type_quark(), GINT_TO_POINTER(1));
if (!save_properties_for_class_init(cx, properties, n_properties, interface_type))
- return JS_FALSE;
+ return false;
for (i = 0; i < n_interfaces; i++)
g_type_interface_add_prerequisite(interface_type, iface_types[i]);
/* create a custom JSClass */
if ((module = gjs_lookup_private_namespace(cx)) == NULL)
- return JS_FALSE; /* error will have been thrown already */
+ return false; /* error will have been thrown already */
gjs_define_interface_class(cx, module, NULL, interface_type, &constructor);
args.rval().setObject(*constructor);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_register_type(JSContext *cx,
unsigned argc,
jsval *vp)
@@ -2891,7 +2891,7 @@ gjs_register_type(JSContext *cx,
};
guint32 i, n_interfaces, n_properties;
GType *iface_types;
- JSBool retval = JS_FALSE;
+ bool retval = false;
JS_BeginRequest(cx);
@@ -2906,7 +2906,7 @@ gjs_register_type(JSContext *cx,
if (!parent)
goto out;
- if (!do_base_typecheck(cx, parent, JS_TRUE))
+ if (!do_base_typecheck(cx, parent, true))
goto out;
if (!validate_interfaces_and_properties_args(cx, interfaces, properties,
@@ -2964,7 +2964,7 @@ gjs_register_type(JSContext *cx,
argv.rval().set(OBJECT_TO_JSVAL(constructor));
- retval = JS_TRUE;
+ retval = true;
out:
JS_EndRequest(cx);
@@ -2972,7 +2972,7 @@ out:
return retval;
}
-static JSBool
+static bool
gjs_signal_new(JSContext *cx,
unsigned argc,
jsval *vp)
@@ -2985,21 +2985,21 @@ gjs_signal_new(JSContext *cx,
gint signal_id;
guint i, n_parameters;
GType *params, return_type;
- JSBool ret;
+ bool ret;
if (argc != 6)
- return JS_FALSE;
+ return false;
JS_BeginRequest(cx);
if (!gjs_string_to_utf8(cx, argv[1], &signal_name)) {
- ret = JS_FALSE;
+ ret = false;
goto out;
}
obj = JSVAL_TO_OBJECT(argv[0]);
- if (!gjs_typecheck_gtype(cx, obj, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_gtype(cx, obj, true))
+ return false;
/* we only support standard accumulators for now */
switch (JSVAL_TO_INT(argv[3])) {
@@ -3018,12 +3018,12 @@ gjs_signal_new(JSContext *cx,
if (accumulator == g_signal_accumulator_true_handled && return_type != G_TYPE_BOOLEAN) {
gjs_throw (cx, "GObject.SignalAccumulator.TRUE_HANDLED can only be used with boolean signals");
- ret = JS_FALSE;
+ ret = false;
goto out;
}
if (!JS_GetArrayLength(cx, JSVAL_TO_OBJECT(argv[5]), &n_parameters)) {
- ret = JS_FALSE;
+ ret = false;
goto out;
}
params = g_newa(GType, n_parameters);
@@ -3032,7 +3032,7 @@ gjs_signal_new(JSContext *cx,
if (!JS_GetElement(cx, JSVAL_TO_OBJECT(argv[5]), i, >ype_val) ||
!JSVAL_IS_OBJECT(gtype_val)) {
gjs_throw(cx, "Invalid signal parameter number %d", i);
- ret = JS_FALSE;
+ ret = false;
goto out;
}
@@ -3053,7 +3053,7 @@ gjs_signal_new(JSContext *cx,
params);
argv.rval().set(INT_TO_JSVAL(signal_id));
- ret = JS_TRUE;
+ ret = true;
out:
JS_EndRequest(cx);
@@ -3072,7 +3072,7 @@ static JSFunctionSpec module_funcs[] = {
{ NULL },
};
-JSBool
+bool
gjs_define_private_gi_stuff(JSContext *context,
JSObject **module_out)
{
@@ -3081,14 +3081,14 @@ gjs_define_private_gi_stuff(JSContext *context,
module = JS_NewObject (context, NULL, NULL, NULL);
if (!JS_DefineFunctions(context, module, &module_funcs[0]))
- return JS_FALSE;
+ return false;
*module_out = module;
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_lookup_object_constructor(JSContext *context,
GType gtype,
jsval *value_p)
@@ -3105,11 +3105,11 @@ gjs_lookup_object_constructor(JSContext *context,
constructor = gjs_lookup_object_constructor_from_info(context, object_info, gtype);
if (G_UNLIKELY (constructor == NULL))
- return JS_FALSE;
+ return false;
if (object_info)
g_base_info_unref((GIBaseInfo*)object_info);
*value_p = OBJECT_TO_JSVAL(constructor);
- return JS_TRUE;
+ return true;
}
diff --git a/gi/object.h b/gi/object.h
index c54b2a3..f4d537b 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -35,24 +35,24 @@ void gjs_define_object_class (JSContext *context,
GIObjectInfo *info,
GType gtype,
JSObject **constructor_p);
-JSBool gjs_lookup_object_constructor (JSContext *context,
+bool gjs_lookup_object_constructor (JSContext *context,
GType gtype,
jsval *value_p);
JSObject* gjs_object_from_g_object (JSContext *context,
GObject *gobj);
GObject* gjs_g_object_from_object (JSContext *context,
JSObject *obj);
-JSBool gjs_typecheck_object (JSContext *context,
+bool gjs_typecheck_object (JSContext *context,
JSObject *obj,
GType expected_type,
- JSBool throw_error);
-JSBool gjs_typecheck_is_object (JSContext *context,
+ bool throw_error);
+bool gjs_typecheck_is_object (JSContext *context,
JSObject *obj,
- JSBool throw_error);
+ bool throw_error);
void gjs_object_prepare_shutdown (JSContext *context);
-JSBool gjs_object_define_static_methods(JSContext *context,
+bool gjs_object_define_static_methods(JSContext *context,
JSObject *constructor,
GType gtype,
GIObjectInfo *object_info);
diff --git a/gi/param.cpp b/gi/param.cpp
index 27918b2..4f5b737 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -57,7 +57,7 @@ GJS_DEFINE_PRIV_FROM_JS(Param, gjs_param_class)
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
param_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -68,16 +68,16 @@ param_new_resolve(JSContext *context,
GIFunctionInfo *method_info;
Param *priv;
char *name;
- JSBool ret = JS_FALSE;
+ bool ret = false;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
if (priv != NULL) {
/* instance, not prototype */
- ret = JS_TRUE;
+ ret = true;
goto out;
}
@@ -85,7 +85,7 @@ param_new_resolve(JSContext *context,
method_info = g_object_info_find_method(info, name);
if (method_info == NULL) {
- ret = JS_TRUE;
+ ret = true;
goto out;
}
#if GJS_VERBOSE_ENABLE_GI_USAGE
@@ -107,7 +107,7 @@ param_new_resolve(JSContext *context,
g_base_info_unref( (GIBaseInfo*) method_info);
- ret = JS_TRUE;
+ ret = true;
out:
g_free(name);
if (info != NULL)
@@ -122,7 +122,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(param)
GJS_NATIVE_CONSTRUCTOR_PRELUDE(param);
GJS_INC_COUNTER(param);
GJS_NATIVE_CONSTRUCTOR_FINISH(param);
- return JS_TRUE;
+ return true;
}
static void
@@ -307,17 +307,17 @@ gjs_g_param_from_param(JSContext *context,
return priv->gparam;
}
-JSBool
+bool
gjs_typecheck_param(JSContext *context,
JSObject *object,
GType expected_type,
- JSBool throw_error)
+ bool throw_error)
{
Param *priv;
- JSBool result;
+ bool result;
if (!do_base_typecheck(context, object, throw_error))
- return JS_FALSE;
+ return false;
priv = priv_from_js(context, object);
@@ -328,13 +328,13 @@ gjs_typecheck_param(JSContext *context,
"cannot convert to a GObject.ParamSpec instance");
}
- return JS_FALSE;
+ return false;
}
if (expected_type != G_TYPE_NONE)
result = g_type_is_a (G_TYPE_FROM_INSTANCE (priv->gparam), expected_type);
else
- result = JS_TRUE;
+ result = true;
if (!result && throw_error) {
gjs_throw_custom(context, "TypeError",
diff --git a/gi/param.h b/gi/param.h
index 3de1bb4..b2a952f 100644
--- a/gi/param.h
+++ b/gi/param.h
@@ -36,10 +36,10 @@ GParamSpec* gjs_g_param_from_param (JSContext *context,
JSObject *obj);
JSObject* gjs_param_from_g_param (JSContext *context,
GParamSpec *param);
-JSBool gjs_typecheck_param (JSContext *context,
+bool gjs_typecheck_param (JSContext *context,
JSObject *obj,
GType expected_type,
- JSBool throw_error);
+ bool throw_error);
G_END_DECLS
diff --git a/gi/proxyutils.cpp b/gi/proxyutils.cpp
index b15c4e5..59c101d 100644
--- a/gi/proxyutils.cpp
+++ b/gi/proxyutils.cpp
@@ -31,7 +31,7 @@
* with something that gives us both the introspection name
* and a memory address.
*/
-JSBool
+bool
_gjs_proxy_to_string_func(JSContext *context,
JSObject *this_obj,
const char *objtype,
@@ -41,7 +41,7 @@ _gjs_proxy_to_string_func(JSContext *context,
jsval *rval)
{
GString *buf;
- JSBool ret = JS_FALSE;
+ bool ret = false;
buf = g_string_new("");
g_string_append_c(buf, '[');
@@ -69,7 +69,7 @@ _gjs_proxy_to_string_func(JSContext *context,
if (!gjs_string_from_utf8 (context, buf->str, -1, rval))
goto out;
- ret = JS_TRUE;
+ ret = true;
out:
g_string_free (buf, TRUE);
return ret;
diff --git a/gi/proxyutils.h b/gi/proxyutils.h
index 8ca7643..ec7e702 100644
--- a/gi/proxyutils.h
+++ b/gi/proxyutils.h
@@ -29,13 +29,13 @@
G_BEGIN_DECLS
-JSBool _gjs_proxy_to_string_func(JSContext *context,
- JSObject *this_obj,
- const char *objtype,
- GIBaseInfo *info,
- GType gtype,
- gpointer native_address,
- jsval *ret);
+bool _gjs_proxy_to_string_func (JSContext *context,
+ JSObject *this_obj,
+ const char *objtype,
+ GIBaseInfo *info,
+ GType gtype,
+ gpointer native_address,
+ jsval *ret);
G_END_DECLS
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 7b5b59f..63afb57 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -56,7 +56,7 @@ GJS_DEFINE_PRIV_FROM_JS(Repo, gjs_repo_class)
static JSObject * lookup_override_function(JSContext *, jsid);
-static JSBool
+static bool
get_version_for_ns (JSContext *context,
JSObject *repo_obj,
jsid ns_id,
@@ -71,7 +71,7 @@ get_version_for_ns (JSContext *context,
if (!gjs_object_require_property(context, repo_obj, "GI repository object", versions_name,
&versions_val) ||
!JSVAL_IS_OBJECT(versions_val)) {
gjs_throw(context, "No 'versions' property in GI repository object");
- return JS_FALSE;
+ return false;
}
versions = JSVAL_TO_OBJECT(versions_val);
@@ -82,10 +82,10 @@ get_version_for_ns (JSContext *context,
gjs_string_to_utf8(context, version_val, version);
}
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
resolve_namespace_object(JSContext *context,
JSObject *repo_obj,
jsid ns_id,
@@ -97,7 +97,7 @@ resolve_namespace_object(JSContext *context,
JSObject *override;
jsval result;
JSObject *gi_namespace = NULL;
- JSBool ret = JS_FALSE;
+ bool ret = false;
JS_BeginRequest(context);
@@ -147,7 +147,7 @@ resolve_namespace_object(JSContext *context,
gjs_debug(GJS_DEBUG_GNAMESPACE,
"Defined namespace '%s' %p in GIRepository %p", ns_name, gi_namespace, repo_obj);
- ret = JS_TRUE;
+ ret = true;
gjs_schedule_gc_if_needed(context);
out:
@@ -170,7 +170,7 @@ resolve_namespace_object(JSContext *context,
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
repo_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -179,10 +179,10 @@ repo_new_resolve(JSContext *context,
{
Repo *priv;
char *name;
- JSBool ret = JS_TRUE;
+ bool ret = true;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
/* let Object.prototype resolve these */
if (strcmp(name, "valueOf") == 0 ||
@@ -197,7 +197,7 @@ repo_new_resolve(JSContext *context,
goto out;
if (!resolve_namespace_object(context, obj, id, name)) {
- ret = JS_FALSE;
+ ret = false;
} else {
objp.set(obj); /* store the object we defined the prop in */
}
@@ -340,7 +340,7 @@ repo_new(JSContext *context)
return repo;
}
-JSBool
+bool
gjs_define_repo(JSContext *context,
JSObject **module_out,
const char *name)
@@ -350,10 +350,10 @@ gjs_define_repo(JSContext *context,
repo = repo_new(context);
*module_out = repo;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_define_constant(JSContext *context,
JSObject *in_object,
GIConstantInfo *info)
@@ -362,7 +362,7 @@ gjs_define_constant(JSContext *context,
GArgument garg = { 0, };
GITypeInfo *type_info;
const char *name;
- JSBool ret = JS_FALSE;
+ bool ret = false;
type_info = g_constant_info_get_type(info);
g_constant_info_get_value(info, &garg);
@@ -376,7 +376,7 @@ gjs_define_constant(JSContext *context,
name, value,
NULL, NULL,
GJS_MODULE_PROP_FLAGS))
- ret = JS_TRUE;
+ ret = true;
out:
g_constant_info_free_value (info, &garg);
@@ -450,7 +450,7 @@ _gjs_log_info_usage(GIBaseInfo *info)
}
#endif /* GJS_VERBOSE_ENABLE_GI_USAGE */
-JSBool
+bool
gjs_define_info(JSContext *context,
JSObject *in_object,
GIBaseInfo *info,
@@ -468,7 +468,7 @@ gjs_define_info(JSContext *context,
JSObject *f;
f = gjs_define_function(context, in_object, 0, (GICallableInfo*) info);
if (f == NULL)
- return JS_FALSE;
+ return false;
}
break;
case GI_INFO_TYPE_OBJECT:
@@ -485,13 +485,13 @@ gjs_define_info(JSContext *context,
gjs_throw (context,
"Unsupported fundamental class creation for type %s",
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
} else {
gjs_throw (context,
"Unsupported type %s, deriving from fundamental %s",
g_type_name(gtype), g_type_name(g_type_fundamental(gtype)));
- return JS_FALSE;
+ return false;
}
}
break;
@@ -511,7 +511,7 @@ gjs_define_info(JSContext *context,
break;
case GI_INFO_TYPE_UNION:
if (!gjs_define_union_class(context, in_object, (GIUnionInfo*) info))
- return JS_FALSE;
+ return false;
break;
case GI_INFO_TYPE_ENUM:
if (g_enum_info_get_error_domain((GIEnumInfo*) info)) {
@@ -523,11 +523,11 @@ gjs_define_info(JSContext *context,
case GI_INFO_TYPE_FLAGS:
if (!gjs_define_enumeration(context, in_object, (GIEnumInfo*) info))
- return JS_FALSE;
+ return false;
break;
case GI_INFO_TYPE_CONSTANT:
if (!gjs_define_constant(context, in_object, (GIConstantInfo*) info))
- return JS_FALSE;
+ return false;
break;
case GI_INFO_TYPE_INTERFACE:
gjs_define_interface_class(context, in_object, (GIInterfaceInfo *) info,
@@ -539,10 +539,10 @@ gjs_define_info(JSContext *context,
gjs_info_type_name(g_base_info_get_type(info)),
g_base_info_get_namespace(info),
g_base_info_get_name(info));
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
/* Get the "unknown namespace", which should be used for unnamespaced types */
diff --git a/gi/repo.h b/gi/repo.h
index ad4c7ed..bddab55 100644
--- a/gi/repo.h
+++ b/gi/repo.h
@@ -33,7 +33,7 @@
G_BEGIN_DECLS
-JSBool gjs_define_repo (JSContext *context,
+bool gjs_define_repo (JSContext *context,
JSObject **module_out,
const char *name);
const char* gjs_info_type_name (GIInfoType type);
@@ -48,7 +48,7 @@ JSObject * gjs_lookup_generic_constructor (JSContext *context,
GIBaseInfo *info);
JSObject * gjs_lookup_generic_prototype (JSContext *context,
GIBaseInfo *info);
-JSBool gjs_define_info (JSContext *context,
+bool gjs_define_info (JSContext *context,
JSObject *in_object,
GIBaseInfo *info,
gboolean *defined);
diff --git a/gi/union.cpp b/gi/union.cpp
index 870534c..e5e8581 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -62,7 +62,7 @@ GJS_DEFINE_PRIV_FROM_JS(Union, gjs_union_class)
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
union_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -71,17 +71,17 @@ union_new_resolve(JSContext *context,
{
Union *priv;
char *name;
- JSBool ret = JS_TRUE;
+ bool ret = true;
if (!gjs_get_string_id(context, id, &name))
- return JS_TRUE; /* not resolved, but no error */
+ return true; /* not resolved, but no error */
priv = priv_from_js(context, obj);
gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p",
name, (void *)obj, priv);
if (priv == NULL) {
- ret = JS_FALSE; /* wrong class */
+ ret = false; /* wrong class */
goto out;
}
@@ -114,7 +114,7 @@ union_new_resolve(JSContext *context,
g_registered_type_info_get_g_type(priv->info),
method_info) == NULL) {
g_base_info_unref( (GIBaseInfo*) method_info);
- ret = JS_FALSE;
+ ret = false;
goto out;
}
@@ -219,7 +219,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
if (proto_priv == NULL) {
gjs_debug(GJS_DEBUG_GBOXED,
"Bad prototype set on union? Must match JSClass of object. JS error should have been
reported.");
- return JS_FALSE;
+ return false;
}
priv->info = proto_priv->info;
@@ -234,7 +234,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
gboxed = union_new(context, object, priv->info);
if (gboxed == NULL) {
- return JS_FALSE;
+ return false;
}
/* Because "gboxed" is owned by a jsval and will
@@ -249,7 +249,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
GJS_NATIVE_CONSTRUCTOR_FINISH(union);
- return JS_TRUE;
+ return true;
}
static void
@@ -279,7 +279,7 @@ union_finalize(JSFreeOp *fop,
g_slice_free(Union, priv);
}
-static JSBool
+static bool
to_string_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -288,7 +288,7 @@ to_string_func(JSContext *context,
JSObject *obj = JSVAL_TO_OBJECT(rec.thisv());
Union *priv;
- JSBool ret = JS_FALSE;
+ bool ret = false;
jsval retval;
if (!priv_from_js_with_typecheck(context, obj, &priv))
@@ -298,7 +298,7 @@ to_string_func(JSContext *context,
priv->gtype, priv->gboxed, &retval))
goto out;
- ret = JS_TRUE;
+ ret = true;
rec.rval().set(retval);
out:
return ret;
@@ -334,7 +334,7 @@ JSFunctionSpec gjs_union_proto_funcs[] = {
{ NULL }
};
-JSBool
+bool
gjs_define_union_class(JSContext *context,
JSObject *in_object,
GIUnionInfo *info)
@@ -352,7 +352,7 @@ gjs_define_union_class(JSContext *context,
gtype = g_registered_type_info_get_g_type( (GIRegisteredTypeInfo*) info);
if (gtype == G_TYPE_NONE) {
gjs_throw(context, "Unions must currently be registered as boxed types");
- return JS_FALSE;
+ return false;
}
/* See the comment in gjs_define_object_class() for an
@@ -395,7 +395,7 @@ gjs_define_union_class(JSContext *context,
JS_DefineProperty(context, constructor, "$gtype", value,
NULL, NULL, JSPROP_PERMANENT);
- return JS_TRUE;
+ return true;
}
JSObject*
@@ -455,18 +455,18 @@ gjs_c_union_from_union(JSContext *context,
return priv->gboxed;
}
-JSBool
+bool
gjs_typecheck_union(JSContext *context,
JSObject *object,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw_error)
+ bool throw_error)
{
Union *priv;
- JSBool result;
+ bool result;
if (!do_base_typecheck(context, object, throw_error))
- return JS_FALSE;
+ return false;
priv = priv_from_js(context, object);
@@ -478,7 +478,7 @@ gjs_typecheck_union(JSContext *context,
g_base_info_get_name( (GIBaseInfo*) priv->info));
}
- return JS_FALSE;
+ return false;
}
if (expected_type != G_TYPE_NONE)
@@ -486,7 +486,7 @@ gjs_typecheck_union(JSContext *context,
else if (expected_info != NULL)
result = g_base_info_equal((GIBaseInfo*) priv->info, (GIBaseInfo*) expected_info);
else
- result = JS_TRUE;
+ result = true;
if (!result && throw_error) {
if (expected_info != NULL) {
diff --git a/gi/union.h b/gi/union.h
index bf97ef4..5c3f1be 100644
--- a/gi/union.h
+++ b/gi/union.h
@@ -30,7 +30,7 @@
G_BEGIN_DECLS
-JSBool gjs_define_union_class (JSContext *context,
+bool gjs_define_union_class (JSContext *context,
JSObject *in_object,
GIUnionInfo *info);
void* gjs_c_union_from_union (JSContext *context,
@@ -38,11 +38,11 @@ void* gjs_c_union_from_union (JSContext *context,
JSObject* gjs_union_from_c_union (JSContext *context,
GIUnionInfo *info,
void *gboxed);
-JSBool gjs_typecheck_union (JSContext *context,
+bool gjs_typecheck_union (JSContext *context,
JSObject *obj,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw_error);
+ bool throw_error);
G_END_DECLS
diff --git a/gi/value.cpp b/gi/value.cpp
index 73f3669..8912b1e 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -41,12 +41,12 @@
#include <girepository.h>
-static JSBool gjs_value_from_g_value_internal(JSContext *context,
- jsval *value_p,
- const GValue *gvalue,
- gboolean no_copy,
- GSignalQuery *signal_query,
- gint arg_n);
+static bool gjs_value_from_g_value_internal(JSContext *context,
+ jsval *value_p,
+ const GValue *gvalue,
+ gboolean no_copy,
+ GSignalQuery *signal_query,
+ gint arg_n);
/*
* Gets signal introspection info about closure, or NULL if not found. Currently
@@ -83,7 +83,7 @@ get_signal_info_if_available(GSignalQuery *signal_query)
* Fill in value_p with a JS array, converted from a C array stored as a pointer
* in array_value, with its length stored in array_length_value.
*/
-static JSBool
+static bool
gjs_value_from_array_and_length_values(JSContext *context,
jsval *value_p,
GITypeInfo *array_type_info,
@@ -102,7 +102,7 @@ gjs_value_from_array_and_length_values(JSContext *context,
if (!gjs_value_from_g_value_internal(context, &array_length,
array_length_value, no_copy,
signal_query, array_length_arg_n))
- return JS_FALSE;
+ return false;
array_arg.v_pointer = g_value_get_pointer(array_value);
@@ -243,7 +243,7 @@ closure_marshal(GClosure *closure,
const GValue *gval = ¶m_values[i];
gboolean no_copy;
int array_len_index;
- JSBool res;
+ bool res;
if (skip[i])
continue;
@@ -361,7 +361,7 @@ gjs_value_guess_g_type(JSContext *context,
return G_TYPE_INVALID;
}
-static JSBool
+static bool
gjs_value_to_g_value_internal(JSContext *context,
jsval value,
GValue *gvalue,
@@ -376,7 +376,7 @@ gjs_value_to_g_value_internal(JSContext *context,
if (gtype == G_TYPE_INVALID) {
gjs_throw(context, "Could not guess unspecified GValue type");
- return JS_FALSE;
+ return false;
}
gjs_debug_marshal(GJS_DEBUG_GCLOSURE,
@@ -401,14 +401,14 @@ gjs_value_to_g_value_internal(JSContext *context,
gchar *utf8_string;
if (!gjs_string_to_utf8(context, value, &utf8_string))
- return JS_FALSE;
+ return false;
g_value_take_string(gvalue, utf8_string);
} else {
gjs_throw(context,
"Wrong type %s; string expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_CHAR) {
gint32 i;
@@ -418,7 +418,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; char expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_UCHAR) {
guint16 i;
@@ -428,7 +428,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; unsigned char expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_INT) {
gint32 i;
@@ -438,7 +438,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; integer expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_DOUBLE) {
gdouble d;
@@ -448,7 +448,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; double expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_FLOAT) {
gdouble d;
@@ -458,7 +458,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; float expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_UINT) {
guint32 i;
@@ -468,7 +468,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; unsigned integer expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_BOOLEAN) {
JSBool b;
@@ -483,7 +483,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; boolean expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (g_type_is_a(gtype, G_TYPE_OBJECT) || g_type_is_a(gtype, G_TYPE_INTERFACE)) {
GObject *gobj;
@@ -495,9 +495,8 @@ gjs_value_to_g_value_internal(JSContext *context,
JSObject *obj;
obj = JSVAL_TO_OBJECT(value);
- if (!gjs_typecheck_object(context, obj,
- gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_object(context, obj, gtype, true))
+ return false;
gobj = gjs_g_object_from_object(context, obj);
} else {
@@ -505,7 +504,7 @@ gjs_value_to_g_value_internal(JSContext *context,
"Wrong type %s; object %s expected",
gjs_get_type_name(value),
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
g_value_set_object(gvalue, gobj);
@@ -529,7 +528,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; strv expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
} else {
void *result;
char **strv;
@@ -537,7 +536,7 @@ gjs_value_to_g_value_internal(JSContext *context,
if (!gjs_array_to_strv (context,
value,
length, &result))
- return JS_FALSE;
+ return false;
/* cast to strv in a separate step to avoid type-punning */
strv = (char**) result;
g_value_take_boxed (gvalue, strv);
@@ -546,7 +545,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; strv expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else if (g_type_is_a(gtype, G_TYPE_BOXED)) {
void *gboxed;
@@ -560,8 +559,8 @@ gjs_value_to_g_value_internal(JSContext *context,
if (g_type_is_a(gtype, G_TYPE_ERROR)) {
/* special case GError */
- if (!gjs_typecheck_gerror(context, obj, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_gerror(context, obj, true))
+ return false;
gboxed = gjs_gerror_from_error(context, obj);
} else {
@@ -596,13 +595,11 @@ gjs_value_to_g_value_internal(JSContext *context,
loading the typelib.
*/
if (!gboxed) {
- if (gjs_typecheck_union(context, obj,
- NULL, gtype, JS_FALSE)) {
+ if (gjs_typecheck_union(context, obj, NULL, gtype, false)) {
gboxed = gjs_c_union_from_union(context, obj);
} else {
- if (!gjs_typecheck_boxed(context, obj,
- NULL, gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_boxed(context, obj, NULL, gtype, true))
+ return false;
gboxed = gjs_c_struct_from_boxed(context, obj);
}
@@ -613,7 +610,7 @@ gjs_value_to_g_value_internal(JSContext *context,
"Wrong type %s; boxed type %s expected",
gjs_get_type_name(value),
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
if (no_copy)
@@ -628,9 +625,8 @@ gjs_value_to_g_value_internal(JSContext *context,
} else if (JSVAL_IS_OBJECT(value)) {
JSObject *obj = JSVAL_TO_OBJECT(value);
- if (!gjs_typecheck_boxed(context, obj,
- NULL, G_TYPE_VARIANT, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_boxed(context, obj, NULL, G_TYPE_VARIANT, true))
+ return false;
variant = (GVariant*) gjs_c_struct_from_boxed(context, obj);
} else {
@@ -638,7 +634,7 @@ gjs_value_to_g_value_internal(JSContext *context,
"Wrong type %s; boxed type %s expected",
gjs_get_type_name(value),
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
g_value_set_variant (gvalue, variant);
@@ -657,7 +653,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"%d is not a valid value for enumeration %s",
JSVAL_TO_INT(value), g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
g_value_set_enum(gvalue, v->value);
@@ -666,14 +662,14 @@ gjs_value_to_g_value_internal(JSContext *context,
"Wrong type %s; enum %s expected",
gjs_get_type_name(value),
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
} else if (g_type_is_a(gtype, G_TYPE_FLAGS)) {
gint64 value_int64;
if (gjs_value_to_int64 (context, value, &value_int64)) {
if (!_gjs_flags_value_is_valid(context, gtype, value_int64))
- return JS_FALSE;
+ return false;
/* See arg.c:_gjs_enum_to_int() */
g_value_set_flags(gvalue, (int)value_int64);
@@ -682,7 +678,7 @@ gjs_value_to_g_value_internal(JSContext *context,
"Wrong type %s; flags %s expected",
gjs_get_type_name(value),
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
} else if (g_type_is_a(gtype, G_TYPE_PARAM)) {
void *gparam;
@@ -694,8 +690,8 @@ gjs_value_to_g_value_internal(JSContext *context,
JSObject *obj;
obj = JSVAL_TO_OBJECT(value);
- if (!gjs_typecheck_param(context, obj, gtype, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_param(context, obj, gtype, true))
+ return false;
gparam = gjs_g_param_from_param(context, obj);
} else {
@@ -703,7 +699,7 @@ gjs_value_to_g_value_internal(JSContext *context,
"Wrong type %s; param type %s expected",
gjs_get_type_name(value),
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
g_value_set_param(gvalue, (GParamSpec*) gparam);
@@ -713,7 +709,7 @@ gjs_value_to_g_value_internal(JSContext *context,
if (!JSVAL_IS_OBJECT(value)) {
gjs_throw(context, "Wrong type %s; expect a GType object",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
type = gjs_gtype_get_actual_gtype(context, JSVAL_TO_OBJECT(value));
@@ -724,7 +720,7 @@ gjs_value_to_g_value_internal(JSContext *context,
} else {
gjs_throw(context,
"Cannot convert non-null JS value to G_POINTER");
- return JS_FALSE;
+ return false;
}
} else if (JSVAL_IS_NUMBER(value) &&
g_value_type_transformable(G_TYPE_INT, gtype)) {
@@ -742,7 +738,7 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Wrong type %s; integer expected",
gjs_get_type_name(value));
- return JS_FALSE;
+ return false;
}
} else {
gjs_debug(GJS_DEBUG_GCLOSURE, "jsval is number %d gtype fundamental %d transformable to int %d from
int %d",
@@ -754,13 +750,13 @@ gjs_value_to_g_value_internal(JSContext *context,
gjs_throw(context,
"Don't know how to convert JavaScript object to GType %s",
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_value_to_g_value(JSContext *context,
jsval value,
GValue *gvalue)
@@ -768,7 +764,7 @@ gjs_value_to_g_value(JSContext *context,
return gjs_value_to_g_value_internal(context, value, gvalue, FALSE);
}
-JSBool
+bool
gjs_value_to_g_value_no_copy(JSContext *context,
jsval value,
GValue *gvalue)
@@ -776,7 +772,7 @@ gjs_value_to_g_value_no_copy(JSContext *context,
return gjs_value_to_g_value_internal(context, value, gvalue, TRUE);
}
-static JSBool
+static bool
convert_int_to_enum (JSContext *context,
jsval *value_p,
GType gtype,
@@ -802,7 +798,7 @@ convert_int_to_enum (JSContext *context,
return JS_NewNumberValue(context, v_double, value_p);
}
-static JSBool
+static bool
gjs_value_from_g_value_internal(JSContext *context,
jsval *value_p,
const GValue *gvalue,
@@ -827,7 +823,7 @@ gjs_value_from_g_value_internal(JSContext *context,
*value_p = JSVAL_NULL;
} else {
if (!gjs_string_from_utf8(context, v, -1, value_p))
- return JS_FALSE;
+ return false;
}
} else if (gtype == G_TYPE_CHAR) {
char v;
@@ -870,7 +866,7 @@ gjs_value_from_g_value_internal(JSContext *context,
value_p,
(const char**) g_value_get_boxed (gvalue))) {
gjs_throw(context, "Failed to convert strv to array");
- return JS_FALSE;
+ return false;
}
} else if (g_type_is_a(gtype, G_TYPE_HASH_TABLE) ||
g_type_is_a(gtype, G_TYPE_ARRAY) ||
@@ -878,7 +874,7 @@ gjs_value_from_g_value_internal(JSContext *context,
g_type_is_a(gtype, G_TYPE_PTR_ARRAY)) {
gjs_throw(context,
"Unable to introspect element-type of container in GValue");
- return JS_FALSE;
+ return false;
} else if (g_type_is_a(gtype, G_TYPE_BOXED) ||
g_type_is_a(gtype, G_TYPE_VARIANT)) {
GjsBoxedCreationFlags boxed_flags;
@@ -908,12 +904,12 @@ gjs_value_from_g_value_internal(JSContext *context,
gjs_throw(context,
"No introspection information found for %s",
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
if (g_base_info_get_type(info) == GI_INFO_TYPE_STRUCT &&
g_struct_info_is_foreign((GIStructInfo*)info)) {
- JSBool ret;
+ bool ret;
GIArgument arg;
arg.v_pointer = gboxed;
ret = gjs_struct_foreign_convert_from_g_argument(context, value_p, info, &arg);
@@ -937,7 +933,7 @@ gjs_value_from_g_value_internal(JSContext *context,
g_base_info_get_type(info),
g_type_name(gtype));
g_base_info_unref(info);
- return JS_FALSE;
+ return false;
}
*value_p = OBJECT_TO_JSVAL(obj);
@@ -953,7 +949,7 @@ gjs_value_from_g_value_internal(JSContext *context,
obj = gjs_param_from_g_param(context, gparam);
*value_p = OBJECT_TO_JSVAL(obj);
} else if (signal_query && g_type_is_a(gtype, G_TYPE_POINTER)) {
- JSBool res;
+ bool res;
GArgument arg;
GIArgInfo *arg_info;
GIBaseInfo *obj;
@@ -964,7 +960,7 @@ gjs_value_from_g_value_internal(JSContext *context,
if (!obj) {
gjs_throw(context, "Signal argument with GType %s isn't introspectable",
g_type_name(signal_query->itype));
- return JS_FALSE;
+ return false;
}
signal_info = g_object_info_find_signal((GIObjectInfo*)obj, signal_query->signal_name);
@@ -972,7 +968,7 @@ gjs_value_from_g_value_internal(JSContext *context,
if (!signal_info) {
gjs_throw(context, "Unknown signal.");
g_base_info_unref((GIBaseInfo*)obj);
- return JS_FALSE;
+ return false;
}
arg_info = g_callable_info_get_arg(signal_info, arg_n - 1);
g_arg_info_load_type(arg_info, &type_info);
@@ -999,7 +995,7 @@ gjs_value_from_g_value_internal(JSContext *context,
} else {
gjs_throw(context,
"Can't convert non-null pointer to JS value");
- return JS_FALSE;
+ return false;
}
} else if (g_value_type_transformable(gtype, G_TYPE_DOUBLE)) {
GValue double_value = { 0, };
@@ -1021,20 +1017,20 @@ gjs_value_from_g_value_internal(JSContext *context,
JSObject *obj;
obj = gjs_fundamental_from_g_value(context, (const GValue*)gvalue, gtype);
if (obj == NULL)
- return JS_FALSE;
+ return false;
else
*value_p = OBJECT_TO_JSVAL(obj);
} else {
gjs_throw(context,
"Don't know how to convert GType %s to JavaScript object",
g_type_name(gtype));
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_value_from_g_value(JSContext *context,
jsval *value_p,
const GValue *gvalue)
diff --git a/gi/value.h b/gi/value.h
index 00bbb3e..f4682fb 100644
--- a/gi/value.h
+++ b/gi/value.h
@@ -29,13 +29,13 @@
G_BEGIN_DECLS
-JSBool gjs_value_to_g_value (JSContext *context,
+bool gjs_value_to_g_value (JSContext *context,
jsval value,
GValue *gvalue);
-JSBool gjs_value_to_g_value_no_copy (JSContext *context,
+bool gjs_value_to_g_value_no_copy (JSContext *context,
jsval value,
GValue *gvalue);
-JSBool gjs_value_from_g_value (JSContext *context,
+bool gjs_value_from_g_value (JSContext *context,
jsval *value_p,
const GValue *gvalue);
GClosure* gjs_closure_new_marshaled (JSContext *context,
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index b543fa5..881c79b 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -39,14 +39,14 @@ typedef struct {
extern struct JSClass gjs_byte_array_class;
GJS_DEFINE_PRIV_FROM_JS(ByteArrayInstance, gjs_byte_array_class)
-static JSBool byte_array_get_prop (JSContext *context,
+static bool byte_array_get_prop (JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
JS::MutableHandleValue value_p);
-static JSBool byte_array_set_prop (JSContext *context,
+static bool byte_array_set_prop (JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
- JSBool strict,
+ bool strict,
JS::MutableHandleValue value_p);
GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array);
static void byte_array_finalize (JSFreeOp *fop,
@@ -70,22 +70,22 @@ struct JSClass gjs_byte_array_class = {
NULL, NULL, NULL
};
-JSBool
+bool
gjs_typecheck_bytearray(JSContext *context,
JSObject *object,
- JSBool throw_error)
+ bool throw_error)
{
return do_base_typecheck(context, object, throw_error);
}
-static JSBool
+static bool
gjs_value_from_gsize(JSContext *context,
gsize v,
JS::MutableHandleValue value_p)
{
if (v > (gsize) JSVAL_INT_MAX) {
value_p.set(INT_TO_JSVAL(v));
- return JS_TRUE;
+ return true;
} else {
return JS_NewNumberValue(context, v, value_p.address());
}
@@ -113,7 +113,7 @@ byte_array_ensure_gbytes (ByteArrayInstance *priv)
}
}
-static JSBool
+static bool
gjs_value_to_gsize(JSContext *context,
jsval value,
gsize *v_p)
@@ -130,12 +130,12 @@ gjs_value_to_gsize(JSContext *context,
if (i < 0) {
gjs_throw(context, "Negative length or index %d is not allowed for ByteArray",
i);
- return JS_FALSE;
+ return false;
}
*v_p = i;
- return JS_TRUE;
+ return true;
} else {
- JSBool ret;
+ bool ret;
/* This is pretty liberal (it converts about anything to
* a number) but it's what we use elsewhere in gjs too.
*/
@@ -147,7 +147,7 @@ gjs_value_to_gsize(JSContext *context,
}
}
-static JSBool
+static bool
gjs_value_to_byte(JSContext *context,
jsval value,
guint8 *v_p)
@@ -155,20 +155,20 @@ gjs_value_to_byte(JSContext *context,
gsize v;
if (!gjs_value_to_gsize(context, value, &v))
- return JS_FALSE;
+ return false;
if (v >= 256) {
gjs_throw(context,
"Value %" G_GSIZE_FORMAT " is not a valid byte; must be in range [0,255]",
v);
- return JS_FALSE;
+ return false;
}
*v_p = v;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
byte_array_get_index(JSContext *context,
JS::HandleObject obj,
ByteArrayInstance *priv,
@@ -185,18 +185,18 @@ byte_array_get_index(JSContext *context,
"Index %" G_GSIZE_FORMAT " is out of range for ByteArray length %lu",
idx,
(unsigned long)len);
- return JS_FALSE;
+ return false;
}
value_p.set(INT_TO_JSVAL(data[idx]));
- return JS_TRUE;
+ return true;
}
/* a hook on getting a property; set value_p to override property's value.
- * Return value is JS_FALSE on OOM/exception.
+ * Return value is false on OOM/exception.
*/
-static JSBool
+static bool
byte_array_get_prop(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -208,16 +208,16 @@ byte_array_get_prop(JSContext *context,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_TRUE; /* prototype, not an instance. */
+ return true; /* prototype, not an instance. */
if (!JS_IdToValue(context, id, &id_value))
- return JS_FALSE;
+ return false;
/* First handle array indexing */
if (JSVAL_IS_NUMBER(id_value)) {
gsize idx;
if (!gjs_value_to_gsize(context, id_value, &idx))
- return JS_FALSE;
+ return false;
return byte_array_get_index(context, obj, priv, idx, value_p);
}
@@ -225,10 +225,10 @@ byte_array_get_prop(JSContext *context,
* allow string versions of ints for the index, we don't bother.
*/
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
byte_array_length_getter(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -240,7 +240,7 @@ byte_array_length_getter(JSContext *context,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_TRUE; /* prototype, not an instance. */
+ return true; /* prototype, not an instance. */
if (priv->array != NULL)
len = priv->array->len;
@@ -249,11 +249,11 @@ byte_array_length_getter(JSContext *context,
return gjs_value_from_gsize(context, len, value_p);
}
-static JSBool
+static bool
byte_array_length_setter(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
- JSBool strict,
+ bool strict,
JS::MutableHandleValue value_p)
{
ByteArrayInstance *priv;
@@ -262,20 +262,20 @@ byte_array_length_setter(JSContext *context,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_TRUE; /* prototype, not instance */
+ return true; /* prototype, not instance */
byte_array_ensure_array(priv);
if (!gjs_value_to_gsize(context, value_p, &len)) {
gjs_throw(context,
"Can't set ByteArray length to non-integer");
- return JS_FALSE;
+ return false;
}
g_byte_array_set_size(priv->array, len);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
byte_array_set_index(JSContext *context,
JS::HandleObject obj,
ByteArrayInstance *priv,
@@ -285,7 +285,7 @@ byte_array_set_index(JSContext *context,
guint8 v;
if (!gjs_value_to_byte(context, value_p, &v)) {
- return JS_FALSE;
+ return false;
}
byte_array_ensure_array(priv);
@@ -301,17 +301,17 @@ byte_array_set_index(JSContext *context,
/* Stop JS from storing a copy of the value */
value_p.set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
/* a hook on setting a property; set value_p to override property value to
- * be set. Return value is JS_FALSE on OOM/exception.
+ * be set. Return value is false on OOM/exception.
*/
-static JSBool
+static bool
byte_array_set_prop(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
- JSBool strict,
+ bool strict,
JS::MutableHandleValue value_p)
{
ByteArrayInstance *priv;
@@ -320,23 +320,23 @@ byte_array_set_prop(JSContext *context,
priv = priv_from_js(context, obj);
if (priv == NULL)
- return JS_TRUE; /* prototype, not an instance. */
+ return true; /* prototype, not an instance. */
if (!JS_IdToValue(context, id, &id_value))
- return JS_FALSE;
+ return false;
/* First handle array indexing */
if (JSVAL_IS_NUMBER(id_value)) {
gsize idx;
if (!gjs_value_to_gsize(context, id_value, &idx))
- return JS_FALSE;
+ return false;
return byte_array_set_index(context, obj, priv, idx, value_p);
}
/* We don't special-case anything else for now */
- return JS_TRUE;
+ return true;
}
static GByteArray *
@@ -375,7 +375,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array)
if (!gjs_value_to_gsize(context, argv[0], &preallocated_length)) {
gjs_throw(context,
"Argument to ByteArray constructor should be a positive number for array length");
- return JS_FALSE;
+ return false;
}
}
@@ -386,7 +386,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array)
GJS_NATIVE_CONSTRUCTOR_FINISH(byte_array);
- return JS_TRUE;
+ return true;
}
static void
@@ -411,7 +411,7 @@ byte_array_finalize(JSFreeOp *fop,
}
/* implement toString() with an optional encoding arg */
-static JSBool
+static bool
to_string_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -426,14 +426,14 @@ to_string_func(JSContext *context,
priv = priv_from_js(context, object);
if (priv == NULL)
- return JS_TRUE; /* prototype, not instance */
+ return true; /* prototype, not instance */
byte_array_ensure_array(priv);
if (argc >= 1 &&
JSVAL_IS_STRING(argv[0])) {
if (!gjs_string_to_utf8(context, argv[0], &encoding))
- return JS_FALSE;
+ return false;
/* maybe we should be smarter about utf8 synonyms here.
* doesn't matter much though. encoding_is_utf8 is
@@ -461,7 +461,7 @@ to_string_func(JSContext *context,
* libmozjs hardwired utf8-to-utf16
*/
jsval retval;
- JSBool ok;
+ bool ok;
ok = gjs_string_from_utf8(context,
data,
@@ -471,7 +471,7 @@ to_string_func(JSContext *context,
argv.rval().set(retval);
return ok;
} else {
- JSBool ok = JS_FALSE;
+ bool ok = false;
gsize bytes_written;
GError *error;
JSString *s;
@@ -489,7 +489,7 @@ to_string_func(JSContext *context,
if (u16_str == NULL) {
/* frees the GError */
gjs_throw_g_error(context, error);
- return JS_FALSE;
+ return false;
}
/* bytes_written should be bytes in a UTF-16 string so
@@ -501,7 +501,7 @@ to_string_func(JSContext *context,
(jschar*) u16_str,
bytes_written / 2);
if (s != NULL) {
- ok = JS_TRUE;
+ ok = true;
argv.rval().set(STRING_TO_JSVAL(s));
}
@@ -510,7 +510,7 @@ to_string_func(JSContext *context,
}
}
-static JSBool
+static bool
to_gbytes_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -523,8 +523,8 @@ to_gbytes_func(JSContext *context,
priv = priv_from_js(context, object);
if (priv == NULL)
- return JS_TRUE; /* prototype, not instance */
-
+ return true; /* prototype, not instance */
+
byte_array_ensure_gbytes(priv);
gbytes_info = g_irepository_find_by_gtype(NULL, G_TYPE_BYTES);
@@ -532,7 +532,7 @@ to_gbytes_func(JSContext *context,
priv->bytes, GJS_BOXED_CREATION_NONE);
rec.rval().set(OBJECT_TO_JSVAL(ret_bytes_obj));
- return JS_TRUE;
+ return true;
}
/* Ensure that the module and class objects exists, and that in turn
@@ -583,11 +583,11 @@ from_string_func(JSContext *context,
char *encoding;
gboolean encoding_is_utf8;
JSObject *obj;
- JSBool retval = JS_FALSE;
+ bool retval = false;
obj = byte_array_new(context);
if (obj == NULL)
- return JS_FALSE;
+ return false;
JS_AddObjectRoot(context, &obj);
@@ -671,7 +671,7 @@ from_string_func(JSContext *context,
argv.rval().set(OBJECT_TO_JSVAL(obj));
- retval = JS_TRUE;
+ retval = true;
out:
JS_RemoveObjectRoot(context, &obj);
return retval;
@@ -688,11 +688,11 @@ from_array_func(JSContext *context,
guint32 len;
guint32 i;
JSObject *obj;
- JSBool ret = JS_FALSE;
+ bool ret = false;
obj = byte_array_new(context);
if (obj == NULL)
- return JS_FALSE;
+ return false;
JS_AddObjectRoot(context, &obj);
@@ -738,7 +738,7 @@ from_array_func(JSContext *context,
g_array_index(priv->array, guint8, i) = b;
}
- ret = JS_TRUE;
+ ret = true;
argv.rval().set(OBJECT_TO_JSVAL(obj));
out:
JS_RemoveObjectRoot(context, &obj);
@@ -755,26 +755,26 @@ from_gbytes_func(JSContext *context,
GBytes *gbytes;
ByteArrayInstance *priv;
JSObject *obj;
- JSBool ret = JS_FALSE;
+ bool ret = false;
if (!gjs_parse_call_args(context, "overrides_gbytes_to_array", "o", argv,
"bytes", &bytes_obj))
- return JS_FALSE;
+ return false;
if (!gjs_typecheck_boxed(context, bytes_obj, NULL, G_TYPE_BYTES, TRUE))
- return JS_FALSE;
+ return false;
gbytes = (GBytes*) gjs_c_struct_from_boxed(context, bytes_obj);
obj = byte_array_new(context);
if (obj == NULL)
- return JS_FALSE;
+ return false;
priv = priv_from_js(context, obj);
g_assert (priv != NULL);
priv->bytes = g_bytes_ref(gbytes);
- ret = JS_TRUE;
+ ret = true;
argv.rval().set(OBJECT_TO_JSVAL(obj));
return ret;
}
@@ -906,7 +906,7 @@ static JSFunctionSpec gjs_byte_array_module_funcs[] = {
{ NULL }
};
-JSBool
+bool
gjs_define_byte_array_stuff(JSContext *context,
JSObject **module_out)
{
@@ -926,12 +926,12 @@ gjs_define_byte_array_stuff(JSContext *context,
NULL);
if (!JS_DefineFunctions(context, module, &gjs_byte_array_module_funcs[0]))
- return JS_FALSE;
+ return false;
g_assert(JSVAL_IS_VOID(gjs_get_global_slot(context, GJS_GLOBAL_SLOT_BYTE_ARRAY_PROTOTYPE)));
gjs_set_global_slot(context, GJS_GLOBAL_SLOT_BYTE_ARRAY_PROTOTYPE,
OBJECT_TO_JSVAL(prototype));
*module_out = module;
- return JS_TRUE;
+ return true;
}
diff --git a/gjs/byteArray.h b/gjs/byteArray.h
index bc186ed..a276811 100644
--- a/gjs/byteArray.h
+++ b/gjs/byteArray.h
@@ -33,11 +33,11 @@
G_BEGIN_DECLS
-JSBool gjs_typecheck_bytearray (JSContext *context,
+bool gjs_typecheck_bytearray (JSContext *context,
JSObject *obj,
- JSBool throw_error);
+ bool throw_error);
-JSBool gjs_define_byte_array_stuff (JSContext *context,
+bool gjs_define_byte_array_stuff (JSContext *context,
JSObject **module_out);
JSObject * gjs_byte_array_from_byte_array (JSContext *context,
diff --git a/gjs/compat.h b/gjs/compat.h
index 236ce60..cda36c3 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -53,12 +53,10 @@ G_BEGIN_DECLS
#define JS_GetGlobalObject(cx) gjs_get_global_object(cx)
-static JSBool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
+static bool G_GNUC_UNUSED JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
{
*rval = JS_NumberValue(d);
- if (JSVAL_IS_NUMBER(*rval))
- return JS_TRUE;
- return JS_FALSE;
+ return JSVAL_IS_NUMBER(*rval);
}
/**
@@ -88,11 +86,11 @@ gjs_##name##_constructor(JSContext *context, \
{ \
if (!JS_IsConstructing(context, vp)) { \
gjs_throw_constructor_error(context); \
- return JS_FALSE; \
+ return false; \
} \
object = gjs_new_object_for_constructor(context, &gjs_##name##_class, vp); \
if (object == NULL) \
- return JS_FALSE; \
+ return false; \
}
/**
@@ -113,7 +111,7 @@ gjs_##name##_constructor(JSContext *context, \
GJS_NATIVE_CONSTRUCTOR_DECLARE(name) \
{ \
gjs_throw_abstract_constructor_error(context, vp); \
- return JS_FALSE; \
+ return false; \
}
G_END_DECLS
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 19120c4..e120622 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -114,7 +114,7 @@ gjs_log(JSContext *context,
if (argc != 1) {
gjs_throw(context, "Must pass a single argument to log()");
- return JS_FALSE;
+ return false;
}
JS_BeginRequest(context);
@@ -130,12 +130,12 @@ gjs_log(JSContext *context,
if (jstr == NULL) {
g_message("JS LOG: <cannot convert value to string>");
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
}
if (!gjs_string_to_utf8(context, STRING_TO_JSVAL(jstr), &s)) {
JS_EndRequest(context);
- return JS_FALSE;
+ return false;
}
g_message("JS LOG: %s", s);
@@ -143,7 +143,7 @@ gjs_log(JSContext *context,
JS_EndRequest(context);
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -158,7 +158,7 @@ gjs_log_error(JSContext *context,
if ((argc != 1 && argc != 2) ||
!JSVAL_IS_OBJECT (argv[0])) {
gjs_throw(context, "Must pass an exception and optionally a message to logError()");
- return JS_FALSE;
+ return false;
}
JS_BeginRequest(context);
@@ -179,10 +179,10 @@ gjs_log_error(JSContext *context,
JS_EndRequest(context);
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
gjs_print_parse_args(JSContext *context,
JS::CallArgs &argv,
char **buffer)
@@ -212,7 +212,7 @@ gjs_print_parse_args(JSContext *context,
if (!gjs_string_to_utf8(context, STRING_TO_JSVAL(jstr), &s)) {
JS_EndRequest(context);
g_string_free(str, TRUE);
- return JS_FALSE;
+ return false;
}
g_string_append(str, s);
@@ -224,14 +224,14 @@ gjs_print_parse_args(JSContext *context,
*buffer = g_string_free(str, TRUE);
if (!*buffer)
*buffer = g_strdup("<invalid string>");
- return JS_TRUE;
+ return true;
}
}
*buffer = g_string_free(str, FALSE);
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -250,7 +250,7 @@ gjs_print(JSContext *context,
g_free(buffer);
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -269,7 +269,7 @@ gjs_printerr(JSContext *context,
g_free(buffer);
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static void
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index ffefcfc..352242d 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -592,7 +592,7 @@ get_functions_for(JSContext *context,
static void
init_covered_branch(GjsCoverageBranch *branch,
unsigned int point,
- JSBool was_hit,
+ bool was_hit,
GArray *exits)
{
branch->point = point;
@@ -687,7 +687,7 @@ convert_and_insert_branch_info(GArray *array,
branch_point = JSVAL_TO_INT(branch_point_value);
jsval was_hit_value;
- JSBool was_hit;
+ bool was_hit;
if (!JS_GetProperty(context, object, "hit", &was_hit_value) ||
!JSVAL_IS_BOOLEAN(was_hit_value)) {
@@ -1194,7 +1194,7 @@ gjs_write_cache_to_path(const char *path,
return TRUE;
}
-static JSBool
+static bool
coverage_statistics_has_stale_cache(GjsCoverage *coverage)
{
GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
@@ -1358,7 +1358,7 @@ coverage_log(JSContext *context,
if (argc != 1) {
gjs_throw(context, "Must pass a single argument to log()");
- return JS_FALSE;
+ return false;
}
JSAutoRequest ar(context);
@@ -1366,7 +1366,7 @@ coverage_log(JSContext *context,
if (!g_getenv("GJS_SHOW_COVERAGE_MESSAGES")) {
_suppressed_coverage_messages_count++;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
/* JS_ValueToString might throw, in which we will only
@@ -1379,18 +1379,18 @@ coverage_log(JSContext *context,
if (jstr == NULL) {
g_message("JS LOG: <cannot convert value to string>");
- return JS_TRUE;
+ return true;
}
if (!gjs_string_to_utf8(context, STRING_TO_JSVAL(jstr), &s)) {
- return JS_FALSE;
+ return false;
}
g_message("JS COVERAGE MESSAGE: %s", s);
g_free(s);
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static char *
@@ -1429,7 +1429,7 @@ coverage_get_file_modification_time(JSContext *context,
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JSRuntime *runtime = JS_GetRuntime(context);
GTimeVal mtime;
- JSBool ret = JS_FALSE;
+ bool ret = false;
char *filename = get_filename_from_filename_as_js_string(context, args);
if (!filename)
@@ -1447,7 +1447,7 @@ coverage_get_file_modification_time(JSContext *context,
args.rval().setNull();
}
- ret = JS_TRUE;
+ ret = true;
out:
g_free(filename);
@@ -1462,17 +1462,16 @@ coverage_get_file_checksum(JSContext *context,
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JSRuntime *runtime = JS_GetRuntime(context);
GTimeVal mtime;
- JSBool ret = JS_FALSE;
char *filename = get_filename_from_filename_as_js_string(context, args);
if (!filename)
- return JS_FALSE;
+ return false;
char *checksum = gjs_get_path_checksum(filename);
if (!checksum) {
gjs_throw(context, "Failed to read %s and get its checksum", filename);
- return JS_FALSE;
+ return false;
}
JS::RootedString rooted_checksum(runtime, JS_NewStringCopyZ(context,
@@ -1481,7 +1480,7 @@ coverage_get_file_checksum(JSContext *context,
g_free(filename);
g_free(checksum);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -1489,7 +1488,7 @@ coverage_get_file_contents(JSContext *context,
unsigned argc,
jsval *vp)
{
- JSBool ret = JS_FALSE;
+ bool ret = false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
char *filename = NULL;
GFile *file = NULL;
@@ -1515,7 +1514,7 @@ coverage_get_file_contents(JSContext *context,
}
args.rval().setString(JS_NewStringCopyN(context, script, script_len));
- ret = JS_TRUE;
+ ret = true;
out:
g_clear_error(&error);
diff --git a/gjs/gi.cpp b/gjs/gi.cpp
index 6ff4847..a960f01 100644
--- a/gjs/gi.cpp
+++ b/gjs/gi.cpp
@@ -31,7 +31,7 @@
#include "gjs/compat.h"
#include "gi/repo.h"
-JSBool
+bool
gjs_define_gi_stuff(JSContext *context,
JSObject **module_out)
{
diff --git a/gjs/gi.h b/gjs/gi.h
index 837d03d..44df221 100644
--- a/gjs/gi.h
+++ b/gjs/gi.h
@@ -30,9 +30,9 @@
G_BEGIN_DECLS
-JSBool gjs_define_gi_stuff (JSContext *context,
+bool gjs_define_gi_stuff (JSContext *context,
JSObject **module_out);
-JSBool gjs_define_private_gi_stuff (JSContext *context,
+bool gjs_define_private_gi_stuff (JSContext *context,
JSObject **module_out);
G_END_DECLS
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index d5c4c90..d3cf464 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -51,7 +51,7 @@ extern struct JSClass gjs_importer_class;
GJS_DEFINE_PRIV_FROM_JS(Importer, gjs_importer_class)
-static JSBool
+static bool
define_meta_properties(JSContext *context,
JSObject *module_obj,
const char *full_path,
@@ -77,7 +77,7 @@ define_meta_properties(JSContext *context,
* this symbol to any other object for example.
*/
JSPROP_READONLY | JSPROP_PERMANENT))
- return JS_FALSE;
+ return false;
}
if (!JS_DefineProperty(context, module_obj,
@@ -90,7 +90,7 @@ define_meta_properties(JSContext *context,
* this symbol to any other object for example.
*/
JSPROP_READONLY | JSPROP_PERMANENT))
- return JS_FALSE;
+ return false;
if (!JS_DefineProperty(context, module_obj,
"__parentModule__",
@@ -100,12 +100,12 @@ define_meta_properties(JSContext *context,
* this symbol to any other object for example.
*/
JSPROP_READONLY | JSPROP_PERMANENT))
- return JS_FALSE;
+ return false;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
import_directory(JSContext *context,
JSObject *obj,
const char *name,
@@ -122,13 +122,10 @@ import_directory(JSContext *context,
* this always succeeds.
*/
importer = gjs_define_importer(context, obj, name, full_paths, FALSE);
- if (importer == NULL)
- return JS_FALSE;
-
- return JS_TRUE;
+ return importer != NULL;
}
-static JSBool
+static bool
define_import(JSContext *context,
JSObject *obj,
JSObject *module_obj,
@@ -141,16 +138,16 @@ define_import(JSContext *context,
gjs_debug(GJS_DEBUG_IMPORTER,
"Failed to define '%s' in importer",
name);
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
/* Make the property we set in define_import permament;
* we do this after the import succesfully completes.
*/
-static JSBool
+static bool
seal_import(JSContext *context,
JSObject *obj,
const char *name)
@@ -163,7 +160,7 @@ seal_import(JSContext *context,
gjs_debug(GJS_DEBUG_IMPORTER,
"Failed to get attributes to seal '%s' in importer",
name);
- return JS_FALSE;
+ return false;
}
attrs |= JSPROP_PERMANENT;
@@ -173,10 +170,10 @@ seal_import(JSContext *context,
gjs_debug(GJS_DEBUG_IMPORTER,
"Failed to set attributes to seal '%s' in importer",
name);
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
/* An import failed. Delete the property pointing to the import
@@ -213,13 +210,13 @@ cancel_import(JSContext *context,
}
}
-static JSBool
+static bool
import_native_file(JSContext *context,
JSObject *obj,
const char *name)
{
JSObject *module_obj;
- JSBool retval = JS_FALSE;
+ bool retval = false;
gjs_debug(GJS_DEBUG_IMPORTER, "Importing '%s'", name);
@@ -243,7 +240,7 @@ import_native_file(JSContext *context,
NULL, NULL, GJS_MODULE_PROP_FLAGS))
goto out;
- retval = JS_TRUE;
+ retval = true;
out:
return retval;
@@ -255,13 +252,13 @@ create_module_object(JSContext *context)
return JS_NewObject(context, NULL, NULL, NULL);
}
-static JSBool
+static bool
import_file(JSContext *context,
const char *name,
GFile *file,
JSObject *module_obj)
{
- JSBool ret = JS_FALSE;
+ bool ret = false;
char *script = NULL;
char *full_path = NULL;
gsize script_len = 0;
@@ -289,7 +286,7 @@ import_file(JSContext *context,
full_path, NULL))
goto out;
- ret = JS_TRUE;
+ ret = true;
out:
g_free(script);
@@ -376,14 +373,14 @@ load_module_elements(JSContext *context,
}
}
-static JSBool
+static bool
import_file_on_module(JSContext *context,
JSObject *obj,
const char *name,
GFile *file)
{
JSObject *module_obj;
- JSBool retval = JS_FALSE;
+ bool retval = false;
char *full_path = NULL;
module_obj = create_module_object (context);
@@ -401,7 +398,7 @@ import_file_on_module(JSContext *context,
if (!seal_import(context, obj, name))
goto out;
- retval = JS_TRUE;
+ retval = true;
out:
if (!retval)
@@ -411,7 +408,7 @@ import_file_on_module(JSContext *context,
return retval;
}
-static JSBool
+static bool
do_import(JSContext *context,
JSObject *obj,
Importer *priv,
@@ -425,7 +422,7 @@ do_import(JSContext *context,
JSObject *module_obj = NULL;
guint32 search_path_len;
guint32 i;
- JSBool result;
+ bool result;
GPtrArray *directories;
jsid search_path_name;
GFile *gfile;
@@ -433,27 +430,27 @@ do_import(JSContext *context,
search_path_name = gjs_context_get_const_string(context, GJS_STRING_SEARCH_PATH);
if (!gjs_object_require_property(context, obj, "importer", search_path_name, &search_path_val)) {
- return JS_FALSE;
+ return false;
}
if (!JSVAL_IS_OBJECT(search_path_val)) {
gjs_throw(context, "searchPath property on importer is not an object");
- return JS_FALSE;
+ return false;
}
search_path = JSVAL_TO_OBJECT(search_path_val);
if (!JS_IsArrayObject(context, search_path)) {
gjs_throw(context, "searchPath property on importer is not an array");
- return JS_FALSE;
+ return false;
}
if (!JS_GetArrayLength(context, search_path, &search_path_len)) {
gjs_throw(context, "searchPath array has no length");
- return JS_FALSE;
+ return false;
}
- result = JS_FALSE;
+ result = false;
filename = g_strdup_printf("%s.js", name);
full_path = NULL;
@@ -465,7 +462,7 @@ do_import(JSContext *context,
import_native_file(context, obj, name)) {
gjs_debug(GJS_DEBUG_IMPORTER,
"successfully imported module '%s'", name);
- result = JS_TRUE;
+ result = true;
goto out;
}
@@ -517,7 +514,7 @@ do_import(JSContext *context,
name, obj_val,
NULL, NULL,
GJS_MODULE_PROP_FLAGS & ~JSPROP_PERMANENT)) {
- result = JS_TRUE;
+ result = true;
goto out;
}
}
@@ -573,7 +570,7 @@ do_import(JSContext *context,
if (import_file_on_module (context, obj, name, gfile)) {
gjs_debug(GJS_DEBUG_IMPORTER,
"successfully imported module '%s'", name);
- result = JS_TRUE;
+ result = true;
}
g_object_unref(gfile);
@@ -593,7 +590,7 @@ do_import(JSContext *context,
(const char**) directories->pdata)) {
gjs_debug(GJS_DEBUG_IMPORTER,
"successfully imported directory '%s'", name);
- result = JS_TRUE;
+ result = true;
}
}
@@ -660,7 +657,7 @@ importer_iterator_free(ImporterIterator *iter)
* then on its prototype.
*
*/
-static JSBool
+static bool
importer_new_enumerate(JSContext *context,
JS::HandleObject object,
JSIterateOp enum_op,
@@ -687,27 +684,27 @@ importer_new_enumerate(JSContext *context,
if (!priv)
/* we are enumerating the prototype properties */
- return JS_TRUE;
+ return true;
search_path_name = gjs_context_get_const_string(context, GJS_STRING_SEARCH_PATH);
if (!gjs_object_require_property(context, object, "importer", search_path_name, &search_path_val))
- return JS_FALSE;
+ return false;
if (!JSVAL_IS_OBJECT(search_path_val)) {
gjs_throw(context, "searchPath property on importer is not an object");
- return JS_FALSE;
+ return false;
}
search_path = JSVAL_TO_OBJECT(search_path_val);
if (!JS_IsArrayObject(context, search_path)) {
gjs_throw(context, "searchPath property on importer is not an array");
- return JS_FALSE;
+ return false;
}
if (!JS_GetArrayLength(context, search_path, &search_path_len)) {
gjs_throw(context, "searchPath array has no length");
- return JS_FALSE;
+ return false;
}
iter = importer_iterator_new();
@@ -725,7 +722,7 @@ importer_new_enumerate(JSContext *context,
* means no element found
*/
importer_iterator_free(iter);
- return JS_FALSE;
+ return false;
}
if (JSVAL_IS_VOID(elem))
@@ -734,12 +731,12 @@ importer_new_enumerate(JSContext *context,
if (!JSVAL_IS_STRING(elem)) {
gjs_throw(context, "importer searchPath contains non-string");
importer_iterator_free(iter);
- return JS_FALSE;
+ return false;
}
if (!gjs_string_to_utf8(context, elem, &dirname)) {
importer_iterator_free(iter);
- return JS_FALSE; /* Error message already set */
+ return false; /* Error message already set */
}
init_path = g_build_filename(dirname, MODULE_INIT_FILENAME,
@@ -797,7 +794,7 @@ importer_new_enumerate(JSContext *context,
jsval element_val;
if (JSVAL_IS_NULL(statep)) /* Iterating prototype */
- return JS_TRUE;
+ return true;
iter = (ImporterIterator*) JSVAL_TO_PRIVATE(statep);
@@ -807,11 +804,11 @@ importer_new_enumerate(JSContext *context,
iter->index++),
-1,
&element_val))
- return JS_FALSE;
+ return false;
jsid id;
if (!JS_ValueToId(context, element_val, &id))
- return JS_FALSE;
+ return false;
idp.set(id);
break;
@@ -830,7 +827,7 @@ importer_new_enumerate(JSContext *context,
}
}
- return JS_TRUE;
+ return true;
}
/*
@@ -846,7 +843,7 @@ importer_new_enumerate(JSContext *context,
* was not resolved; and non-null, referring to obj or one of its prototypes,
* if id was resolved.
*/
-static JSBool
+static bool
importer_new_resolve(JSContext *context,
JS::HandleObject obj,
JS::HandleId id,
@@ -855,15 +852,15 @@ importer_new_resolve(JSContext *context,
{
Importer *priv;
char *name;
- JSBool ret = JS_TRUE;
+ bool ret = true;
jsid module_init_name;
module_init_name = gjs_context_get_const_string(context, GJS_STRING_MODULE_INIT);
if (id == module_init_name)
- return JS_TRUE;
+ return true;
if (!gjs_get_string_id(context, id, &name))
- return JS_FALSE;
+ return false;
/* let Object.prototype resolve these */
if (strcmp(name, "valueOf") == 0 ||
@@ -881,7 +878,7 @@ importer_new_resolve(JSContext *context,
if (do_import(context, obj, priv, name)) {
objp.set(obj);
} else {
- ret = JS_FALSE;
+ ret = false;
}
JS_EndRequest(context);
@@ -1117,7 +1114,7 @@ gjs_define_importer(JSContext *context,
* would basically be a bug, but checking for that is a lot of code so
* we just ignore all calls after the first and hope the args are the same.
*/
-JSBool
+bool
gjs_create_root_importer(JSContext *context,
const char **initial_search_path,
gboolean add_standard_search_path)
@@ -1133,7 +1130,7 @@ gjs_create_root_importer(JSContext *context,
"Someone else already created root importer, ignoring second request");
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
}
importer = OBJECT_TO_JSVAL(gjs_create_importer(context, "imports",
@@ -1143,18 +1140,18 @@ gjs_create_root_importer(JSContext *context,
gjs_set_global_slot(context, GJS_GLOBAL_SLOT_IMPORTS, importer);
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_define_root_importer_object(JSContext *context,
JS::HandleObject in_object,
JS::HandleObject root_importer)
{
- JSBool success;
+ bool success;
jsid imports_name;
- success = JS_FALSE;
+ success = false;
JS_BeginRequest(context);
JS::RootedValue importer (JS_GetRuntime(context),
@@ -1169,13 +1166,13 @@ gjs_define_root_importer_object(JSContext *context,
goto fail;
}
- success = JS_TRUE;
+ success = true;
fail:
JS_EndRequest(context);
return success;
}
-JSBool
+bool
gjs_define_root_importer(JSContext *context,
JSObject *in_object)
{
diff --git a/gjs/importer.h b/gjs/importer.h
index e49fe96..dc3bf4b 100644
--- a/gjs/importer.h
+++ b/gjs/importer.h
@@ -33,12 +33,12 @@
G_BEGIN_DECLS
-JSBool gjs_create_root_importer (JSContext *context,
+bool gjs_create_root_importer (JSContext *context,
const char **initial_search_path,
gboolean add_standard_search_path);
-JSBool gjs_define_root_importer (JSContext *context,
+bool gjs_define_root_importer (JSContext *context,
JSObject *in_object);
-JSBool gjs_define_root_importer_object(JSContext *context,
+bool gjs_define_root_importer_object(JSContext *context,
JS::HandleObject in_object,
JS::HandleObject root_importer);
JSObject* gjs_define_importer (JSContext *context,
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index d7cfe2e..d390f6a 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -61,7 +61,7 @@ gjs_new_object_for_constructor(JSContext *context,
JSVAL_TO_OBJECT(prototype), parent);
}
-JSBool
+bool
gjs_init_class_dynamic(JSContext *context,
JSObject *in_object,
JSObject *parent_proto,
@@ -84,7 +84,7 @@ gjs_init_class_dynamic(JSContext *context,
JSObject * volatile constructor;
JSFunction * volatile constructor_fun;
char *full_function_name = NULL;
- JSBool res = JS_FALSE;
+ bool res = false;
/* Without a name, JS_NewObject fails */
g_assert (clasp->name != NULL);
@@ -153,7 +153,7 @@ gjs_init_class_dynamic(JSContext *context,
if (prototype_p)
*prototype_p = prototype;
- res = JS_TRUE;
+ res = true;
prototype = NULL;
constructor_fun = NULL;
@@ -175,11 +175,11 @@ format_dynamic_class_name (const char *name)
return name;
}
-JSBool
+bool
gjs_typecheck_instance(JSContext *context,
JSObject *obj,
JSClass *static_clasp,
- JSBool throw_error)
+ bool throw_error)
{
if (!JS_InstanceOf(context, obj, static_clasp, NULL)) {
if (throw_error) {
@@ -190,10 +190,10 @@ gjs_typecheck_instance(JSContext *context,
obj, static_clasp->name, format_dynamic_class_name (obj_class->name));
}
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
JSObject*
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 36a5852..d403ce9 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -48,7 +48,7 @@ gjs_throw_valist(JSContext *context,
va_list args)
{
char *s;
- JSBool result;
+ bool result;
jsval v_constructor, v_message;
JSObject *err_obj;
@@ -75,7 +75,7 @@ gjs_throw_valist(JSContext *context,
return;
}
- result = JS_FALSE;
+ result = false;
if (!gjs_string_from_utf8(context, s, -1, &v_message)) {
JS_ReportError(context, "Failed to copy exception string");
@@ -92,7 +92,7 @@ gjs_throw_valist(JSContext *context,
err_obj = JS_New(context, JSVAL_TO_OBJECT(v_constructor), 1, &v_message);
JS_SetPendingException(context, OBJECT_TO_JSVAL(err_obj));
- result = JS_TRUE;
+ result = true;
out:
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index b08d902..b09518b 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -43,7 +43,7 @@ gjs_string_to_utf8 (JSContext *context,
gjs_throw(context,
"Value is not a string, cannot convert to UTF-8");
JS_EndRequest(context);
- return JS_FALSE;
+ return false;
}
str = JSVAL_TO_STRING(value);
@@ -51,7 +51,7 @@ gjs_string_to_utf8 (JSContext *context,
len = JS_GetStringEncodingLength(context, str);
if (len == (gsize)(-1)) {
JS_EndRequest(context);
- return JS_FALSE;
+ return false;
}
if (utf8_string_p) {
@@ -61,10 +61,10 @@ gjs_string_to_utf8 (JSContext *context,
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_string_from_utf8(JSContext *context,
const char *utf8_string,
gssize n_bytes,
@@ -91,7 +91,7 @@ gjs_string_from_utf8(JSContext *context,
"JS string: %s",
error->message);
g_error_free(error);
- return JS_FALSE;
+ return false;
}
JS_BeginRequest(context);
@@ -118,7 +118,7 @@ gjs_string_to_filename(JSContext *context,
if (!gjs_string_to_utf8(context, filename_val, &tmp)) {
/* exception already set */
- return JS_FALSE;
+ return false;
}
error = NULL;
@@ -134,7 +134,7 @@ gjs_string_to_filename(JSContext *context,
return TRUE;
}
-JSBool
+bool
gjs_string_from_filename(JSContext *context,
const char *filename_string,
gssize n_bytes,
@@ -154,15 +154,15 @@ gjs_string_from_filename(JSContext *context,
error->message);
g_error_free(error);
g_free(utf8_string);
- return JS_FALSE;
+ return false;
}
if (!gjs_string_from_utf8(context, utf8_string, written, value_p))
- return JS_FALSE;
+ return false;
g_free(utf8_string);
- return JS_TRUE;
+ return true;
}
/**
@@ -176,16 +176,16 @@ gjs_string_from_filename(JSContext *context,
* contained in @value.
* Throws a JS exception if value is not a string.
*
- * Returns: JS_FALSE if exception thrown
+ * Returns: false if exception thrown
**/
-JSBool
+bool
gjs_string_get_uint16_data(JSContext *context,
jsval value,
guint16 **data_p,
gsize *len_p)
{
const jschar *js_data;
- JSBool retval = JS_FALSE;
+ bool retval = false;
JS_BeginRequest(context);
@@ -201,7 +201,7 @@ gjs_string_get_uint16_data(JSContext *context,
*data_p = (guint16*) g_memdup(js_data, sizeof(*js_data)*(*len_p));
- retval = JS_TRUE;
+ retval = true;
out:
JS_EndRequest(context);
return retval;
@@ -218,7 +218,7 @@ out:
*
* Returns: true if *name_p is non-%NULL
**/
-JSBool
+bool
gjs_get_string_id (JSContext *context,
jsid id,
char **name_p)
@@ -226,13 +226,13 @@ gjs_get_string_id (JSContext *context,
jsval id_val;
if (!JS_IdToValue(context, id, &id_val))
- return JS_FALSE;
+ return false;
if (JSVAL_IS_STRING(id_val)) {
return gjs_string_to_utf8(context, id_val, name_p);
} else {
*name_p = NULL;
- return JS_FALSE;
+ return false;
}
}
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 2ad4339..7693953 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -157,12 +157,12 @@ gjs_object_require_property(JSContext *context,
*value_p = value;
if (G_UNLIKELY (!JS_GetPropertyById(context, obj, property_name, &value)))
- return JS_FALSE;
+ return false;
if (G_LIKELY (!JSVAL_IS_VOID(value))) {
if (value_p)
*value_p = value;
- return JS_TRUE;
+ return true;
}
/* remember gjs_throw() is a no-op if JS_GetProperty()
@@ -181,7 +181,7 @@ gjs_object_require_property(JSContext *context,
name, obj);
g_free(name);
- return JS_FALSE;
+ return false;
}
void
@@ -475,7 +475,7 @@ gjs_explain_scope(JSContext *context,
JS_EndRequest(context);
}
-JSBool
+bool
gjs_log_exception_full(JSContext *context,
jsval exc,
JSString *message)
@@ -584,15 +584,15 @@ gjs_log_exception_full(JSContext *context,
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
log_and_maybe_keep_exception(JSContext *context,
gboolean keep)
{
jsval exc = JSVAL_VOID;
- JSBool retval = JS_FALSE;
+ bool retval = false;
JS_BeginRequest(context);
@@ -610,7 +610,7 @@ log_and_maybe_keep_exception(JSContext *context,
if (keep)
JS_SetPendingException(context, exc);
- retval = JS_TRUE;
+ retval = true;
out:
JS_RemoveValueRoot(context, &exc);
@@ -620,13 +620,13 @@ log_and_maybe_keep_exception(JSContext *context,
return retval;
}
-JSBool
+bool
gjs_log_exception(JSContext *context)
{
return log_and_maybe_keep_exception(context, FALSE);
}
-JSBool
+bool
gjs_log_and_keep_exception(JSContext *context)
{
return log_and_maybe_keep_exception(context, TRUE);
@@ -677,11 +677,11 @@ try_to_chain_stack_trace(JSContext *src_context, JSContext *dst_context,
JS_EndRequest(src_context);
}
-JSBool
+bool
gjs_move_exception(JSContext *src_context,
JSContext *dest_context)
{
- JSBool success;
+ bool success;
JS_BeginRequest(src_context);
JS_BeginRequest(dest_context);
@@ -697,9 +697,9 @@ gjs_move_exception(JSContext *src_context,
JS_SetPendingException(dest_context, exc);
JS_ClearPendingException(src_context);
}
- success = JS_TRUE;
+ success = true;
} else {
- success = JS_FALSE;
+ success = false;
}
JS_EndRequest(dest_context);
@@ -708,7 +708,7 @@ gjs_move_exception(JSContext *src_context,
return success;
}
-JSBool
+bool
gjs_call_function_value(JSContext *context,
JSObject *obj,
jsval fval,
@@ -716,7 +716,7 @@ gjs_call_function_value(JSContext *context,
jsval *argv,
jsval *rval)
{
- JSBool result;
+ bool result;
JS_BeginRequest(context);
@@ -730,7 +730,7 @@ gjs_call_function_value(JSContext *context,
return result;
}
-static JSBool
+static bool
log_prop(JSContext *context,
JSObject *obj,
jsval id,
@@ -755,10 +755,10 @@ log_prop(JSContext *context,
what);
}
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_get_prop_verbose_stub(JSContext *context,
JSObject *obj,
jsval id,
@@ -767,7 +767,7 @@ gjs_get_prop_verbose_stub(JSContext *context,
return log_prop(context, obj, id, value_p, "get");
}
-JSBool
+bool
gjs_set_prop_verbose_stub(JSContext *context,
JSObject *obj,
jsval id,
@@ -776,7 +776,7 @@ gjs_set_prop_verbose_stub(JSContext *context,
return log_prop(context, obj, id, value_p, "set");
}
-JSBool
+bool
gjs_add_prop_verbose_stub(JSContext *context,
JSObject *obj,
jsval id,
@@ -785,7 +785,7 @@ gjs_add_prop_verbose_stub(JSContext *context,
return log_prop(context, obj, id, value_p, "add");
}
-JSBool
+bool
gjs_delete_prop_verbose_stub(JSContext *context,
JSObject *obj,
jsval id,
@@ -836,18 +836,18 @@ gjs_get_type_name(jsval value)
* rounded to the nearest 64-bit integer. Like JS_ValueToInt32(),
* undefined throws, but null => 0, false => 0, true => 1.
*/
-JSBool
+bool
gjs_value_to_int64 (JSContext *context,
const jsval val,
gint64 *result)
{
if (JSVAL_IS_INT (val)) {
*result = JSVAL_TO_INT (val);
- return JS_TRUE;
+ return true;
} else {
double value_double;
if (!JS_ValueToNumber(context, val, &value_double))
- return JS_FALSE;
+ return false;
if (isnan(value_double) ||
value_double < G_MININT64 ||
@@ -855,15 +855,15 @@ gjs_value_to_int64 (JSContext *context,
gjs_throw(context,
"Value is not a valid 64-bit integer");
- return JS_FALSE;
+ return false;
}
*result = (gint64)(value_double + 0.5);
- return JS_TRUE;
+ return true;
}
}
-static JSBool
+static bool
gjs_parse_args_valist (JSContext *context,
const char *function_name,
const char *format,
@@ -939,8 +939,8 @@ gjs_parse_args_valist (JSContext *context,
argname = va_arg (args, char *);
arg_location = va_arg (args, gpointer);
- g_return_val_if_fail (argname != NULL, JS_FALSE);
- g_return_val_if_fail (arg_location != NULL, JS_FALSE);
+ g_return_val_if_fail (argname != NULL, false);
+ g_return_val_if_fail (arg_location != NULL, false);
js_value = argv[consumed_args];
@@ -1054,7 +1054,7 @@ gjs_parse_args_valist (JSContext *context,
}
JS_EndRequest(context);
- return JS_TRUE;
+ return true;
error_unwind:
/* We still own the strings in the error case, free any we converted */
@@ -1062,7 +1062,7 @@ gjs_parse_args_valist (JSContext *context,
g_free (unwind_strings[i]);
}
JS_EndRequest(context);
- return JS_FALSE;
+ return false;
}
/**
@@ -1099,7 +1099,7 @@ gjs_parse_args_valist (JSContext *context,
* A prefix character '?' means that the next value may be null, in
* which case the C value %NULL is returned.
*/
-JSBool
+bool
gjs_parse_args (JSContext *context,
const char *function_name,
const char *format,
@@ -1108,14 +1108,14 @@ gjs_parse_args (JSContext *context,
...)
{
va_list args;
- JSBool ret;
+ bool ret;
va_start (args, argv);
ret = gjs_parse_args_valist (context, function_name, format, argc, argv, args);
va_end (args);
return ret;
}
-JSBool
+bool
gjs_parse_call_args (JSContext *context,
const char *function_name,
const char *format,
@@ -1123,7 +1123,7 @@ gjs_parse_call_args (JSContext *context,
...)
{
va_list args;
- JSBool ret;
+ bool ret;
va_start (args, call_args);
ret = gjs_parse_args_valist (context, function_name, format, call_args.length(), call_args.array(),
args);
va_end (args);
@@ -1287,7 +1287,7 @@ gjs_strip_unix_shebang(const char *script,
return script;
}
-JSBool
+bool
gjs_eval_with_scope(JSContext *context,
JSObject *object,
const char *script,
@@ -1309,7 +1309,7 @@ gjs_eval_with_scope(JSContext *context,
/* log and clear exception if it's set (should not be, normally...) */
if (JS_IsExceptionPending(context)) {
g_warning("gjs_eval_in_scope called with a pending exception");
- return JS_FALSE;
+ return false;
}
if (!object)
@@ -1323,14 +1323,14 @@ gjs_eval_with_scope(JSContext *context,
js::RootedObject rootedObj(context, object);
if (!JS::Evaluate(context, rootedObj, options, script, script_len, &retval))
- return JS_FALSE;
+ return false;
gjs_schedule_gc_if_needed(context);
if (JS_IsExceptionPending(context)) {
- g_warning("EvaluateScript returned JS_TRUE but exception was pending; "
- "did somebody call gjs_throw() without returning JS_FALSE?");
- return JS_FALSE;
+ g_warning("EvaluateScript returned true but exception was pending; "
+ "did somebody call gjs_throw() without returning false?");
+ return false;
}
gjs_debug(GJS_DEBUG_CONTEXT,
@@ -1339,5 +1339,5 @@ gjs_eval_with_scope(JSContext *context,
if (retval_p)
*retval_p = retval;
- return JS_TRUE;
+ return true;
}
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 6e98713..d160f9a 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -77,10 +77,10 @@ typedef struct GjsRootedArray GjsRootedArray;
* do_base_typecheck and priv_from_js
*/
#define GJS_DEFINE_PRIV_FROM_JS(type, klass) \
- __attribute__((unused)) static inline JSBool \
+ __attribute__((unused)) static inline bool \
do_base_typecheck(JSContext *context, \
JSObject *object, \
- JSBool throw_error) \
+ bool throw_error) \
{ \
return gjs_typecheck_instance(context, object, &klass, throw_error); \
} \
@@ -94,15 +94,15 @@ typedef struct GjsRootedArray GjsRootedArray;
JS_EndRequest(context); \
return priv; \
} \
- __attribute__((unused)) static JSBool \
+ __attribute__((unused)) static bool \
priv_from_js_with_typecheck(JSContext *context, \
JSObject *object, \
type **out) \
{ \
- if (!do_base_typecheck(context, object, JS_FALSE)) \
- return JS_FALSE; \
+ if (!do_base_typecheck(context, object, false)) \
+ return false; \
*out = priv_from_js(context, object); \
- return JS_TRUE; \
+ return true; \
}
/**
@@ -140,13 +140,13 @@ _GJS_DEFINE_PROTO_FULL(tn, cn, NULL, gtype, flags)
extern JSPropertySpec gjs_##cname##_proto_props[]; \
extern JSFunctionSpec gjs_##cname##_proto_funcs[]; \
static void gjs_##cname##_finalize(JSFreeOp *fop, JSObject *obj); \
-static JSBool gjs_##cname##_new_resolve(JSContext *context, \
- JSObject *obj, \
- jsval id, \
- unsigned flags, \
- JSObject **objp) \
+static bool gjs_##cname##_new_resolve(JSContext *context, \
+ JSObject *obj, \
+ jsval id, \
+ unsigned flags, \
+ JSObject **objp) \
{ \
- return JS_TRUE; \
+ return true; \
} \
static struct JSClass gjs_##cname##_class = { \
type_name, \
@@ -222,7 +222,7 @@ gboolean gjs_object_require_property (JSContext *context,
JSObject *gjs_new_object_for_constructor (JSContext *context,
JSClass *clasp,
jsval *vp);
-JSBool gjs_init_class_dynamic (JSContext *context,
+bool gjs_init_class_dynamic (JSContext *context,
JSObject *in_object,
JSObject *parent_proto,
const char *ns_name,
@@ -240,10 +240,10 @@ void gjs_throw_constructor_error (JSContext *context);
void gjs_throw_abstract_constructor_error (JSContext *context,
jsval *vp);
-JSBool gjs_typecheck_instance (JSContext *context,
+bool gjs_typecheck_instance (JSContext *context,
JSObject *obj,
JSClass *static_clasp,
- JSBool _throw);
+ bool _throw);
JSObject* gjs_construct_object_dynamic (JSContext *context,
JSObject *proto,
@@ -270,11 +270,11 @@ void gjs_throw_literal (JSContext *context,
void gjs_throw_g_error (JSContext *context,
GError *error);
-JSBool gjs_log_exception (JSContext *context);
-JSBool gjs_log_and_keep_exception (JSContext *context);
-JSBool gjs_move_exception (JSContext *src_context,
+bool gjs_log_exception (JSContext *context);
+bool gjs_log_and_keep_exception (JSContext *context);
+bool gjs_move_exception (JSContext *src_context,
JSContext *dest_context);
-JSBool gjs_log_exception_full (JSContext *context,
+bool gjs_log_exception_full (JSContext *context,
jsval exc,
JSString *message);
@@ -288,7 +288,7 @@ char* gjs_value_debug_string (JSContext *context,
jsval value);
void gjs_explain_scope (JSContext *context,
const char *title);
-JSBool gjs_call_function_value (JSContext *context,
+bool gjs_call_function_value (JSContext *context,
JSObject *obj,
jsval fval,
unsigned argc,
@@ -298,19 +298,19 @@ void gjs_error_reporter (JSContext *context,
const char *message,
JSErrorReport *report);
JSObject* gjs_get_global_object (JSContext *cx);
-JSBool gjs_get_prop_verbose_stub (JSContext *context,
+bool gjs_get_prop_verbose_stub (JSContext *context,
JSObject *obj,
jsval id,
jsval *value_p);
-JSBool gjs_set_prop_verbose_stub (JSContext *context,
+bool gjs_set_prop_verbose_stub (JSContext *context,
JSObject *obj,
jsval id,
jsval *value_p);
-JSBool gjs_add_prop_verbose_stub (JSContext *context,
+bool gjs_add_prop_verbose_stub (JSContext *context,
JSObject *obj,
jsval id,
jsval *value_p);
-JSBool gjs_delete_prop_verbose_stub (JSContext *context,
+bool gjs_delete_prop_verbose_stub (JSContext *context,
JSObject *obj,
jsval id,
jsval *value_p);
@@ -318,22 +318,22 @@ JSBool gjs_delete_prop_verbose_stub (JSContext *context,
JSBool gjs_string_to_utf8 (JSContext *context,
const jsval string_val,
char **utf8_string_p);
-JSBool gjs_string_from_utf8 (JSContext *context,
+bool gjs_string_from_utf8 (JSContext *context,
const char *utf8_string,
gssize n_bytes,
jsval *value_p);
JSBool gjs_string_to_filename (JSContext *context,
const jsval string_val,
char **filename_string_p);
-JSBool gjs_string_from_filename (JSContext *context,
+bool gjs_string_from_filename (JSContext *context,
const char *filename_string,
gssize n_bytes,
jsval *value_p);
-JSBool gjs_string_get_uint16_data (JSContext *context,
+bool gjs_string_get_uint16_data (JSContext *context,
jsval value,
guint16 **data_p,
gsize *len_p);
-JSBool gjs_get_string_id (JSContext *context,
+bool gjs_get_string_id (JSContext *context,
jsid id,
char **name_p);
jsid gjs_intern_string_to_id (JSContext *context,
@@ -345,18 +345,18 @@ gboolean gjs_unichar_from_string (JSContext *context,
const char* gjs_get_type_name (jsval value);
-JSBool gjs_value_to_int64 (JSContext *context,
+bool gjs_value_to_int64 (JSContext *context,
const jsval val,
gint64 *result);
-JSBool gjs_parse_args (JSContext *context,
+bool gjs_parse_args (JSContext *context,
const char *function_name,
const char *format,
unsigned argc,
jsval *argv,
...);
-JSBool gjs_parse_call_args (JSContext *context,
+bool gjs_parse_call_args (JSContext *context,
const char *function_name,
const char *format,
JS::CallArgs &args,
@@ -391,12 +391,12 @@ void gjs_unroot_value_locations (JSContext *context,
void gjs_maybe_gc (JSContext *context);
-JSBool gjs_context_get_frame_info (JSContext *context,
+bool gjs_context_get_frame_info (JSContext *context,
jsval *stack,
jsval *fileName,
jsval *lineNumber);
-JSBool gjs_eval_with_scope (JSContext *context,
+bool gjs_eval_with_scope (JSContext *context,
JSObject *object,
const char *script,
gssize script_len,
diff --git a/gjs/native.cpp b/gjs/native.cpp
index 65a528b..cb2eb6e 100644
--- a/gjs/native.cpp
+++ b/gjs/native.cpp
@@ -81,7 +81,7 @@ gjs_is_registered_native_module(JSContext *context,
*
* Return a native module that's been preloaded.
*/
-JSBool
+bool
gjs_import_native_module(JSContext *context,
const char *name,
JSObject **module_out)
@@ -101,7 +101,7 @@ gjs_import_native_module(JSContext *context,
gjs_throw(context,
"No native module '%s' has registered itself",
name);
- return JS_FALSE;
+ return false;
}
return func (context, module_out);
diff --git a/gjs/native.h b/gjs/native.h
index d2f4b4a..cfe5fd3 100644
--- a/gjs/native.h
+++ b/gjs/native.h
@@ -33,8 +33,8 @@
G_BEGIN_DECLS
-typedef JSBool (* GjsDefineModuleFunc) (JSContext *context,
- JSObject **module_out);
+typedef bool (* GjsDefineModuleFunc) (JSContext *context,
+ JSObject **module_out);
/* called on context init */
void gjs_register_native_module (const char *module_id,
@@ -46,9 +46,9 @@ gboolean gjs_is_registered_native_module(JSContext *context,
const char *name);
/* called by importer.c to load a statically linked native module */
-JSBool gjs_import_native_module (JSContext *context,
- const char *name,
- JSObject **module_out);
+bool gjs_import_native_module (JSContext *context,
+ const char *name,
+ JSObject **module_out);
G_END_DECLS
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index 5069b86..8dd1c8d 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -27,10 +27,10 @@
#include "runtime.h"
struct RuntimeData {
- JSBool in_gc_sweep;
+ bool in_gc_sweep;
};
-JSBool
+bool
gjs_runtime_is_sweeping (JSRuntime *runtime)
{
RuntimeData *data = (RuntimeData*) JS_GetRuntimePrivate(runtime);
@@ -49,7 +49,7 @@ gjs_locale_to_upper_case (JSContext *context,
JS::HandleString src,
JS::MutableHandleValue retval)
{
- JSBool success = JS_FALSE;
+ bool success = false;
char *utf8 = NULL;
char *upper_case_utf8 = NULL;
@@ -61,7 +61,7 @@ gjs_locale_to_upper_case (JSContext *context,
if (!gjs_string_from_utf8(context, upper_case_utf8, -1, retval.address()))
goto out;
- success = JS_TRUE;
+ success = true;
out:
g_free(utf8);
@@ -75,7 +75,7 @@ gjs_locale_to_lower_case (JSContext *context,
JS::HandleString src,
JS::MutableHandleValue retval)
{
- JSBool success = JS_FALSE;
+ bool success = false;
char *utf8 = NULL;
char *lower_case_utf8 = NULL;
@@ -87,7 +87,7 @@ gjs_locale_to_lower_case (JSContext *context,
if (!gjs_string_from_utf8(context, lower_case_utf8, -1, retval.address()))
goto out;
- success = JS_TRUE;
+ success = true;
out:
g_free(utf8);
@@ -102,7 +102,7 @@ gjs_locale_compare (JSContext *context,
JS::HandleString src_2,
JS::MutableHandleValue retval)
{
- JSBool success = JS_FALSE;
+ bool success = false;
char *utf8_1 = NULL, *utf8_2 = NULL;
int result;
@@ -113,7 +113,7 @@ gjs_locale_compare (JSContext *context,
result = g_utf8_collate (utf8_1, utf8_2);
retval.set(INT_TO_JSVAL(result));
- success = JS_TRUE;
+ success = true;
out:
g_free(utf8_1);
@@ -127,7 +127,7 @@ gjs_locale_to_unicode (JSContext *context,
const char *src,
JS::MutableHandleValue retval)
{
- JSBool success;
+ bool success;
char *utf8;
GError *error = NULL;
@@ -137,7 +137,7 @@ gjs_locale_to_unicode (JSContext *context,
"Failed to convert locale string to UTF8: %s",
error->message);
g_error_free(error);
- return JS_FALSE;
+ return false;
}
success = gjs_string_from_utf8(context, utf8, -1, retval.address());
@@ -218,9 +218,9 @@ gjs_finalize_callback(JSFreeOp *fop,
*/
if (status == JSFINALIZE_GROUP_START)
- data->in_gc_sweep = JS_TRUE;
+ data->in_gc_sweep = true;
else if (status == JSFINALIZE_GROUP_END)
- data->in_gc_sweep = JS_FALSE;
+ data->in_gc_sweep = false;
}
JSRuntime *
diff --git a/gjs/runtime.h b/gjs/runtime.h
index 0474940..c2cb482 100644
--- a/gjs/runtime.h
+++ b/gjs/runtime.h
@@ -26,6 +26,6 @@
JSRuntime * gjs_runtime_for_current_thread (void);
-JSBool gjs_runtime_is_sweeping (JSRuntime *runtime);
+bool gjs_runtime_is_sweeping (JSRuntime *runtime);
#endif /* __GJS_RUNTIME_H__ */
diff --git a/gjs/stack.cpp b/gjs/stack.cpp
index 40b2064..697a96f 100644
--- a/gjs/stack.cpp
+++ b/gjs/stack.cpp
@@ -47,7 +47,7 @@
#include "compat.h"
#include "jsapi-util.h"
-JSBool
+bool
gjs_context_get_frame_info (JSContext *context,
jsval *stack,
jsval *fileName,
@@ -56,7 +56,7 @@ gjs_context_get_frame_info (JSContext *context,
jsval v_constructor;
JSObject *err_obj;
JSObject *global;
- JSBool ret = JS_FALSE;
+ bool ret = false;
JS_BeginRequest(context);
global = JS_GetGlobalForScopeChain(context);
@@ -88,7 +88,7 @@ gjs_context_get_frame_info (JSContext *context,
goto out;
}
- ret = JS_TRUE;
+ ret = true;
out:
JS_EndRequest(context);
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 74dcef6..62f6172 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -31,7 +31,7 @@
#include "cairo-private.h"
#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(mname) \
-static JSBool \
+static bool \
mname##_func(JSContext *context, \
unsigned argc, \
jsval *vp) \
@@ -40,16 +40,14 @@ mname##_func(JSContext *context, \
JSObject *obj = JSVAL_TO_OBJECT(argv.thisv()); \
cairo_t *cr;
-#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END \
- if (!gjs_cairo_check_status(context, cairo_status(cr), "context")) \
- return JS_FALSE; \
- return JS_TRUE; \
+#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_END \
+ return gjs_cairo_check_status(context, cairo_status(cr), "context"); \
}
#define _GJS_CAIRO_CONTEXT_CHECK_NO_ARGS(m) \
if (argc > 0) { \
gjs_throw(context, "Context." #m "() takes no arguments"); \
- return JS_FALSE; \
+ return false; \
}
#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC0(method, cfunc) \
@@ -82,18 +80,18 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
double arg1, arg2; \
if (!gjs_parse_call_args(context, #method, "ff", argv, \
#n1, &arg1, #n2, &arg2)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, &arg1, &arg2); \
if (cairo_status(cr) == CAIRO_STATUS_SUCCESS) { \
JSObject *array = JS_NewArrayObject(context, 0, NULL); \
if (!array) \
- return JS_FALSE; \
+ return false; \
jsval r; \
- if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE; \
- if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 1, &r)) return JS_FALSE; \
+ if (!JS_NewNumberValue(context, arg1, &r)) return false; \
+ if (!JS_SetElement(context, array, 0, &r)) return false; \
+ if (!JS_NewNumberValue(context, arg2, &r)) return false; \
+ if (!JS_SetElement(context, array, 1, &r)) return false; \
argv.rval().set(OBJECT_TO_JSVAL(array)); \
} \
_GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -107,12 +105,12 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
if (cairo_status(cr) == CAIRO_STATUS_SUCCESS) { \
JSObject *array = JS_NewArrayObject(context, 0, NULL); \
if (!array) \
- return JS_FALSE; \
+ return false; \
jsval r; \
- if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE; \
- if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 1, &r)) return JS_FALSE; \
+ if (!JS_NewNumberValue(context, arg1, &r)) return false; \
+ if (!JS_SetElement(context, array, 0, &r)) return false; \
+ if (!JS_NewNumberValue(context, arg2, &r)) return false; \
+ if (!JS_SetElement(context, array, 1, &r)) return false; \
argv.rval().set(OBJECT_TO_JSVAL(array)); \
} \
_GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -126,16 +124,16 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
{ \
JSObject *array = JS_NewArrayObject(context, 0, NULL); \
if (!array) \
- return JS_FALSE; \
+ return false; \
jsval r; \
- if (!JS_NewNumberValue(context, arg1, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 0, &r)) return JS_FALSE; \
- if (!JS_NewNumberValue(context, arg2, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 1, &r)) return JS_FALSE; \
- if (!JS_NewNumberValue(context, arg3, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 2, &r)) return JS_FALSE; \
- if (!JS_NewNumberValue(context, arg4, &r)) return JS_FALSE; \
- if (!JS_SetElement(context, array, 3, &r)) return JS_FALSE; \
+ if (!JS_NewNumberValue(context, arg1, &r)) return false; \
+ if (!JS_SetElement(context, array, 0, &r)) return false; \
+ if (!JS_NewNumberValue(context, arg2, &r)) return false; \
+ if (!JS_SetElement(context, array, 1, &r)) return false; \
+ if (!JS_NewNumberValue(context, arg3, &r)) return false; \
+ if (!JS_SetElement(context, array, 2, &r)) return false; \
+ if (!JS_NewNumberValue(context, arg4, &r)) return false; \
+ if (!JS_SetElement(context, array, 3, &r)) return false; \
argv.rval().set(OBJECT_TO_JSVAL(array)); \
} \
_GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -148,7 +146,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
cr = gjs_cairo_context_get_context(context, obj); \
ret = cfunc(cr); \
if (!JS_NewNumberValue(context, ret, &retval)) \
- return JS_FALSE; \
+ return false; \
argv.rval().set(retval); \
_GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -157,7 +155,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
t1 arg1; \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, arg1); \
argv.rval().set(JSVAL_VOID); \
@@ -169,7 +167,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
t2 arg2; \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1, #n2, &arg2)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, arg1, arg2); \
argv.rval().set(JSVAL_VOID); \
@@ -182,7 +180,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
cairo_bool_t ret; \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1, #n2, &arg2)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
ret = cfunc(cr, arg1, arg2); \
argv.rval().set(BOOLEAN_TO_JSVAL(ret)); \
@@ -195,7 +193,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
t3 arg3; \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1, #n2, &arg2, #n3, &arg3)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, arg1, arg2, arg3); \
argv.rval().set(JSVAL_VOID); \
@@ -209,7 +207,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
t4 arg4; \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1, #n2, &arg2, #n3, &arg3, #n4, &arg4)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, arg1, arg2, arg3, arg4); \
_GJS_CAIRO_CONTEXT_DEFINE_FUNC_END
@@ -224,7 +222,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1, #n2, &arg2, #n3, &arg3, \
#n4, &arg4, #n5, &arg5)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, arg1, arg2, arg3, arg4, arg5); \
argv.rval().set(JSVAL_VOID); \
@@ -241,7 +239,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(method) \
if (!gjs_parse_call_args(context, #method, fmt, argv, \
#n1, &arg1, #n2, &arg2, #n3, &arg3, \
#n4, &arg4, #n5, &arg5, #n6, &arg6)) \
- return JS_FALSE; \
+ return false; \
cr = gjs_cairo_context_get_context(context, obj); \
cfunc(cr, arg1, arg2, arg3, arg4, arg5, arg6); \
argv.rval().set(JSVAL_VOID); \
@@ -285,25 +283,25 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_context)
if (!gjs_parse_call_args(context, "Context", "o", argv,
"surface", &surface_wrapper))
- return JS_FALSE;
+ return false;
surface = gjs_cairo_surface_get_surface(context, surface_wrapper);
if (!surface) {
gjs_throw(context, "first argument to Context() should be a surface");
- return JS_FALSE;
+ return false;
}
cr = cairo_create(surface);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
_gjs_cairo_context_construct_internal(context, object, cr);
cairo_destroy(cr);
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_context);
- return JS_TRUE;
+ return true;
}
static void
@@ -406,7 +404,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDevice, cairo_user_to_device, "x", "y
_GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDeviceDistance, cairo_user_to_device_distance, "x", "y")
-static JSBool
+static bool
dispose_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -422,10 +420,10 @@ dispose_func(JSContext *context,
priv->cr = NULL;
}
rec.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
appendPath_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -439,21 +437,21 @@ appendPath_func(JSContext *context,
if (!gjs_parse_call_args(context, "path", "o", argv,
"path", &path_wrapper))
- return JS_FALSE;
+ return false;
path = gjs_cairo_path_get_path(context, path_wrapper);
if (!path) {
gjs_throw(context, "first argument to appendPath() should be a path");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
cairo_append_path(cr, path);
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
copyPath_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -465,16 +463,16 @@ copyPath_func(JSContext *context,
cairo_t *cr;
if (!gjs_parse_call_args(context, "", "", argv))
- return JS_FALSE;
+ return false;
cr = gjs_cairo_context_get_context(context, obj);
path = cairo_copy_path(cr);
argv.rval().set(
OBJECT_TO_JSVAL(gjs_cairo_path_from_path(context, path)));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
copyPathFlat_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -486,15 +484,15 @@ copyPathFlat_func(JSContext *context,
cairo_t *cr;
if (!gjs_parse_call_args(context, "", "", argv))
- return JS_FALSE;
+ return false;
cr = gjs_cairo_context_get_context(context, obj);
path = cairo_copy_path_flat(cr);
argv.rval().set(OBJECT_TO_JSVAL(gjs_cairo_path_from_path(context, path)));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
mask_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -508,25 +506,25 @@ mask_func(JSContext *context,
if (!gjs_parse_call_args(context, "mask", "o", argv,
"pattern", &pattern_wrapper))
- return JS_FALSE;
+ return false;
pattern = gjs_cairo_pattern_get_pattern(context, pattern_wrapper);
if (!pattern) {
gjs_throw(context, "first argument to mask() should be a pattern");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
cairo_mask(cr, pattern);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
maskSurface_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -543,12 +541,12 @@ maskSurface_func(JSContext *context,
"surface", &surface_wrapper,
"x", &x,
"y", &y))
- return JS_FALSE;
+ return false;
surface = gjs_cairo_surface_get_surface(context, surface_wrapper);
if (!surface) {
gjs_throw(context, "first argument to maskSurface() should be a surface");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
@@ -556,13 +554,13 @@ maskSurface_func(JSContext *context,
cairo_mask_surface(cr, surface, x, y);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
setDash_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -574,13 +572,13 @@ setDash_func(JSContext *context,
cairo_t *cr;
JSObject *dashes;
double offset;
- JSBool retval = JS_FALSE;
+ bool retval = false;
guint len;
GArray *dashes_c = NULL;
if (!gjs_parse_call_args(context, "setDash", "of", argv,
"dashes", &dashes, "offset", &offset))
- return JS_FALSE;
+ return false;
JS_AddObjectRoot(context, &dashes);
@@ -619,7 +617,7 @@ setDash_func(JSContext *context,
cr = gjs_cairo_context_get_context(context, obj);
cairo_set_dash(cr, (double*)dashes_c->data, dashes_c->len, offset);
argv.rval().set(JSVAL_VOID);
- retval = JS_TRUE;
+ retval = true;
out:
if (dashes_c != NULL)
g_array_free (dashes_c, TRUE);
@@ -627,7 +625,7 @@ setDash_func(JSContext *context,
return retval;
}
-static JSBool
+static bool
setSource_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -641,12 +639,12 @@ setSource_func(JSContext *context,
if (!gjs_parse_call_args(context, "setSource", "o", argv,
"pattern", &pattern_wrapper))
- return JS_FALSE;
+ return false;
pattern = gjs_cairo_pattern_get_pattern(context, pattern_wrapper);
if (!pattern) {
gjs_throw(context, "first argument to setSource() should be a pattern");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
@@ -654,14 +652,14 @@ setSource_func(JSContext *context,
cairo_set_source(cr, pattern);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
setSourceSurface_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -678,12 +676,12 @@ setSourceSurface_func(JSContext *context,
"surface", &surface_wrapper,
"x", &x,
"y", &y))
- return JS_FALSE;
+ return false;
surface = gjs_cairo_surface_get_surface(context, surface_wrapper);
if (!surface) {
gjs_throw(context, "first argument to setSourceSurface() should be a surface");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
@@ -691,14 +689,14 @@ setSourceSurface_func(JSContext *context,
cairo_set_source_surface(cr, surface, x, y);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
showText_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -711,7 +709,7 @@ showText_func(JSContext *context,
if (!gjs_parse_call_args(context, "showText", "s", argv,
"utf8", &utf8))
- return JS_FALSE;
+ return false;
cr = gjs_cairo_context_get_context(context, obj);
@@ -719,14 +717,14 @@ showText_func(JSContext *context,
g_free(utf8);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
selectFontFace_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -743,7 +741,7 @@ selectFontFace_func(JSContext *context,
"family", &family,
"slang", &slant,
"weight", &weight))
- return JS_FALSE;
+ return false;
cr = gjs_cairo_context_get_context(context, obj);
@@ -751,13 +749,13 @@ selectFontFace_func(JSContext *context,
g_free(family);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
popGroup_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -771,26 +769,26 @@ popGroup_func(JSContext *context,
if (argc > 0) {
gjs_throw(context, "Context.popGroup() takes no arguments");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
pattern = cairo_pop_group(cr);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
/* pattern belongs to the context, so keep the reference */
pattern_wrapper = gjs_cairo_pattern_from_pattern(context, pattern);
if (!pattern_wrapper) {
gjs_throw(context, "failed to create pattern");
- return JS_FALSE;
+ return false;
}
rec.rval().set(OBJECT_TO_JSVAL(pattern_wrapper));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getSource_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -804,27 +802,27 @@ getSource_func(JSContext *context,
if (argc > 0) {
gjs_throw(context, "Context.getSource() takes no arguments");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
pattern = cairo_get_source(cr);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
/* pattern belongs to the context, so keep the reference */
pattern_wrapper = gjs_cairo_pattern_from_pattern(context, pattern);
if (!pattern_wrapper) {
gjs_throw(context, "failed to create pattern");
- return JS_FALSE;
+ return false;
}
rec.rval().set(OBJECT_TO_JSVAL(pattern_wrapper));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getTarget_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -838,27 +836,27 @@ getTarget_func(JSContext *context,
if (argc > 0) {
gjs_throw(context, "Context.getTarget() takes no arguments");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
surface = cairo_get_target(cr);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
/* surface belongs to the context, so keep the reference */
surface_wrapper = gjs_cairo_surface_from_surface(context, surface);
if (!surface_wrapper) {
/* exception already set */
- return JS_FALSE;
+ return false;
}
rec.rval().set(OBJECT_TO_JSVAL(surface_wrapper));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getGroupTarget_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -872,24 +870,24 @@ getGroupTarget_func(JSContext *context,
if (argc > 0) {
gjs_throw(context, "Context.getGroupTarget() takes no arguments");
- return JS_FALSE;
+ return false;
}
cr = gjs_cairo_context_get_context(context, obj);
surface = cairo_get_group_target(cr);
if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
- return JS_FALSE;
+ return false;
/* surface belongs to the context, so keep the reference */
surface_wrapper = gjs_cairo_surface_from_surface(context, surface);
if (!surface_wrapper) {
/* exception already set */
- return JS_FALSE;
+ return false;
}
rec.rval().set(OBJECT_TO_JSVAL(surface_wrapper));
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_context_proto_funcs[] = {
@@ -1021,7 +1019,7 @@ gjs_cairo_context_get_context(JSContext *context,
return priv->cr;
}
-static JSBool
+static bool
context_to_g_argument(JSContext *context,
jsval value,
const char *arg_name,
@@ -1036,15 +1034,15 @@ context_to_g_argument(JSContext *context,
obj = JSVAL_TO_OBJECT(value);
cr = gjs_cairo_context_get_context(context, obj);
if (!cr)
- return JS_FALSE;
+ return false;
if (transfer == GI_TRANSFER_EVERYTHING)
cairo_reference(cr);
arg->v_pointer = cr;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
context_from_g_argument(JSContext *context,
jsval *value_p,
GArgument *arg)
@@ -1053,19 +1051,19 @@ context_from_g_argument(JSContext *context,
obj = gjs_cairo_context_from_context(context, (cairo_t*)arg->v_pointer);
if (!obj)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
context_release_argument(JSContext *context,
GITransfer transfer,
GArgument *arg)
{
cairo_destroy((cairo_t*)arg->v_pointer);
- return JS_TRUE;
+ return true;
}
static GjsForeignInfo foreign_info = {
diff --git a/modules/cairo-gradient.cpp b/modules/cairo-gradient.cpp
index 1b5c40f..b78f1fb 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -43,7 +43,7 @@ JSPropertySpec gjs_cairo_gradient_proto_props[] = {
/* Methods */
-static JSBool
+static bool
addColorStopRGB_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -59,20 +59,20 @@ addColorStopRGB_func(JSContext *context,
"red", &red,
"green", &green,
"blue", &blue))
- return JS_FALSE;
+ return false;
pattern = gjs_cairo_pattern_get_pattern(context, obj);
cairo_pattern_add_color_stop_rgb(pattern, offset, red, green, blue);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
addColorStopRGBA_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -89,16 +89,16 @@ addColorStopRGBA_func(JSContext *context,
"green", &green,
"blue", &blue,
"alpha", &alpha))
- return JS_FALSE;
+ return false;
pattern = gjs_cairo_pattern_get_pattern(context, obj);
cairo_pattern_add_color_stop_rgba(pattern, offset, red, green, blue, alpha);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_gradient_proto_funcs[] = {
diff --git a/modules/cairo-image-surface.cpp b/modules/cairo-image-surface.cpp
index 8f4bc9d..c5b037b 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -42,19 +42,19 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_image_surface)
"format", &format,
"width", &width,
"height", &height))
- return JS_FALSE;
+ return false;
surface = cairo_image_surface_create((cairo_format_t) format, width, height);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface"))
- return JS_FALSE;
+ return false;
gjs_cairo_surface_construct(context, object, surface);
cairo_surface_destroy(surface);
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_image_surface);
- return JS_TRUE;
+ return true;
}
static void
@@ -68,7 +68,7 @@ JSPropertySpec gjs_cairo_image_surface_proto_props[] = {
{ NULL }
};
-static JSBool
+static bool
createFromPNG_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -80,26 +80,26 @@ createFromPNG_func(JSContext *context,
if (!gjs_parse_call_args(context, "createFromPNG", "s", argv,
"filename", &filename))
- return JS_FALSE;
+ return false;
surface = cairo_image_surface_create_from_png(filename);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface"))
- return JS_FALSE;
+ return false;
surface_wrapper = JS_NewObject(context, &gjs_cairo_image_surface_class, NULL, NULL);
if (!surface_wrapper) {
gjs_throw(context, "failed to create surface");
- return JS_FALSE;
+ return false;
}
gjs_cairo_surface_construct(context, surface_wrapper, surface);
cairo_surface_destroy(surface);
argv.rval().set(OBJECT_TO_JSVAL(surface_wrapper));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getFormat_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -112,20 +112,20 @@ getFormat_func(JSContext *context,
if (argc > 1) {
gjs_throw(context, "ImageSurface.getFormat() takes no arguments");
- return JS_FALSE;
+ return false;
}
surface = gjs_cairo_surface_get_surface(context, obj);
format = cairo_image_surface_get_format(surface);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(format);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getWidth_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -138,20 +138,20 @@ getWidth_func(JSContext *context,
if (argc > 1) {
gjs_throw(context, "ImageSurface.getWidth() takes no arguments");
- return JS_FALSE;
+ return false;
}
surface = gjs_cairo_surface_get_surface(context, obj);
width = cairo_image_surface_get_width(surface);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(width);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getHeight_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -164,20 +164,20 @@ getHeight_func(JSContext *context,
if (argc > 1) {
gjs_throw(context, "ImageSurface.getHeight() takes no arguments");
- return JS_FALSE;
+ return false;
}
surface = gjs_cairo_surface_get_surface(context, obj);
height = cairo_image_surface_get_height(surface);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(height);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getStride_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -190,17 +190,17 @@ getStride_func(JSContext *context,
if (argc > 1) {
gjs_throw(context, "ImageSurface.getStride() takes no arguments");
- return JS_FALSE;
+ return false;
}
surface = gjs_cairo_surface_get_surface(context, obj);
stride = cairo_image_surface_get_stride(surface);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface), "surface"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(stride);
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_image_surface_proto_funcs[] = {
diff --git a/modules/cairo-linear-gradient.cpp b/modules/cairo-linear-gradient.cpp
index 89c70a6..27e346d 100644
--- a/modules/cairo-linear-gradient.cpp
+++ b/modules/cairo-linear-gradient.cpp
@@ -42,19 +42,19 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_linear_gradient)
"y0", &y0,
"x1", &x1,
"y1", &y1))
- return JS_FALSE;
+ return false;
pattern = cairo_pattern_create_linear(x0, y0, x1, y1);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
gjs_cairo_pattern_construct(context, object, pattern);
cairo_pattern_destroy(pattern);
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_linear_gradient);
- return JS_TRUE;
+ return true;
}
static void
diff --git a/modules/cairo-module.h b/modules/cairo-module.h
index 9b5e2d5..f2613af 100644
--- a/modules/cairo-module.h
+++ b/modules/cairo-module.h
@@ -23,7 +23,7 @@
#ifndef __CAIRO_MODULE_H__
#define __CAIRO_MODULE_H__
-JSBool gjs_js_define_cairo_stuff (JSContext *context,
- JSObject **module_out);
+bool gjs_js_define_cairo_stuff (JSContext *context,
+ JSObject **module_out);
#endif /* __CAIRO_MODULE_H__ */
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index 2102e4e..1767852 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -57,7 +57,7 @@ JSPropertySpec gjs_cairo_pattern_proto_props[] = {
/* Methods */
-static JSBool
+static bool
getType_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -70,17 +70,17 @@ getType_func(JSContext *context,
if (argc > 1) {
gjs_throw(context, "Pattern.getType() takes no arguments");
- return JS_FALSE;
+ return false;
}
pattern = gjs_cairo_pattern_get_pattern(context, obj);
type = cairo_pattern_get_type(pattern);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(type);
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_pattern_proto_funcs[] = {
diff --git a/modules/cairo-pdf-surface.cpp b/modules/cairo-pdf-surface.cpp
index 22644c4..f971a3b 100644
--- a/modules/cairo-pdf-surface.cpp
+++ b/modules/cairo-pdf-surface.cpp
@@ -45,14 +45,14 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_pdf_surface)
"filename", &filename,
"width", &width,
"height", &height))
- return JS_FALSE;
+ return false;
surface = cairo_pdf_surface_create(filename, width, height);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface),
"surface")) {
g_free(filename);
- return JS_FALSE;
+ return false;
}
gjs_cairo_surface_construct(context, object, surface);
@@ -61,7 +61,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_pdf_surface)
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_pdf_surface);
- return JS_TRUE;
+ return true;
}
static void
diff --git a/modules/cairo-private.h b/modules/cairo-private.h
index 50cf28d..cf41efd 100644
--- a/modules/cairo-private.h
+++ b/modules/cairo-private.h
@@ -26,7 +26,7 @@
#include "cairo-module.h"
#include <cairo.h>
-JSBool gjs_cairo_check_status (JSContext *context,
+bool gjs_cairo_check_status (JSContext *context,
cairo_status_t status,
const char *name);
diff --git a/modules/cairo-ps-surface.cpp b/modules/cairo-ps-surface.cpp
index 3a963ad..b33b85e 100644
--- a/modules/cairo-ps-surface.cpp
+++ b/modules/cairo-ps-surface.cpp
@@ -45,14 +45,14 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_ps_surface)
"filename", &filename,
"width", &width,
"height", &height))
- return JS_FALSE;
+ return false;
surface = cairo_ps_surface_create(filename, width, height);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface),
"surface")) {
g_free(filename);
- return JS_FALSE;
+ return false;
}
gjs_cairo_surface_construct(context, object, surface);
@@ -61,7 +61,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_ps_surface)
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_ps_surface);
- return JS_TRUE;
+ return true;
}
static void
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index 57ab3f5..f5c21ec 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -44,19 +44,19 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_radial_gradient)
"cx1", &cx1,
"cy1", &cy1,
"radius1", &radius1))
- return JS_FALSE;
+ return false;
pattern = cairo_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
gjs_cairo_pattern_construct(context, object, pattern);
cairo_pattern_destroy(pattern);
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_radial_gradient);
- return JS_TRUE;
+ return true;
}
static void
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index dfe99d7..e1e1365 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -49,7 +49,7 @@ get_region(JSContext *context,
return priv->region;
}
-static JSBool
+static bool
fill_rectangle(JSContext *context, JSObject *obj,
cairo_rectangle_int_t *rect);
@@ -62,7 +62,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
return gjs_cairo_check_status(context, cairo_region_status(this_region), "region");
#define REGION_DEFINE_REGION_FUNC(method) \
- static JSBool \
+ static bool \
method##_func(JSContext *context, \
unsigned argc, \
jsval *vp) \
@@ -72,7 +72,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
cairo_region_t *other_region; \
if (!gjs_parse_call_args(context, #method, "o", argv, \
"other_region", &other_obj)) \
- return JS_FALSE; \
+ return false; \
\
this_region = get_region(context, obj); \
other_region = get_region(context, other_obj); \
@@ -83,7 +83,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
}
#define REGION_DEFINE_RECT_FUNC(method) \
- static JSBool \
+ static bool \
method##_rectangle_func(JSContext *context, \
unsigned argc, \
jsval *vp) \
@@ -93,10 +93,10 @@ fill_rectangle(JSContext *context, JSObject *obj,
cairo_rectangle_int_t rect; \
if (!gjs_parse_call_args(context, #method, "o", argv, \
"rect", &rect_obj)) \
- return JS_FALSE; \
+ return false; \
\
if (!fill_rectangle(context, rect_obj, &rect)) \
- return JS_FALSE; \
+ return false; \
\
cairo_region_##method##_rectangle(this_region, &rect); \
argv.rval().set(JSVAL_VOID); \
@@ -113,33 +113,33 @@ REGION_DEFINE_RECT_FUNC(subtract)
REGION_DEFINE_RECT_FUNC(intersect)
REGION_DEFINE_RECT_FUNC(xor)
-static JSBool
+static bool
fill_rectangle(JSContext *context, JSObject *obj,
cairo_rectangle_int_t *rect)
{
jsval val;
if (!gjs_object_get_property_const(context, obj, GJS_STRING_X, &val))
- return JS_FALSE;
+ return false;
if (!JS_ValueToInt32(context, val, &rect->x))
- return JS_FALSE;
+ return false;
if (!gjs_object_get_property_const(context, obj, GJS_STRING_Y, &val))
- return JS_FALSE;
+ return false;
if (!JS_ValueToInt32(context, val, &rect->y))
- return JS_FALSE;
+ return false;
if (!gjs_object_get_property_const(context, obj, GJS_STRING_WIDTH, &val))
- return JS_FALSE;
+ return false;
if (!JS_ValueToInt32(context, val, &rect->width))
- return JS_FALSE;
+ return false;
if (!gjs_object_get_property_const(context, obj, GJS_STRING_HEIGHT, &val))
- return JS_FALSE;
+ return false;
if (!JS_ValueToInt32(context, val, &rect->height))
- return JS_FALSE;
+ return false;
- return JS_TRUE;
+ return true;
}
static JSObject *
@@ -164,7 +164,7 @@ make_rectangle(JSContext *context,
return rect_obj;
}
-static JSBool
+static bool
num_rectangles_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -174,7 +174,7 @@ num_rectangles_func(JSContext *context,
jsval retval;
if (!gjs_parse_call_args(context, "num_rectangles", "", argv))
- return JS_FALSE;
+ return false;
n_rects = cairo_region_num_rectangles(this_region);
retval = INT_TO_JSVAL(n_rects);
@@ -182,7 +182,7 @@ num_rectangles_func(JSContext *context,
RETURN_STATUS;
}
-static JSBool
+static bool
get_rectangle_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -194,7 +194,7 @@ get_rectangle_func(JSContext *context,
jsval retval;
if (!gjs_parse_call_args(context, "get_rectangle", "i", argv, "rect", &i))
- return JS_FALSE;
+ return false;
cairo_region_get_rectangle(this_region, i, &rect);
rect_obj = make_rectangle(context, &rect);
@@ -249,7 +249,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_region)
GJS_NATIVE_CONSTRUCTOR_PRELUDE(cairo_region);
if (!gjs_parse_call_args(context, "Region", "", argv))
- return JS_FALSE;
+ return false;
region = cairo_region_create();
@@ -258,7 +258,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_region)
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_region);
- return JS_TRUE;
+ return true;
}
static void
@@ -289,7 +289,7 @@ gjs_cairo_region_from_region(JSContext *context,
return object;
}
-static JSBool
+static bool
region_to_g_argument(JSContext *context,
jsval value,
const char *arg_name,
@@ -304,15 +304,15 @@ region_to_g_argument(JSContext *context,
obj = JSVAL_TO_OBJECT(value);
region = get_region(context, obj);
if (!region)
- return JS_FALSE;
+ return false;
if (transfer == GI_TRANSFER_EVERYTHING)
cairo_region_destroy(region);
arg->v_pointer = region;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
region_from_g_argument(JSContext *context,
jsval *value_p,
GArgument *arg)
@@ -321,19 +321,19 @@ region_from_g_argument(JSContext *context,
obj = gjs_cairo_region_from_region(context, (cairo_region_t*)arg->v_pointer);
if (!obj)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
region_release_argument(JSContext *context,
GITransfer transfer,
GArgument *arg)
{
cairo_region_destroy((cairo_region_t*)arg->v_pointer);
- return JS_TRUE;
+ return true;
}
static GjsForeignInfo foreign_info = {
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index 12ad155..b35af13 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -40,7 +40,7 @@ JSPropertySpec gjs_cairo_solid_pattern_proto_props[] = {
{ NULL }
};
-static JSBool
+static bool
createRGB_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -54,21 +54,21 @@ createRGB_func(JSContext *context,
"red", &red,
"green", &green,
"blue", &blue))
- return JS_FALSE;
+ return false;
pattern = cairo_pattern_create_rgb(red, green, blue);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
pattern_wrapper = gjs_cairo_solid_pattern_from_pattern(context, pattern);
cairo_pattern_destroy(pattern);
argv.rval().set(OBJECT_TO_JSVAL(pattern_wrapper));
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
createRGBA_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -83,18 +83,18 @@ createRGBA_func(JSContext *context,
"green", &green,
"blue", &blue,
"alpha", &alpha))
- return JS_FALSE;
+ return false;
pattern = cairo_pattern_create_rgba(red, green, blue, alpha);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
pattern_wrapper = gjs_cairo_solid_pattern_from_pattern(context, pattern);
cairo_pattern_destroy(pattern);
argv.rval().set(OBJECT_TO_JSVAL(pattern_wrapper));
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_solid_pattern_proto_funcs[] = {
diff --git a/modules/cairo-surface-pattern.cpp b/modules/cairo-surface-pattern.cpp
index 7ffebb2..1f1face 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -40,25 +40,25 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_surface_pattern)
if (!gjs_parse_call_args(context, "SurfacePattern", "o", argv,
"surface", &surface_wrapper))
- return JS_FALSE;
+ return false;
surface = gjs_cairo_surface_get_surface(context, surface_wrapper);
if (!surface) {
gjs_throw(context, "first argument to SurfacePattern() should be a surface");
- return JS_FALSE;
+ return false;
}
pattern = cairo_pattern_create_for_surface(surface);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
gjs_cairo_pattern_construct(context, object, pattern);
cairo_pattern_destroy(pattern);
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_surface_pattern);
- return JS_TRUE;
+ return true;
}
@@ -74,7 +74,7 @@ JSPropertySpec gjs_cairo_surface_pattern_proto_props[] = {
};
-static JSBool
+static bool
setExtend_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -87,19 +87,19 @@ setExtend_func(JSContext *context,
if (!gjs_parse_call_args(context, "setExtend", "i", argv,
"extend", &extend))
- return JS_FALSE;
+ return false;
pattern = gjs_cairo_pattern_get_pattern(context, obj);
cairo_pattern_set_extend(pattern, extend);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getExtend_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -112,21 +112,21 @@ getExtend_func(JSContext *context,
if (argc > 0) {
gjs_throw(context, "SurfacePattern.getExtend() requires no arguments");
- return JS_FALSE;
+ return false;
}
pattern = gjs_cairo_pattern_get_pattern(context, obj);
extend = cairo_pattern_get_extend(pattern);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(extend);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
setFilter_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -139,19 +139,19 @@ setFilter_func(JSContext *context,
if (!gjs_parse_call_args(context, "setFilter", "i", argv,
"filter", &filter))
- return JS_FALSE;
+ return false;
pattern = gjs_cairo_pattern_get_pattern(context, obj);
cairo_pattern_set_filter(pattern, filter);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getFilter_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -164,18 +164,18 @@ getFilter_func(JSContext *context,
if (argc > 0) {
gjs_throw(context, "SurfacePattern.getFilter() requires no arguments");
- return JS_FALSE;
+ return false;
}
pattern = gjs_cairo_pattern_get_pattern(context, obj);
filter = cairo_pattern_get_filter(pattern);
if (!gjs_cairo_check_status(context, cairo_pattern_status(pattern), "pattern"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(filter);
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_surface_pattern_proto_funcs[] = {
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 47b081d..3d040e4 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -57,7 +57,7 @@ JSPropertySpec gjs_cairo_surface_proto_props[] = {
};
/* Methods */
-static JSBool
+static bool
writeToPNG_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -70,23 +70,23 @@ writeToPNG_func(JSContext *context,
if (!gjs_parse_call_args(context, "writeToPNG", "s", argv,
"filename", &filename))
- return JS_FALSE;
+ return false;
surface = gjs_cairo_surface_get_surface(context, obj);
if (!surface) {
g_free(filename);
- return JS_FALSE;
+ return false;
}
cairo_surface_write_to_png(surface, filename);
g_free(filename);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface),
"surface"))
- return JS_FALSE;
+ return false;
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
getType_func(JSContext *context,
unsigned argc,
jsval *vp)
@@ -99,17 +99,17 @@ getType_func(JSContext *context,
if (argc > 1) {
gjs_throw(context, "Surface.getType() takes no arguments");
- return JS_FALSE;
+ return false;
}
surface = gjs_cairo_surface_get_surface(context, obj);
type = cairo_surface_get_type(surface);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface),
"surface"))
- return JS_FALSE;
+ return false;
rec.rval().setInt32(type);
- return JS_TRUE;
+ return true;
}
JSFunctionSpec gjs_cairo_surface_proto_funcs[] = {
@@ -248,7 +248,7 @@ gjs_cairo_surface_get_surface(JSContext *context,
return priv->surface;
}
-static JSBool
+static bool
surface_to_g_argument(JSContext *context,
jsval value,
const char *arg_name,
@@ -263,15 +263,15 @@ surface_to_g_argument(JSContext *context,
obj = JSVAL_TO_OBJECT(value);
s = gjs_cairo_surface_get_surface(context, obj);
if (!s)
- return JS_FALSE;
+ return false;
if (transfer == GI_TRANSFER_EVERYTHING)
cairo_surface_destroy(s);
arg->v_pointer = s;
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
surface_from_g_argument(JSContext *context,
jsval *value_p,
GArgument *arg)
@@ -280,19 +280,19 @@ surface_from_g_argument(JSContext *context,
obj = gjs_cairo_surface_from_surface(context, (cairo_surface_t*)arg->v_pointer);
if (!obj)
- return JS_FALSE;
+ return false;
*value_p = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
+ return true;
}
-static JSBool
+static bool
surface_release_argument(JSContext *context,
GITransfer transfer,
GArgument *arg)
{
cairo_surface_destroy((cairo_surface_t*)arg->v_pointer);
- return JS_TRUE;
+ return true;
}
static GjsForeignInfo foreign_info = {
diff --git a/modules/cairo-svg-surface.cpp b/modules/cairo-svg-surface.cpp
index 45b1dc2..d95d00c 100644
--- a/modules/cairo-svg-surface.cpp
+++ b/modules/cairo-svg-surface.cpp
@@ -45,14 +45,14 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_svg_surface)
"filename", &filename,
"width", &width,
"height", &height))
- return JS_FALSE;
+ return false;
surface = cairo_svg_surface_create(filename, width, height);
if (!gjs_cairo_check_status(context, cairo_surface_status(surface),
"surface")) {
g_free(filename);
- return JS_FALSE;
+ return false;
}
gjs_cairo_surface_construct(context, object, surface);
@@ -61,7 +61,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_svg_surface)
GJS_NATIVE_CONSTRUCTOR_FINISH(cairo_svg_surface);
- return JS_TRUE;
+ return true;
}
static void
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index b5dab64..68c78be 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -40,7 +40,7 @@ class XLibConstructor {
static XLibConstructor constructor;
#endif
-JSBool
+bool
gjs_cairo_check_status(JSContext *context,
cairo_status_t status,
const char *name)
@@ -50,13 +50,13 @@ gjs_cairo_check_status(JSContext *context,
name,
cairo_status_to_string(status),
status);
- return JS_FALSE;
+ return false;
}
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_js_define_cairo_stuff(JSContext *context,
JSObject **module_out)
{
@@ -69,82 +69,82 @@ gjs_js_define_cairo_stuff(JSContext *context,
obj = gjs_cairo_region_create_proto(context, module,
"Region", NULL);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
gjs_cairo_region_init(context);
obj = gjs_cairo_context_create_proto(context, module,
"Context", NULL);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
gjs_cairo_context_init(context);
gjs_cairo_surface_init(context);
obj = gjs_cairo_surface_create_proto(context, module,
"Surface", NULL);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
surface_proto = JSVAL_TO_OBJECT(obj);
obj = gjs_cairo_image_surface_create_proto(context, module,
"ImageSurface", surface_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
gjs_cairo_image_surface_init(context, JSVAL_TO_OBJECT(obj));
#if CAIRO_HAS_PS_SURFACE
obj = gjs_cairo_ps_surface_create_proto(context, module,
"PSSurface", surface_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
#endif
#if CAIRO_HAS_PDF_SURFACE
obj = gjs_cairo_pdf_surface_create_proto(context, module,
"PDFSurface", surface_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
#endif
#if CAIRO_HAS_SVG_SURFACE
obj = gjs_cairo_svg_surface_create_proto(context, module,
"SVGSurface", surface_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
#endif
obj = gjs_cairo_pattern_create_proto(context, module,
"Pattern", NULL);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
pattern_proto = JSVAL_TO_OBJECT(obj);
obj = gjs_cairo_gradient_create_proto(context, module,
"Gradient", pattern_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
gradient_proto = JSVAL_TO_OBJECT(obj);
obj = gjs_cairo_linear_gradient_create_proto(context, module,
"LinearGradient", gradient_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
obj = gjs_cairo_radial_gradient_create_proto(context, module,
"RadialGradient", gradient_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
obj = gjs_cairo_surface_pattern_create_proto(context, module,
"SurfacePattern", pattern_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
obj = gjs_cairo_solid_pattern_create_proto(context, module,
"SolidPattern", pattern_proto);
if (JSVAL_IS_NULL(obj))
- return JS_FALSE;
+ return false;
*module_out = module;
- return JS_TRUE;
+ return true;
}
diff --git a/modules/console.cpp b/modules/console.cpp
index 9a00070..80c9e21 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -128,33 +128,33 @@ gjs_console_error_reporter(JSContext *cx, const char *message, JSErrorReport *re
}
#ifdef HAVE_LIBREADLINE
-static JSBool
+static bool
gjs_console_readline(JSContext *cx, char **bufp, FILE *file, const char *prompt)
{
char *line;
line = readline(prompt);
if (!line)
- return JS_FALSE;
+ return false;
if (line[0] != '\0')
add_history(line);
*bufp = line;
- return JS_TRUE;
+ return true;
}
#else
-static JSBool
+static bool
gjs_console_readline(JSContext *cx, char **bufp, FILE *file, const char *prompt)
{
char line[256];
fprintf(stdout, "%s", prompt);
fflush(stdout);
if (!fgets(line, sizeof line, file))
- return JS_FALSE;
+ return false;
*bufp = g_strdup(line);
- return JS_TRUE;
+ return true;
}
#endif
-JSBool
+bool
gjs_console_interact(JSContext *context,
unsigned argc,
jsval *vp)
@@ -186,7 +186,7 @@ gjs_console_interact(JSContext *context,
do {
if (!gjs_console_readline(context, &temp_buf, file,
startline == lineno ? "gjs> " : ".... ")) {
- eof = JS_TRUE;
+ eof = true;
break;
}
g_string_append(buffer, temp_buf);
@@ -229,10 +229,10 @@ gjs_console_interact(JSContext *context,
if (file != stdin)
fclose(file);
- return JS_TRUE;
+ return true;
}
-JSBool
+bool
gjs_define_console_stuff(JSContext *context,
JSObject **module_out)
{
@@ -244,8 +244,8 @@ gjs_define_console_stuff(JSContext *context,
"interact",
(JSNative) gjs_console_interact,
1, GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ return false;
*module_out = module;
- return JS_TRUE;
+ return true;
}
diff --git a/modules/console.h b/modules/console.h
index bb1e2da..bc41be0 100644
--- a/modules/console.h
+++ b/modules/console.h
@@ -30,11 +30,11 @@
G_BEGIN_DECLS
-JSBool gjs_define_console_stuff (JSContext *context,
- JSObject **module_out);
-JSBool gjs_console_interact (JSContext *context,
- unsigned argc,
- jsval *vp);
+bool gjs_define_console_stuff (JSContext *context,
+ JSObject **module_out);
+bool gjs_console_interact (JSContext *context,
+ unsigned argc,
+ jsval *vp);
G_END_DECLS
diff --git a/modules/system.cpp b/modules/system.cpp
index 81bd9df..fc5a5f0 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -39,12 +39,12 @@ gjs_address_of(JSContext *context,
{
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
JSObject *target_obj;
- JSBool ret;
+ bool ret;
char *pointer_string;
jsval retval;
if (!gjs_parse_call_args(context, "addressOf", "o", argv, "object", &target_obj))
- return JS_FALSE;
+ return false;
pointer_string = g_strdup_printf("%p", target_obj);
@@ -68,19 +68,18 @@ gjs_refcount(JSContext *context,
GObject *obj;
if (!gjs_parse_call_args(context, "refcount", "o", argv, "object", &target_obj))
- return JS_FALSE;
+ return false;
- if (!gjs_typecheck_object(context, target_obj,
- G_TYPE_OBJECT, JS_TRUE))
- return JS_FALSE;
+ if (!gjs_typecheck_object(context, target_obj, G_TYPE_OBJECT, true))
+ return false;
obj = gjs_g_object_from_object(context, target_obj);
if (obj == NULL)
- return JS_FALSE;
+ return false;
retval = INT_TO_JSVAL(obj->ref_count);
argv.rval().set(retval);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -90,10 +89,10 @@ gjs_breakpoint(JSContext *context,
{
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
if (!gjs_parse_call_args(context, "breakpoint", "", argv))
- return JS_FALSE;
+ return false;
G_BREAKPOINT();
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -103,10 +102,10 @@ gjs_gc(JSContext *context,
{
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
if (!gjs_parse_call_args(context, "gc", "", argv))
- return JS_FALSE;
+ return false;
JS_GC(JS_GetRuntime(context));
argv.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -117,9 +116,9 @@ gjs_exit(JSContext *context,
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
gint32 ecode;
if (!gjs_parse_call_args(context, "exit", "i", argv, "ecode", &ecode))
- return JS_FALSE;
+ return false;
exit(ecode);
- return JS_TRUE;
+ return true;
}
static JSBool
@@ -138,7 +137,7 @@ gjs_clear_date_caches(JSContext *context,
JS_EndRequest(context);
rec.rval().set(JSVAL_VOID);
- return JS_TRUE;
+ return true;
}
static JSFunctionSpec module_funcs[] = {
@@ -151,22 +150,22 @@ static JSFunctionSpec module_funcs[] = {
{ NULL },
};
-JSBool
+bool
gjs_js_define_system_stuff(JSContext *context,
JSObject **module_out)
{
GjsContext *gjs_context;
char *program_name;
jsval value;
- JSBool retval;
+ bool retval;
JSObject *module;
module = JS_NewObject (context, NULL, NULL, NULL);
if (!JS_DefineFunctions(context, module, &module_funcs[0]))
- return JS_FALSE;
+ return false;
- retval = JS_FALSE;
+ retval = false;
gjs_context = (GjsContext*) JS_GetContextPrivate(context);
g_object_get(gjs_context,
@@ -195,7 +194,7 @@ gjs_js_define_system_stuff(JSContext *context,
GJS_MODULE_PROP_FLAGS | JSPROP_READONLY))
goto out;
- retval = JS_TRUE;
+ retval = true;
out:
g_free(program_name);
diff --git a/modules/system.h b/modules/system.h
index 608de0e..f6984ab 100644
--- a/modules/system.h
+++ b/modules/system.h
@@ -31,8 +31,8 @@
G_BEGIN_DECLS
-JSBool gjs_js_define_system_stuff (JSContext *context,
- JSObject **module_out);
+bool gjs_js_define_system_stuff (JSContext *context,
+ JSObject **module_out);
G_END_DECLS
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 6cade7b..badbbf1 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -150,9 +150,9 @@ gjstest_test_func_gjs_jsapi_util_string_js_string_utf8(void)
global = JS_GetGlobalObject(context);
JSCompartment *oldCompartment = JS_EnterCompartment(context, global);
- g_assert(gjs_string_from_utf8(context, utf8_string, -1, &js_string) == JS_TRUE);
+ g_assert(gjs_string_from_utf8(context, utf8_string, -1, &js_string));
g_assert(JSVAL_IS_STRING(js_string));
- g_assert(gjs_string_to_utf8(context, js_string, &utf8_result) == JS_TRUE);
+ g_assert(gjs_string_to_utf8(context, js_string, &utf8_result));
JS_LeaveCompartment(context, oldCompartment);
_gjs_unit_test_fixture_finish(&fixture);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]