mirror of https://github.com/libsdl-org/SDL.git
Fix undefined behavior in SDL_windowsmouse.c
This fix prevents C undefined behavior from being invoked on Windows if the user's configured cursor speed is below 6.
This commit is contained in:
parent
1c7cc60286
commit
c21bc48a70
|
|
@ -710,7 +710,7 @@ void WIN_UpdateMouseSystemScale(void)
|
||||||
int v = 10;
|
int v = 10;
|
||||||
if (SystemParametersInfo(SPI_GETMOUSESPEED, 0, &v, 0)) {
|
if (SystemParametersInfo(SPI_GETMOUSESPEED, 0, &v, 0)) {
|
||||||
v = SDL_max(1, SDL_min(v, 20));
|
v = SDL_max(1, SDL_min(v, 20));
|
||||||
data->dpiscale = SDL_max(SDL_max(v, (v - 2) << 2), (v - 6) << 3);
|
data->dpiscale = SDL_max(SDL_max(v, (v - 2) * 4), (v - 6) * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
int params[3];
|
int params[3];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue