[gjs/wip/gobj-kitchen-sink: 13/26] util: Add a new format specifier to gjs_parse_args specifying a 64-bit integer
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/gobj-kitchen-sink: 13/26] util: Add a new format specifier to gjs_parse_args specifying a 64-bit integer
- Date: Sat, 28 Jan 2012 09:04:38 +0000 (UTC)
commit 761f4b22ee178b9ff3f2dfc7a4cb90b9cd660108
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Jan 27 18:09:32 2012 -0500
util: Add a new format specifier to gjs_parse_args specifying a 64-bit integer
gjs/jsapi-util.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index f5dfd06..6f0fd4b 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -1378,6 +1378,7 @@ gjs_value_to_int64 (JSContext *context,
* F: A string, converted into "filename encoding" (i.e. active locale)
* i: A number, will be converted to a C "gint32"
* u: A number, converted into a C "guint32"
+ * 6: A 64-bit number, converted into a C "guint64" by way of gjs_value_to_int64()
* o: A JavaScript object, as a "JSObject *"
*
* If the first character in the format string is a '!', then JS is allowed
@@ -1521,6 +1522,14 @@ gjs_parse_args (JSContext *context,
}
}
break;
+ case '6': {
+ if (!gjs_value_to_int64(context, js_value, (gint64*) arg_location)) {
+ /* Our error message is going to be more useful */
+ JS_ClearPendingException(context);
+ arg_error_message = "Couldn't convert to 64-bit integer";
+ }
+ }
+ break;
case 'f': {
double num;
if (!JS_ValueToNumber(context, js_value, &num)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]