MCPcopy Create free account
hub / github.com/cuberite/cuberite / decodeDouble

Method decodeDouble

lib/jsoncpp/src/lib_json/json_reader.cpp:619–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617
618
619bool
620Reader::decodeDouble( Token &token )
621{
622 double value = 0;
623 const int bufferSize = 32;
624 int count;
625 int length = int(token.end_ - token.start_);
626 if ( length <= bufferSize )
627 {
628 Char buffer[bufferSize];
629 memcpy( buffer, token.start_, length );
630 buffer[length] = 0;
631 count = sscanf( buffer, "%lf", &value );
632 }
633 else
634 {
635 std::string buffer( token.start_, token.end_ );
636 count = sscanf( buffer.c_str(), "%lf", &value );
637 }
638
639 if ( count != 1 )
640 return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token );
641 currentValue() = value;
642 return true;
643}
644
645
646bool

Callers

nothing calls this directly

Calls 2

stringClass · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected