MCPcopy Create free account
hub / github.com/HexHive/NASS / ParseInt

Function ParseInt

binderlib/include_android9/android-base/parseint.h:62–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60// success; 'out' is untouched if parsing fails.
61template <typename T>
62bool ParseInt(const char* s, T* out,
63 T min = std::numeric_limits<T>::min(),
64 T max = std::numeric_limits<T>::max()) {
65 int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
66 errno = 0;
67 char* end;
68 long long int result = strtoll(s, &end, base);
69 if (errno != 0 || s == end || *end != '\0') {
70 return false;
71 }
72 if (result < min || max < result) {
73 return false;
74 }
75 *out = static_cast<T>(result);
76 return true;
77}
78
79// TODO: string_view
80template <typename T>

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.45

Tested by

no test coverage detected