[PATCH v2 1/8] d3d9: Use ARRAY_SIZE in d3d9_device_GetStreamSource().
Zebediah Figura
z.figura12 at gmail.com
Wed Feb 19 09:23:28 CST 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/d3d9/device.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 3b4c9d5277..2f9a076481 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3709,6 +3709,7 @@ static HRESULT WINAPI d3d9_device_GetStreamSource(IDirect3DDevice9Ex *iface,
UINT stream_idx, IDirect3DVertexBuffer9 **buffer, UINT *offset, UINT *stride)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
+ const struct wined3d_stateblock_state *state;
const struct wined3d_stream_state *stream;
struct d3d9_vertexbuffer *buffer_impl;
@@ -3718,14 +3719,15 @@ static HRESULT WINAPI d3d9_device_GetStreamSource(IDirect3DDevice9Ex *iface,
if (!buffer)
return D3DERR_INVALIDCALL;
- if (stream_idx > WINED3D_MAX_STREAMS)
+ if (stream_idx >= ARRAY_SIZE(state->streams))
{
WARN("Stream index %u out of range.\n", stream_idx);
return WINED3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
- stream = &wined3d_stateblock_get_state(device->state)->streams[stream_idx];
+ state = wined3d_stateblock_get_state(device->state)
+ stream = &state->streams[stream_idx];
if (stream->buffer)
{
buffer_impl = wined3d_buffer_get_parent(stream->buffer);
--
2.25.0
More information about the wine-devel
mailing list