diff options
author | portix <none@none> | 2012-05-09 01:58:30 +0200 |
---|---|---|
committer | portix <none@none> | 2012-05-09 01:58:30 +0200 |
commit | 9a0db1022c1c3375e9865a09fcce4de87f9d3304 (patch) | |
tree | 62c575c46cfffa4005fea94b8c98219271330922 /src/js.c | |
parent | 76f35a714a9eb14bec987c4e603ff1594b306ac8 (diff) | |
download | dwb-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.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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; }/*}}}*/ |