mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:45:46 +00:00
Share more duplicated functions
svn path=/trunk/; revision=17734
This commit is contained in:
parent
6ce05ab58e
commit
48fe1fb84b
26 changed files with 1099 additions and 1084 deletions
|
@ -11,6 +11,8 @@
|
|||
|
||||
/* DEPENDENCIES **************************************************************/
|
||||
#include <ntnls.h>
|
||||
#include "extypes.h"
|
||||
#include "rtltypes.h"
|
||||
|
||||
/* PROTOTYPES ****************************************************************/
|
||||
|
||||
|
|
|
@ -42,27 +42,6 @@
|
|||
<file>sscanf.c</file>
|
||||
<file>swprintf.c</file>
|
||||
</directory>
|
||||
<directory name="stdlib">
|
||||
<file>abs.c</file>
|
||||
<file>atoi64.c</file>
|
||||
<file>atoi.c</file>
|
||||
<file>atol.c</file>
|
||||
<file>bsearch.c</file>
|
||||
<file>itoa.c</file>
|
||||
<file>itow.c</file>
|
||||
<file>labs.c</file>
|
||||
<file>lfind.c</file>
|
||||
<file>mbstowcs.c</file>
|
||||
<file>splitp.c</file>
|
||||
<file>strtol.c</file>
|
||||
<file>strtoul.c</file>
|
||||
<file>wcstol.c</file>
|
||||
<file>wcstombs.c</file>
|
||||
<file>wcstoul.c</file>
|
||||
<file>wtoi64.c</file>
|
||||
<file>wtoi.c</file>
|
||||
<file>wtol.c</file>
|
||||
</directory>
|
||||
<directory name="def">
|
||||
<file>ntdll.rc</file>
|
||||
</directory>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int
|
||||
abs(int j)
|
||||
{
|
||||
return j<0 ? -j : j;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
long
|
||||
labs(long j)
|
||||
{
|
||||
return j<0 ? -j : j;
|
||||
}
|
10
reactos/lib/string/abs.c
Normal file
10
reactos/lib/string/abs.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int
|
||||
abs(int j)
|
||||
{
|
||||
return j<0 ? -j : j;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,12 +1,5 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/stdlib/atoi64.c
|
||||
* PURPOSE: converts an ascii string to 64 bit integer
|
||||
*/
|
||||
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,5 +1,4 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,21 +1,5 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/ntdll/stdlib/itoa.c
|
||||
* PURPOSE: converts an integer to ascii
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 1995: Created
|
||||
* 1998: Added ltoa Boudewijn Dekker
|
||||
* 2003: Corrected ltoa implementation - Steven Edwards
|
||||
*/
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details
|
||||
* Copyright 2000 Alexandre Julliard
|
||||
* Copyright 2000 Jon Griffiths
|
||||
* Copyright 2003 Thomas Mertes
|
||||
*/
|
||||
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,15 +1,4 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/ntdll/stdlib/itow.c
|
||||
* PURPOSE: converts an integer to Unicode
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 1995: Created
|
||||
* 1998: Added ltoa Boudewijn Dekker
|
||||
*/
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
9
reactos/lib/string/labs.c
Normal file
9
reactos/lib/string/labs.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include <string.h>
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
long
|
||||
labs(long j)
|
||||
{
|
||||
return j<0 ? -j : j;
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
#include <ntdll.h>
|
||||
|
||||
|
||||
#include <string.h>
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
|
@ -1,16 +1,32 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/stdlib/mbstowcs.c
|
||||
* PURPOSE: converts a multi byte string to a unicode string
|
||||
*/
|
||||
|
||||
#include <ntdll.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#define NTOS_MODE_USER
|
||||
#define _NTSYSTEM_
|
||||
#include <ndk/umtypes.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Size;
|
||||
|
||||
if (wchar == NULL)
|
||||
return 0;
|
||||
|
||||
Status = RtlMultiByteToUnicodeN (wchar,
|
||||
sizeof(WCHAR),
|
||||
&Size,
|
||||
(char *)mbchar,
|
||||
count);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return -1;
|
||||
|
||||
return (int)Size;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
29
reactos/lib/string/rand.c
Normal file
29
reactos/lib/string/rand.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
static unsigned long long next = 0;
|
||||
#else
|
||||
static unsigned __int64 next = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int rand(void)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
next = next * 0x5deece66dLL + 11;
|
||||
#else
|
||||
next = next * 0x5deece66di64 + 11;
|
||||
#endif
|
||||
return (int)((next >> 16) & RAND_MAX);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void srand(unsigned seed)
|
||||
{
|
||||
next = seed;
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
#include <ntdll.h>
|
||||
|
||||
#include <string.h>
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
|
@ -76,4 +76,24 @@
|
|||
<file>wstring.c</file>
|
||||
<file>wcsrev.c</file>
|
||||
<file>wcsnset.c</file>
|
||||
<file>abs.c</file>
|
||||
<file>atoi64.c</file>
|
||||
<file>atoi.c</file>
|
||||
<file>atol.c</file>
|
||||
<file>bsearch.c</file>
|
||||
<file>itoa.c</file>
|
||||
<file>itow.c</file>
|
||||
<file>labs.c</file>
|
||||
<file>lfind.c</file>
|
||||
<file>mbstowcs.c</file>
|
||||
<file>splitp.c</file>
|
||||
<file>strtol.c</file>
|
||||
<file>strtoul.c</file>
|
||||
<file>wcstol.c</file>
|
||||
<file>wcstombs.c</file>
|
||||
<file>wcstoul.c</file>
|
||||
<file>wtoi64.c</file>
|
||||
<file>wtoi.c</file>
|
||||
<file>wtol.c</file>
|
||||
<file>rand.c</file>
|
||||
</module>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
* Convert a string to an unsigned long integer.
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,16 +1,30 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/stdlib/wcstombs.c
|
||||
* PURPOSE: converts a unicode string to a multi byte string
|
||||
*/
|
||||
#include <windows.h>
|
||||
#define NTOS_MODE_USER
|
||||
#define _NTSYSTEM_
|
||||
#include <ndk/umtypes.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
#include <ntdll.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int wctomb (char *mbchar, wchar_t wchar)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Size;
|
||||
|
||||
if (mbchar == NULL)
|
||||
return 0;
|
||||
|
||||
Status = RtlUnicodeToMultiByteN (mbchar,
|
||||
1,
|
||||
&Size,
|
||||
&wchar,
|
||||
sizeof(WCHAR));
|
||||
if (!NT_SUCCESS(Status))
|
||||
return -1;
|
||||
|
||||
return (int)Size;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,5 +1,7 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
/*
|
||||
* Convert a unicode string to an unsigned long integer.
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,12 +1,6 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/stdlib/wtoi64.c
|
||||
* PURPOSE: converts a unicode string to 64 bit integer
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ntdll.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <ntdll.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
|
@ -321,7 +321,6 @@
|
|||
<file>purecall.c</file>
|
||||
<file>regio.c</file>
|
||||
<file>sprintf.c</file>
|
||||
<file>stdlib.c</file>
|
||||
<file>strtok.c</file>
|
||||
<file>swprintf.c</file>
|
||||
</directory>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue