diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-11 09:28:49 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-11 09:28:49 +0000 |
commit | cce27a3d7516195a56d864d85097ba5c98ccbdf8 (patch) | |
tree | 300d60c918e0bf833a62870d255f435061dd6ca8 /sca-cpp/trunk/modules/json/json.hpp | |
parent | ab81b661aa815cc67b22506f17380dcbdb0a89a0 (diff) |
Upgrade to SpiderMonkey 1.8.5.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1156555 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/json/json.hpp')
-rw-r--r-- | sca-cpp/trunk/modules/json/json.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
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<bool> consume(JSONParser* parser, const list<string>& 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<bool>("JS_ConsumeJSONText failed"); return consume(parser, cdr(ilist), cx); } @@ -95,7 +95,10 @@ public: template<typename R> JSBool writeCallback(const jschar *buf, uint32 len, void *data) { WriteContext<R>& wcx = *(static_cast<WriteContext<R>*> (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; } |