MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / readUIntText

Function readUIntText

base/base/JSON.cpp:20–53  ·  view source on GitHub ↗

Read unsigned integer in a simple form from a non-0-terminated string.

Source from the content-addressed store, hash-verified

18
19/// Read unsigned integer in a simple form from a non-0-terminated string.
20static UInt64 readUIntText(const char * buf, const char * end)
21{
22 UInt64 x = 0;
23
24 if (buf == end)
25 throw JSONException("JSON: cannot parse unsigned integer: unexpected end of data.");
26
27 while (buf != end)
28 {
29 switch (*buf)
30 {
31 case '+':
32 break;
33 case '0':
34 case '1':
35 case '2':
36 case '3':
37 case '4':
38 case '5':
39 case '6':
40 case '7':
41 case '8':
42 case '9':
43 x *= 10;
44 x += *buf - '0';
45 break;
46 default:
47 return x;
48 }
49 ++buf;
50 }
51
52 return x;
53}
54
55
56/// Read signed integer in a simple form from a non-0-terminated string.

Callers 2

getUIntMethod · 0.85
getUIntMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected