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,18 +588,16 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
} }
// Set up attributes for surface creation // Set up attributes for surface creation
index = 0;
if (fbconfig->sRGB)
{ {
int index = 0; if (_glfw.egl.KHR_gl_colorspace)
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
if (fbconfig->sRGB)
{
if (_glfw.egl.KHR_gl_colorspace)
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
}
setAttrib(EGL_NONE, EGL_NONE);
} }
setAttrib(EGL_NONE, EGL_NONE);
window->context.egl.surface = window->context.egl.surface =
eglCreateWindowSurface(_glfw.egl.display, eglCreateWindowSurface(_glfw.egl.display,
config, config,

View File

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