Michael Stefaniuc : d3d9: Use the available ARRAY_SIZE() macro.
Module: wine Branch: master Commit: 417983f2daf60b85850df3f701ba1f9ca32f088c URL: https://source.winehq.org/git/wine.git/?a=commit;h=417983f2daf60b85850df3f70... Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Tue Feb 20 23:57:12 2018 +0100 d3d9: Use the available ARRAY_SIZE() macro. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/device.c | 4 ++-- dlls/d3d9/vertexdeclaration.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5f88278..5e0f558 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2401,7 +2401,7 @@ static HRESULT WINAPI d3d9_device_GetTextureStageState(IDirect3DDevice9Ex *iface TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, state, value); - if (state >= sizeof(tss_lookup) / sizeof(*tss_lookup)) + if (state >= ARRAY_SIZE(tss_lookup)) { WARN("Invalid state %#x passed.\n", state); return D3D_OK; @@ -2421,7 +2421,7 @@ static HRESULT WINAPI d3d9_device_SetTextureStageState(IDirect3DDevice9Ex *iface TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, state, value); - if (state >= sizeof(tss_lookup) / sizeof(*tss_lookup)) + if (state >= ARRAY_SIZE(tss_lookup)) { WARN("Invalid state %#x passed.\n", state); return D3D_OK; diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index f7e0eb9..5075309 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -344,7 +344,7 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elem for (i = 0; i < count; ++i) { - if (d3d9_elements[i].Type >= (sizeof(d3d_dtype_lookup) / sizeof(*d3d_dtype_lookup))) + if (d3d9_elements[i].Type >= ARRAY_SIZE(d3d_dtype_lookup)) { WARN("Invalid element type %#x.\n", d3d9_elements[i].Type); heap_free(*wined3d_elements);
participants (1)
-
Alexandre Julliard