From cce27a3d7516195a56d864d85097ba5c98ccbdf8 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Thu, 11 Aug 2011 09:28:49 +0000 Subject: Upgrade to SpiderMonkey 1.8.5. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1156555 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/modules/json/json.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sca-cpp/trunk/modules/json/json.hpp') diff --git a/sca-cpp/trunk/modules/json/json.hpp b/sca-cpp/trunk/modules/json/json.hpp index f35c04208e..e222ef0486 100644 --- a/sca-cpp/trunk/modules/json/json.hpp +++ b/sca-cpp/trunk/modules/json/json.hpp @@ -53,7 +53,7 @@ failable consume(JSONParser* parser, const list& ilist, const js:: if (isNil(ilist)) return true; JSString* jstr = JS_NewStringCopyZ(cx, c_str(car(ilist))); - if(!JS_ConsumeJSONText(cx, parser, JS_GetStringChars(jstr), (uint32)JS_GetStringLength(jstr))) + if(!JS_ConsumeJSONText(cx, parser, JS_GetStringCharsZ(cx, jstr), (uint32)JS_GetStringLength(jstr))) return mkfailure("JS_ConsumeJSONText failed"); return consume(parser, cdr(ilist), cx); } @@ -95,7 +95,10 @@ public: template JSBool writeCallback(const jschar *buf, uint32 len, void *data) { WriteContext& wcx = *(static_cast*> (data)); JSString* jstr = JS_NewUCStringCopyN(wcx.cx, buf, len); - wcx.accum = wcx.reduce(string(JS_GetStringBytes(jstr), JS_GetStringLength(jstr)), wcx.accum); + char* cstr = JS_EncodeString(wcx.cx, jstr); + const string str(cstr, JS_GetStringLength(jstr)); + JS_free(wcx.cx, cstr); + wcx.accum = wcx.reduce(str, wcx.accum); return JS_TRUE; } -- cgit v1.2.3