libport: Fixed invalid lvalue accesses in memmove.
This commit is contained in:
parent
5d73cfdae8
commit
eb2bedc56d
|
@ -22,25 +22,26 @@
|
|||
#include "wine/port.h"
|
||||
|
||||
#ifndef HAVE_MEMMOVE
|
||||
void *memmove( void *dest, const void *src, size_t len )
|
||||
void *memmove( void *dest, const void *source, size_t len )
|
||||
{
|
||||
register char *dst = dest;
|
||||
register const char *src = source;
|
||||
|
||||
/* Use memcpy if not overlapping */
|
||||
if ((dst + len <= (char *)src) || ((char *)src + len <= dst))
|
||||
if ((dst + len <= src) || (src + len <= dst))
|
||||
{
|
||||
memcpy( dst, src, len );
|
||||
}
|
||||
/* Otherwise do it the hard way (FIXME: could do better than this) */
|
||||
else if (dst < (char *)src)
|
||||
else if (dst < src)
|
||||
{
|
||||
while (len--) *dst++ = *((char *)src)++;
|
||||
while (len--) *dst++ = *src++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst += len - 1;
|
||||
src = (char *)src + len - 1;
|
||||
while (len--) *dst-- = *((char *)src)--;
|
||||
src += len - 1;
|
||||
while (len--) *dst-- = *src--;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue