summaryrefslogtreecommitdiff
path: root/src/js.c
diff options
context:
space:
mode:
authorportix <none@none>2012-05-09 01:58:30 +0200
committerportix <none@none>2012-05-09 01:58:30 +0200
commit9a0db1022c1c3375e9865a09fcce4de87f9d3304 (patch)
tree62c575c46cfffa4005fea94b8c98219271330922 /src/js.c
parent76f35a714a9eb14bec987c4e603ff1594b306ac8 (diff)
downloaddwb-9a0db1022c1c3375e9865a09fcce4de87f9d3304.zip
Freeze extensions and data object, real private properties for the signal object.
--HG-- branch : scripts
Diffstat (limited to 'src/js.c')
-rw-r--r--src/js.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/js.c b/src/js.c
index 1a53faf6..4f0add7a 100644
--- a/src/js.c
+++ b/src/js.c
@@ -91,15 +91,13 @@ char *
js_string_to_char(JSContextRef ctx, JSStringRef jsstring, size_t size) {
size_t length;
if (size > 0)
- length = MIN(JSStringGetLength(jsstring), size) + 1;
+ length = MIN(JSStringGetMaximumUTF8CStringSize(jsstring), size);
else
- length = JSStringGetLength(jsstring)+1;
+ length = JSStringGetMaximumUTF8CStringSize(jsstring);
- char *ret = g_new(char, length);
+ char *ret = g_malloc(sizeof(gchar) * length);
size_t written = JSStringGetUTF8CString(jsstring, ret, length);
/* TODO: handle length error */
- if (written != length)
- return NULL;
return ret;
}/*}}}*/