Copy data structures one at a time using supplied size.
This commit is contained in:
parent
a43a250bd1
commit
c5b0a1792c
|
@ -1060,18 +1060,14 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceData(
|
|||
*entries = 0;
|
||||
nqtail = This->queue_tail;
|
||||
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 */
|
||||
memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize);
|
||||
memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize);
|
||||
/* Advance position */
|
||||
nqtail += span;
|
||||
nqtail++;
|
||||
if (nqtail >= This->queue_len)
|
||||
nqtail -= This->queue_len;
|
||||
*entries += span;
|
||||
len -= span;
|
||||
(*entries)++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -766,17 +766,14 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
|
|||
*entries = 0;
|
||||
nqtail = This->queue_tail;
|
||||
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 */
|
||||
memcpy(dod + *entries, This->data_queue + nqtail, span * dodsize);
|
||||
memcpy((char *)dod + *entries * dodsize, This->data_queue + nqtail, dodsize);
|
||||
/* Advance position */
|
||||
nqtail += span;
|
||||
if (nqtail >= This->queue_len) nqtail -= This->queue_len;
|
||||
*entries += span;
|
||||
len -= span;
|
||||
nqtail++;
|
||||
if (nqtail >= This->queue_len)
|
||||
nqtail -= This->queue_len;
|
||||
(*entries)++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
if (!(flags & DIGDD_PEEK))
|
||||
|
|
Loading…
Reference in New Issue