MCPcopy Create free account
hub / github.com/ceph/ceph / decode_json_obj

Function decode_json_obj

src/common/ceph_json.cc:306–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304
305
306void decode_json_obj(long& val, JSONObj *obj)
307{
308 string s = obj->get_data();
309 const char *start = s.c_str();
310 char *p;
311
312 errno = 0;
313 val = strtol(start, &p, 10);
314
315 /* Check for various possible errors */
316
317 if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) ||
318 (errno != 0 && val == 0)) {
319 throw JSONDecoder::err("failed to parse number");
320 }
321
322 if (p == start) {
323 throw JSONDecoder::err("failed to parse number");
324 }
325
326 while (*p != '\0') {
327 if (!isspace(*p)) {
328 throw JSONDecoder::err("failed to parse number");
329 }
330 p++;
331 }
332}
333
334void decode_json_obj(unsigned long& val, JSONObj *obj)
335{

Callers

nothing calls this directly

Calls 8

decode_jsonFunction · 0.85
errClass · 0.70
utime_tClass · 0.70
get_dataMethod · 0.45
c_strMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45
decode_base64Method · 0.45

Tested by

no test coverage detected