| 228 | |
| 229 | #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOD) |
| 230 | static size_t |
| 231 | SDL_ScanFloat(const char *text, double *valuep) |
| 232 | { |
| 233 | const char *textstart = text; |
| 234 | unsigned long lvalue = 0; |
| 235 | double value = 0.0; |
| 236 | SDL_bool negative = SDL_FALSE; |
| 237 | |
| 238 | if (*text == '-') { |
| 239 | negative = SDL_TRUE; |
| 240 | ++text; |
| 241 | } |
| 242 | text += SDL_ScanUnsignedLong(text, 10, &lvalue); |
| 243 | value += lvalue; |
| 244 | if (*text == '.') { |
| 245 | int mult = 10; |
| 246 | ++text; |
| 247 | while (SDL_isdigit((unsigned char) *text)) { |
| 248 | lvalue = *text - '0'; |
| 249 | value += (double) lvalue / mult; |
| 250 | mult *= 10; |
| 251 | ++text; |
| 252 | } |
| 253 | } |
| 254 | if (valuep && text > textstart) { |
| 255 | if (negative && value) { |
| 256 | *valuep = -value; |
| 257 | } else { |
| 258 | *valuep = value; |
| 259 | } |
| 260 | } |
| 261 | return (text - textstart); |
| 262 | } |
| 263 | #endif |
| 264 | |
| 265 | void * |
no test coverage detected