[gjs/wip/ptomato/mozjs31prep] jsapi-util-string: Misc mozjs31 changes
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep] jsapi-util-string: Misc mozjs31 changes
- Date: Thu, 27 Oct 2016 22:02:03 +0000 (UTC)
commit c27577b962666b7d3240d79e39e73aab7b38f0b3
Author: Philip Chimento <philip endlessm com>
Date: Thu Oct 27 13:50:05 2016 -0700
jsapi-util-string: Misc mozjs31 changes
This converts to exact rooting everywhere that would otherwise cause a
compile error in mozjs31.
Also adds a cast in one place since jschar changes signedness from
mozjs24 to mozjs31. This cast does nothing right now, but neither does it
harm anything.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gjs/jsapi-util-string.cpp | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 0b275a6..e2e325a 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -33,7 +33,6 @@ gjs_string_to_utf8 (JSContext *context,
const JS::Value value,
char **utf8_string_p)
{
- JSString *str;
gsize len;
char *bytes;
@@ -46,7 +45,7 @@ gjs_string_to_utf8 (JSContext *context,
return false;
}
- str = value.toString();
+ JS::RootedString str(context, value.toString());
len = JS_GetStringEncodingLength(context, str);
if (len == (gsize)(-1)) {
@@ -242,7 +241,8 @@ gjs_string_to_ucs4(JSContext *cx,
if (ucs4_string_p != NULL) {
long length;
- *ucs4_string_p = g_utf16_to_ucs4(utf16, utf16_len, NULL, &length, &error);
+ *ucs4_string_p = g_utf16_to_ucs4(reinterpret_cast<const gunichar2 *>(utf16),
+ utf16_len, NULL, &length, &error);
if (*ucs4_string_p == NULL) {
gjs_throw(cx, "Failed to convert UTF-16 string to UCS-4: %s",
error->message);
@@ -313,9 +313,9 @@ gjs_get_string_id (JSContext *context,
jsid id,
char **name_p)
{
- JS::Value id_val;
+ JS::RootedValue id_val(context);
- if (!JS_IdToValue(context, id, &id_val))
+ if (!JS_IdToValue(context, id, id_val.address()))
return false;
if (id_val.isString()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]