MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_ScanUintPtrT

Function SDL_ScanUintPtrT

deps/SDL2/src/stdlib/SDL_string.c:125–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123
124#ifndef HAVE_VSSCANF
125static size_t
126SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep)
127{
128 const char *textstart = text;
129 uintptr_t value = 0;
130
131 if (radix == 16 && SDL_strncmp(text, "0x", 2) == 0) {
132 text += 2;
133 }
134 for (;;) {
135 int v;
136 if (SDL_isdigit((unsigned char) *text)) {
137 v = *text - '0';
138 } else if (radix == 16 && SDL_isupperhex(*text)) {
139 v = 10 + (*text - 'A');
140 } else if (radix == 16 && SDL_islowerhex(*text)) {
141 v = 10 + (*text - 'a');
142 } else {
143 break;
144 }
145 value *= radix;
146 value += v;
147 ++text;
148 }
149 if (valuep && text > textstart) {
150 *valuep = value;
151 }
152 return (text - textstart);
153}
154#endif
155
156#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOLL)

Callers 1

SDL_vsscanfFunction · 0.85

Calls 2

SDL_strncmpFunction · 0.85
SDL_isdigitFunction · 0.85

Tested by

no test coverage detected