mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Win32: Fix VS static analysis warnings
This commit is contained in:
parent
334a485968
commit
1f91697cd3
@ -446,7 +446,7 @@ void _glfwTerminateEGL(void)
|
|||||||
|
|
||||||
#define setAttrib(a, v) \
|
#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++] = a; \
|
||||||
attribs[index++] = v; \
|
attribs[index++] = v; \
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ void _glfwTerminateGLX(void)
|
|||||||
|
|
||||||
#define setAttrib(a, v) \
|
#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++] = a; \
|
||||||
attribs[index++] = v; \
|
attribs[index++] = v; \
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
|||||||
js->present = GLFW_TRUE;
|
js->present = GLFW_TRUE;
|
||||||
js->name = _glfw_strdup(name);
|
js->name = _glfw_strdup(name);
|
||||||
js->axes = calloc(axisCount, sizeof(float));
|
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->hats = calloc(hatCount, 1);
|
||||||
js->axisCount = axisCount;
|
js->axisCount = axisCount;
|
||||||
js->buttonCount = buttonCount;
|
js->buttonCount = buttonCount;
|
||||||
|
@ -100,7 +100,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
|
|||||||
{
|
{
|
||||||
memmove(_glfw.monitors + 1,
|
memmove(_glfw.monitors + 1,
|
||||||
_glfw.monitors,
|
_glfw.monitors,
|
||||||
(_glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
|
((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
|
||||||
_glfw.monitors[0] = monitor;
|
_glfw.monitors[0] = monitor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -130,7 +130,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
|
|||||||
_glfw.monitorCount--;
|
_glfw.monitorCount--;
|
||||||
memmove(_glfw.monitors + i,
|
memmove(_glfw.monitors + i,
|
||||||
_glfw.monitors + i + 1,
|
_glfw.monitors + i + 1,
|
||||||
(_glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
|
((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ static void makeContextCurrentOSMesa(_GLFWwindow* window)
|
|||||||
free(window->context.osmesa.buffer);
|
free(window->context.osmesa.buffer);
|
||||||
|
|
||||||
// Allocate the new buffer (width * height * 8-bit RGBA)
|
// 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.width = width;
|
||||||
window->context.osmesa.height = height;
|
window->context.osmesa.height = height;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ void _glfwTerminateOSMesa(void)
|
|||||||
|
|
||||||
#define setAttrib(a, v) \
|
#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++] = a; \
|
||||||
attribs[index++] = v; \
|
attribs[index++] = v; \
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ void _glfwTerminateWGL(void)
|
|||||||
|
|
||||||
#define setAttrib(a, v) \
|
#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++] = a; \
|
||||||
attribs[index++] = v; \
|
attribs[index++] = v; \
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|||||||
|
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.device = device;
|
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));
|
sizeof(_GLFWjoyobjectWin32));
|
||||||
|
|
||||||
if (FAILED(IDirectInputDevice8_EnumObjects(device,
|
if (FAILED(IDirectInputDevice8_EnumObjects(device,
|
||||||
|
@ -869,9 +869,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_INPUT:
|
case WM_INPUT:
|
||||||
{
|
{
|
||||||
UINT size;
|
UINT size = 0;
|
||||||
HRAWINPUT ri = (HRAWINPUT) lParam;
|
HRAWINPUT ri = (HRAWINPUT) lParam;
|
||||||
RAWINPUT* data;
|
RAWINPUT* data = NULL;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
|
||||||
if (_glfw.win32.disabledCursorWindow != window)
|
if (_glfw.win32.disabledCursorWindow != window)
|
||||||
@ -1175,7 +1175,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
const UINT length = DragQueryFileW(drop, i, NULL, 0);
|
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);
|
DragQueryFileW(drop, i, buffer, length + 1);
|
||||||
paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);
|
paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user