diff --git a/src/egl_context.c b/src/egl_context.c index b2d11a47..5e220de3 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -446,7 +446,7 @@ void _glfwTerminateEGL(void) #define setAttrib(a, v) \ { \ - assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ + assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } diff --git a/src/glx_context.c b/src/glx_context.c index adace82d..1b32f9b5 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -435,7 +435,7 @@ void _glfwTerminateGLX(void) #define setAttrib(a, v) \ { \ - assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ + assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } diff --git a/src/input.c b/src/input.c index 030cbe80..f74cd3fa 100644 --- a/src/input.c +++ b/src/input.c @@ -430,7 +430,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, js->present = GLFW_TRUE; js->name = _glfw_strdup(name); js->axes = calloc(axisCount, sizeof(float)); - js->buttons = calloc(buttonCount + hatCount * 4, 1); + js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->hats = calloc(hatCount, 1); js->axisCount = axisCount; js->buttonCount = buttonCount; diff --git a/src/monitor.c b/src/monitor.c index ad12e56f..40f984bf 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -100,7 +100,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement) { memmove(_glfw.monitors + 1, _glfw.monitors, - (_glfw.monitorCount - 1) * sizeof(_GLFWmonitor*)); + ((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*)); _glfw.monitors[0] = monitor; } else @@ -130,7 +130,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement) _glfw.monitorCount--; memmove(_glfw.monitors + i, _glfw.monitors + i + 1, - (_glfw.monitorCount - i) * sizeof(_GLFWmonitor*)); + ((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*)); break; } } diff --git a/src/osmesa_context.c b/src/osmesa_context.c index 03651ebf..907ad4e0 100644 --- a/src/osmesa_context.c +++ b/src/osmesa_context.c @@ -47,7 +47,7 @@ static void makeContextCurrentOSMesa(_GLFWwindow* window) free(window->context.osmesa.buffer); // Allocate the new buffer (width * height * 8-bit RGBA) - window->context.osmesa.buffer = calloc(4, width * height); + window->context.osmesa.buffer = calloc(4, (size_t) width * height); window->context.osmesa.width = width; window->context.osmesa.height = height; } @@ -188,7 +188,7 @@ void _glfwTerminateOSMesa(void) #define setAttrib(a, v) \ { \ - assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ + assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } diff --git a/src/wgl_context.c b/src/wgl_context.c index 969895b1..754f4b44 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -533,7 +533,7 @@ void _glfwTerminateWGL(void) #define setAttrib(a, v) \ { \ - assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ + assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ attribs[index++] = a; \ attribs[index++] = v; \ } diff --git a/src/win32_joystick.c b/src/win32_joystick.c index 280ab477..d24eed35 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -414,7 +414,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user) memset(&data, 0, sizeof(data)); data.device = device; - data.objects = calloc(dc.dwAxes + dc.dwButtons + dc.dwPOVs, + data.objects = calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs, sizeof(_GLFWjoyobjectWin32)); if (FAILED(IDirectInputDevice8_EnumObjects(device, diff --git a/src/win32_window.c b/src/win32_window.c index 728b6e07..7aca31a7 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -869,9 +869,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_INPUT: { - UINT size; + UINT size = 0; HRAWINPUT ri = (HRAWINPUT) lParam; - RAWINPUT* data; + RAWINPUT* data = NULL; int dx, dy; if (_glfw.win32.disabledCursorWindow != window) @@ -1175,7 +1175,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, for (i = 0; i < count; i++) { const UINT length = DragQueryFileW(drop, i, NULL, 0); - WCHAR* buffer = calloc(length + 1, sizeof(WCHAR)); + WCHAR* buffer = calloc((size_t) length + 1, sizeof(WCHAR)); DragQueryFileW(drop, i, buffer, length + 1); paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);