MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / ParseInt64

Function ParseInt64

src/utilstrencodings.cpp:446–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446bool ParseInt64(const std::string& str, int64_t *out)
447{
448 if (!ParsePrechecks(str))
449 return false;
450 char *endp = NULL;
451 errno = 0; // strtoll will not set errno if valid
452 long long int n = strtoll(str.c_str(), &endp, 10);
453 if(out) *out = (int64_t)n;
454 // Note that strtoll returns a *long long int*, so even if strtol doesn't report a over/underflow
455 // we still have to check that the returned value is within the range of an *int64_t*.
456 return endp && *endp == 0 && !errno &&
457 n >= std::numeric_limits<int64_t>::min() &&
458 n <= std::numeric_limits<int64_t>::max();
459}
460
461bool ParseDouble(const std::string& str, double *out)
462{

Callers 2

BOOST_AUTO_TEST_CASEFunction · 0.85
get_int64Method · 0.85

Calls 1

ParsePrechecksFunction · 0.85

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68