From 190db758350f40cc701d9d7e8fa0c634c37e3a03 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 28 Dec 2015 17:39:24 +0800 Subject: [PATCH] refine code for nx_json modify the data when loads. --- trunk/src/protocol/srs_protocol_json.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trunk/src/protocol/srs_protocol_json.cpp b/trunk/src/protocol/srs_protocol_json.cpp index 3eb85c3ef..cf33b4248 100644 --- a/trunk/src/protocol/srs_protocol_json.cpp +++ b/trunk/src/protocol/srs_protocol_json.cpp @@ -477,8 +477,10 @@ SrsJsonAny* SrsJsonAny::loads(char* str) if (strlen(str) == 0) { return NULL; } - - const nx_json* o = nx_json_parse(str, 0); + + // TODO: copy str for nx_json modify it. + string s = str; + const nx_json* o = nx_json_parse((char*)s.data(), 0); SrsJsonAny* json = srs_json_parse_tree_nx_json(o);