]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_json: use different string constructor for parser buffer
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 25 Sep 2013 20:04:48 +0000 (13:04 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 27 Sep 2013 23:44:19 +0000 (16:44 -0700)
Fixes: #6397
Previous implementation did not user the constructor with the length
param.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/common/ceph_json.cc

index 84355575c6c99e95e3f9c81f48502e62e3a5c459..a48e0636fcfcf8f9c5b101d6d6d946f1b7e8e115 100644 (file)
@@ -222,9 +222,7 @@ bool JSONParser::parse(const char *buf_, int len)
     return false;
   }
 
-  string json_string = buf_;
-  // make a substring to len
-  json_string = json_string.substr(0, len);
+  string json_string(buf_, len);
   success = read(json_string, data);
   if (success)
     handle_value(data);