MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / readValue

Method readValue

src/jsoncpp.cpp:347–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345}
346
347bool Reader::readValue() {
348 // This is a non-reentrant way to support a stackLimit. Terrible!
349 // But this deprecated class has a security problem: Bad input can
350 // cause a seg-fault. This seems like a fair, binary-compatible way
351 // to prevent the problem.
352 if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
353 ++stackDepth_g;
354
355 Token token;
356 skipCommentTokens(token);
357 bool successful = true;
358
359 if (collectComments_ && !commentsBefore_.empty()) {
360 currentValue().setComment(commentsBefore_, commentBefore);
361 commentsBefore_ = "";
362 }
363
364 switch (token.type_) {
365 case tokenObjectBegin:
366 successful = readObject(token);
367 currentValue().setOffsetLimit(current_ - begin_);
368 break;
369 case tokenArrayBegin:
370 successful = readArray(token);
371 currentValue().setOffsetLimit(current_ - begin_);
372 break;
373 case tokenNumber:
374 successful = decodeNumber(token);
375 break;
376 case tokenString:
377 successful = decodeString(token);
378 break;
379 case tokenTrue:
380 {
381 Value v(true);
382 currentValue().swapPayload(v);
383 currentValue().setOffsetStart(token.start_ - begin_);
384 currentValue().setOffsetLimit(token.end_ - begin_);
385 }
386 break;
387 case tokenFalse:
388 {
389 Value v(false);
390 currentValue().swapPayload(v);
391 currentValue().setOffsetStart(token.start_ - begin_);
392 currentValue().setOffsetLimit(token.end_ - begin_);
393 }
394 break;
395 case tokenNull:
396 {
397 Value v;
398 currentValue().swapPayload(v);
399 currentValue().setOffsetStart(token.start_ - begin_);
400 currentValue().setOffsetLimit(token.end_ - begin_);
401 }
402 break;
403 case tokenArraySeparator:
404 case tokenObjectEnd:

Callers

nothing calls this directly

Calls 6

throwRuntimeErrorFunction · 0.85
emptyMethod · 0.80
setCommentMethod · 0.80
setOffsetLimitMethod · 0.80
swapPayloadMethod · 0.80
setOffsetStartMethod · 0.80

Tested by

no test coverage detected