Copy data structures one at a time using supplied size.

This commit is contained in:
Robert Reif 2005-01-25 20:05:12 +00:00 committed by Alexandre Julliard
parent a43a250bd1
commit c5b0a1792c
2 changed files with 10 additions and 17 deletions

View File

@ -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--;
}
}

View File

@ -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))