DSOUND_MixerNorm: do not compare unrelated pointers.

This commit is contained in:
Marcus Meissner 2000-04-16 17:05:06 +00:00 committed by Alexandre Julliard
parent 8e8f0f52f7
commit b2dd2c5cee
1 changed files with 4 additions and 5 deletions

View File

@ -1826,14 +1826,13 @@ static INT DSOUND_MixerNorm(IDirectSoundBufferImpl *dsb, BYTE *buf, INT len)
if ((dsb->freq == primarybuf->wfx.nSamplesPerSec) &&
(dsb->wfx.wBitsPerSample == primarybuf->wfx.wBitsPerSample) &&
(dsb->wfx.nChannels == primarybuf->wfx.nChannels)) {
DWORD bytesleft = dsb->buflen - dsb->playpos;
TRACE("(%p) Best case\n", dsb);
if ((ibp + len) < (BYTE *)(dsb->buffer + dsb->buflen))
if (len <= bytesleft )
memcpy(obp, ibp, len);
else { /* wrap */
memcpy(obp, ibp, dsb->buflen - dsb->playpos);
memcpy(obp + (dsb->buflen - dsb->playpos),
dsb->buffer,
len - (dsb->buflen - dsb->playpos));
memcpy(obp, ibp, bytesleft );
memcpy(obp + bytesleft, dsb->buffer, len - bytesleft);
}
return len;
}