Commit c5b0a179 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Copy data structures one at a time using supplied size.

parent a43a250b
...@@ -1060,18 +1060,14 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceData( ...@@ -1060,18 +1060,14 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceData(
*entries = 0; *entries = 0;
nqtail = This->queue_tail; nqtail = This->queue_tail;
while (len) { while (len) {
DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail;
if (span > len)
span = len;
/* Copy the buffered data into the application queue */ /* Copy the buffered data into the application queue */
memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize); memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize);
/* Advance position */ /* Advance position */
nqtail += span; nqtail++;
if (nqtail >= This->queue_len) if (nqtail >= This->queue_len)
nqtail -= This->queue_len; nqtail -= This->queue_len;
*entries += span; (*entries)++;
len -= span; len--;
} }
} }
......
...@@ -766,17 +766,14 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, ...@@ -766,17 +766,14 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
*entries = 0; *entries = 0;
nqtail = This->queue_tail; nqtail = This->queue_tail;
while (len) { while (len) {
DWORD span = ((This->queue_head < nqtail) ? This->queue_len : This->queue_head) - nqtail;
if (span > len)
span = len;
/* Copy the buffered data into the application queue */ /* Copy the buffered data into the application queue */
memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize); memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize);
/* Advance position */ /* Advance position */
nqtail += span; nqtail++;
if (nqtail >= This->queue_len) nqtail -= This->queue_len; if (nqtail >= This->queue_len)
*entries += span; nqtail -= This->queue_len;
len -= span; (*entries)++;
len--;
} }
} }
if (!(flags & DIGDD_PEEK)) if (!(flags & DIGDD_PEEK))
......
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