[PATCH] d3d9: Use the available ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Tue Feb 20 16:57:12 CST 2018


Signed-off-by: Michael Stefaniuc <mstefani at 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 5f8827852a..5e0f55838f 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 f7e0eb9e53..5075309638 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);
-- 
2.14.3




More information about the wine-devel mailing list