kmsdrm: slightly better device index hint parsing.
parent
02c8747176
commit
42165fe8d1
|
@ -81,8 +81,9 @@ get_driindex(void)
|
||||||
|
|
||||||
hint = SDL_GetHint(SDL_HINT_KMSDRM_DEVICE_INDEX);
|
hint = SDL_GetHint(SDL_HINT_KMSDRM_DEVICE_INDEX);
|
||||||
if (hint && *hint) {
|
if (hint && *hint) {
|
||||||
const int idx = SDL_atoi(hint);
|
char *endptr = NULL;
|
||||||
if (idx >= 0) {
|
const int idx = (int) SDL_strtol(hint, &endptr, 10);
|
||||||
|
if ((*endptr == '\0') && (idx >= 0)) { /* *endptr==0 means "whole string was a valid number" */
|
||||||
return idx; /* we'll take the user's request here. */
|
return idx; /* we'll take the user's request here. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue