| 123 | |
| 124 | #ifndef HAVE_VSSCANF |
| 125 | static size_t |
| 126 | SDL_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) |
no test coverage detected