mirror of
https://github.com/wine-mirror/wine
synced 2024-07-01 07:14:31 +00:00
ntdll: Move the memory copy Rtl functions to string.c.
This commit is contained in:
parent
b563ff18ce
commit
9062376bbf
128
dlls/ntdll/rtl.c
128
dlls/ntdll/rtl.c
|
@ -243,112 +243,6 @@ void * WINAPI RtlLookupElementGenericTable(RTL_GENERIC_TABLE *table, void *buffe
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlMoveMemory [NTDLL.@]
|
||||
*
|
||||
* Move a block of memory that may overlap.
|
||||
*
|
||||
* PARAMS
|
||||
* Destination [O] End destination for block
|
||||
* Source [O] Where to start copying from
|
||||
* Length [I] Number of bytes to copy
|
||||
*
|
||||
* RETURNS
|
||||
* Nothing.
|
||||
*/
|
||||
#undef RtlMoveMemory
|
||||
VOID WINAPI RtlMoveMemory( void *Destination, const void *Source, SIZE_T Length )
|
||||
{
|
||||
memmove(Destination, Source, Length);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlFillMemory [NTDLL.@]
|
||||
*
|
||||
* Set a block of memory with a value.
|
||||
*
|
||||
* PARAMS
|
||||
* Destination [O] Block to fill
|
||||
* Length [I] Number of bytes to fill
|
||||
* Fill [I] Value to set
|
||||
*
|
||||
* RETURNS
|
||||
* Nothing.
|
||||
*/
|
||||
#undef RtlFillMemory
|
||||
VOID WINAPI RtlFillMemory( VOID *Destination, SIZE_T Length, BYTE Fill )
|
||||
{
|
||||
memset(Destination, Fill, Length);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlZeroMemory [NTDLL.@]
|
||||
*
|
||||
* Set a block of memory with 0's.
|
||||
*
|
||||
* PARAMS
|
||||
* Destination [O] Block to fill
|
||||
* Length [I] Number of bytes to fill
|
||||
*
|
||||
* RETURNS
|
||||
* Nothing.
|
||||
*/
|
||||
#undef RtlZeroMemory
|
||||
VOID WINAPI RtlZeroMemory( VOID *Destination, SIZE_T Length )
|
||||
{
|
||||
memset(Destination, 0, Length);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCompareMemory [NTDLL.@]
|
||||
*
|
||||
* Compare one block of memory with another
|
||||
*
|
||||
* PARAMS
|
||||
* Source1 [I] Source block
|
||||
* Source2 [I] Block to compare to Source1
|
||||
* Length [I] Number of bytes to compare
|
||||
*
|
||||
* RETURNS
|
||||
* The length of the first byte at which Source1 and Source2 differ, or Length
|
||||
* if they are the same.
|
||||
*/
|
||||
SIZE_T WINAPI RtlCompareMemory( const VOID *Source1, const VOID *Source2, SIZE_T Length)
|
||||
{
|
||||
SIZE_T i;
|
||||
for(i=0; (i<Length) && (((const BYTE*)Source1)[i]==((const BYTE*)Source2)[i]); i++);
|
||||
return i;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCompareMemoryUlong [NTDLL.@]
|
||||
*
|
||||
* Compare a block of memory with a value, a ULONG at a time
|
||||
*
|
||||
* PARAMS
|
||||
* Source1 [I] Source block. This must be ULONG aligned
|
||||
* Length [I] Number of bytes to compare. This should be a multiple of 4
|
||||
* dwVal [I] Value to compare to
|
||||
*
|
||||
* RETURNS
|
||||
* The byte position of the first byte at which Source1 is not dwVal.
|
||||
*/
|
||||
SIZE_T WINAPI RtlCompareMemoryUlong(VOID *Source1, SIZE_T Length, ULONG dwVal)
|
||||
{
|
||||
SIZE_T i;
|
||||
for(i = 0; i < Length/sizeof(ULONG) && ((ULONG *)Source1)[i] == dwVal; i++);
|
||||
return i * sizeof(ULONG);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCopyMemory [NTDLL.@]
|
||||
*/
|
||||
#undef RtlCopyMemory
|
||||
void WINAPI RtlCopyMemory(void *dest, const void *src, SIZE_T len)
|
||||
{
|
||||
memcpy(dest, src, len);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RtlAssert [NTDLL.@]
|
||||
*
|
||||
|
@ -366,28 +260,6 @@ void WINAPI RtlAssert(void *assertion, void *filename, ULONG linenumber, char *m
|
|||
linenumber, debugstr_a(message));
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* RtlFillMemoryUlong [NTDLL.@]
|
||||
*
|
||||
* Fill memory with a 32 bit (dword) value.
|
||||
*
|
||||
* PARAMS
|
||||
* lpDest [I] Bitmap pointer
|
||||
* ulCount [I] Number of dwords to write
|
||||
* ulValue [I] Value to fill with
|
||||
*
|
||||
* RETURNS
|
||||
* Nothing.
|
||||
*/
|
||||
VOID WINAPI RtlFillMemoryUlong(ULONG* lpDest, ULONG ulCount, ULONG ulValue)
|
||||
{
|
||||
TRACE("(%p,%lu,%lu)\n", lpDest, ulCount, ulValue);
|
||||
|
||||
ulCount /= sizeof(ULONG);
|
||||
while(ulCount--)
|
||||
*lpDest++ = ulValue;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* RtlComputeCrc32 [NTDLL.@]
|
||||
*
|
||||
|
|
|
@ -248,6 +248,79 @@ void *__cdecl memset( void *dst, int c, size_t n )
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCopyMemory (NTDLL.@)
|
||||
*/
|
||||
#undef RtlCopyMemory
|
||||
void WINAPI RtlCopyMemory( void *dest, const void *src, SIZE_T len )
|
||||
{
|
||||
memcpy( dest, src, len );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RtlMoveMemory (NTDLL.@)
|
||||
*/
|
||||
#undef RtlMoveMemory
|
||||
void WINAPI RtlMoveMemory( void *dest, const void *src, SIZE_T len )
|
||||
{
|
||||
memmove( dest, src, len );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RtlFillMemory (NTDLL.@)
|
||||
*/
|
||||
#undef RtlFillMemory
|
||||
void WINAPI RtlFillMemory( VOID *dest, SIZE_T len, BYTE fill )
|
||||
{
|
||||
memset( dest, fill, len );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RtlZeroMemory (NTDLL.@)
|
||||
*/
|
||||
#undef RtlZeroMemory
|
||||
void WINAPI RtlZeroMemory( VOID *dest, SIZE_T len )
|
||||
{
|
||||
memset( dest, 0, len );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCompareMemory (NTDLL.@)
|
||||
*/
|
||||
SIZE_T WINAPI RtlCompareMemory( const void *src1, const void *src2, SIZE_T len )
|
||||
{
|
||||
SIZE_T i = 0;
|
||||
while (i < len && ((const BYTE *)src1)[i] == ((const BYTE *)src2)[i]) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* RtlCompareMemoryUlong (NTDLL.@)
|
||||
*/
|
||||
SIZE_T WINAPI RtlCompareMemoryUlong( void *src, SIZE_T len, ULONG val )
|
||||
{
|
||||
SIZE_T i = 0;
|
||||
len /= sizeof(ULONG);
|
||||
while (i < len && ((ULONG *)src)[i] == val) i++;
|
||||
return i * sizeof(ULONG);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* RtlFillMemoryUlong (NTDLL.@)
|
||||
*/
|
||||
void WINAPI RtlFillMemoryUlong( ULONG *dest, ULONG len, ULONG val )
|
||||
{
|
||||
len /= sizeof(ULONG);
|
||||
while (len--) *dest++ = val;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* strcat (NTDLL.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user