Win32: Fix VS /W4 compile warnings

These are harmless errors but the code was worth fixing just to reduce
confusion and be more explicit.  E.g. using a different variable name
for a new variable of a different type in win32_joystick.c.

Closes #1700.
This commit is contained in:
ben1 2020-05-25 15:22:25 +10:00 committed by Camilla Löwy
parent 250b94cd03
commit a84a30ab63
2 changed files with 12 additions and 14 deletions

View File

@ -588,8 +588,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
}
// Set up attributes for surface creation
{
int index = 0;
index = 0;
if (fbconfig->sRGB)
{
@ -598,7 +597,6 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
}
setAttrib(EGL_NONE, EGL_NONE);
}
window->context.egl.surface =
eglCreateWindowSurface(_glfw.egl.display,

View File

@ -356,7 +356,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{
_GLFWjoystick* js = _glfw.joysticks + jid;
js = _glfw.joysticks + jid;
if (js->present)
{
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
@ -672,11 +672,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
};
// Screams of horror are appropriate at this point
int state = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
if (state < 0 || state > 8)
state = 8;
int stateIndex = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
if (stateIndex < 0 || stateIndex > 8)
stateIndex = 8;
_glfwInputJoystickHat(js, pi, states[state]);
_glfwInputJoystickHat(js, pi, states[stateIndex]);
pi++;
break;
}