Commit 1f91697c authored by Camilla Löwy's avatar Camilla Löwy
Browse files

Win32: Fix VS static analysis warnings

parent 334a4859
......@@ -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; \
}
......
......@@ -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; \
}
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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; \
}
......
......@@ -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; \
}
......
......@@ -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,
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment