- Remove <string.h> from winnt.h.

- ntdll: complete crt functions, prevent libc imports, fix sscanf.
oldstable
Jon Griffiths 2001-01-22 02:17:29 +00:00 committed by Alexandre Julliard
parent 7a6bad8f10
commit 4ab1558d8a
16 changed files with 274 additions and 17 deletions

View File

@ -5,6 +5,7 @@
* <presently under construction - contact hunnise@nortelnetworks.com>
*
*/
#include <string.h>
#include "winerror.h"
#include "winnt.h"
#include "winreg.h"

View File

@ -8,6 +8,8 @@
#include "winerror.h"
#include "winnls.h"
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
/* Files */
#define MSVCRT_EOF -1

View File

@ -884,11 +884,11 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl _ftol() NTDLL__ftol
@ cdecl _itoa(long ptr long) _itoa
@ cdecl _ltoa(long ptr long) _ltoa
@ stub _memccpy
@ cdecl _memccpy(ptr ptr long long) memccpy
@ cdecl _memicmp(str str long) _memicmp
@ varargs _snprintf(ptr long ptr) snprintf
@ stub _snwprintf
@ stub _splitpath
@ varargs _snwprintf(wstr long wstr) _snwprintf
@ cdecl _splitpath(str str str str str) _splitpath
@ cdecl _strcmpi(str str) strcasecmp
@ cdecl _stricmp(str str) strcasecmp
@ cdecl _strlwr(str) _strlwr
@ -901,14 +901,14 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl _wcslwr(wstr) NTDLL__wcslwr
@ cdecl _wcsnicmp(wstr wstr long) NTDLL__wcsnicmp
@ cdecl _wcsupr(wstr) NTDLL__wcsupr
@ stub abs
@ stub atan
@ cdecl -noimport abs(long) abs
@ cdecl -noimport atan(double) atan
@ cdecl -noimport atoi(str) atoi
@ cdecl -noimport atol(str) atol
@ stub ceil
@ cdecl -noimport ceil(double) ceil
@ cdecl -noimport cos(double) cos
@ stub fabs
@ stub floor
@ cdecl -noimport fabs(double) fabs
@ cdecl -noimport floor(double) floor
@ cdecl isalpha(long) isalpha
@ cdecl isdigit(long) isdigit
@ cdecl islower(long) islower
@ -918,8 +918,8 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl iswalpha(long) NTDLL_iswalpha
@ cdecl iswctype(long long) NTDLL_iswctype
@ cdecl isxdigit(long) isxdigit
@ stub labs
@ stub log
@ cdecl -noimport labs(long) labs
@ cdecl -noimport log(double) log
@ cdecl mbstowcs(ptr str long) NTDLL_mbstowcs
@ cdecl -noimport memchr(ptr long long) memchr
@ cdecl -noimport memcmp(ptr ptr long) memcmp
@ -929,9 +929,9 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl -noimport pow(double double) pow
@ cdecl -noimport qsort(ptr long long ptr) qsort
@ cdecl -noimport sin(double) sin
@ varargs sprintf(str str) sprintf
@ stub sqrt
@ varargs sscanf() sscanf
@ varargs -noimport sprintf(str str) sprintf
@ cdecl -noimport sqrt(double) sqrt
@ varargs -noimport sscanf(str str) sscanf
@ cdecl -noimport strcat(str str) strcat
@ cdecl -noimport strchr(str long) strchr
@ cdecl -noimport strcmp(str str) strcmp
@ -946,13 +946,13 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl -noimport strspn(str str) strspn
@ cdecl -noimport strstr(str str) strstr
@ cdecl -noimport strtol(str ptr long) strtol
@ stub swprintf
@ stub tan
@ varargs swprintf(wstr wstr) NTDLL_swprintf
@ cdecl -noimport tan(double) tan
@ cdecl tolower(long) tolower
@ cdecl toupper(long) toupper
@ cdecl towlower(long) NTDLL_towlower
@ cdecl towupper(long) NTDLL_towupper
@ cdecl vsprintf(ptr str ptr) vsprintf
@ cdecl -noimport vsprintf(ptr str ptr) vsprintf
@ cdecl wcscat(wstr wstr) NTDLL_wcscat
@ cdecl wcschr(wstr long) NTDLL_wcschr
@ cdecl wcscmp(wstr wstr) NTDLL_wcscmp

View File

@ -2,6 +2,7 @@
* NTDLL string functions
*
* Copyright 2000 Alexandre Julliard
* Copyright 2000 Jon Griffiths
*/
#include "config.h"
@ -92,3 +93,90 @@ LPSTR __cdecl _itoa( int x, LPSTR buf, INT radix )
{
return _ltoa( x, buf, radix );
}
/*********************************************************************
* _splitpath (NTDLL)
*/
void __cdecl _splitpath(const char* inpath, char * drv, char * dir,
char* fname, char * ext )
{
/* Modified PD code from 'snippets' collection. */
char ch, *ptr, *p;
char pathbuff[MAX_PATH], *path=pathbuff;
strcpy(pathbuff, inpath);
/* convert slashes to backslashes for searching */
for (ptr = (char*)path; *ptr; ++ptr)
if ('/' == *ptr)
*ptr = '\\';
/* look for drive spec */
if ('\0' != (ptr = strchr(path, ':')))
{
++ptr;
if (drv)
{
strncpy(drv, path, ptr - path);
drv[ptr - path] = '\0';
}
path = ptr;
}
else if (drv)
*drv = '\0';
/* find rightmost backslash or leftmost colon */
if (NULL == (ptr = strrchr(path, '\\')))
ptr = (strchr(path, ':'));
if (!ptr)
{
ptr = (char *)path; /* no path */
if (dir)
*dir = '\0';
}
else
{
++ptr; /* skip the delimiter */
if (dir)
{
ch = *ptr;
*ptr = '\0';
strcpy(dir, path);
*ptr = ch;
}
}
if (NULL == (p = strrchr(ptr, '.')))
{
if (fname)
strcpy(fname, ptr);
if (ext)
*ext = '\0';
}
else
{
*p = '\0';
if (fname)
strcpy(fname, ptr);
*p = '.';
if (ext)
strcpy(ext, p);
}
/* Fix pathological case - Win returns ':' as part of the
* directory when no drive letter is given.
*/
if (drv && drv[0] == ':')
{
*drv = '\0';
if (dir)
{
pathbuff[0] = ':';
pathbuff[1] = '\0';
strcat(pathbuff,dir);
strcpy(dir,pathbuff);
}
}
}

View File

@ -2,13 +2,16 @@
* NTDLL wide-char functions
*
* Copyright 2000 Alexandre Julliard
* Copyright 2000 Jon Griffiths
*/
#include "config.h"
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
@ -334,3 +337,157 @@ LPWSTR __cdecl _ultow(ULONG value, LPWSTR string, INT radix)
*sp = 0;
return string;
}
/* INTERNAL: Wide char snprintf
* If you fix a bug in this function, fix it in msvcrt/wcs.c also!
*/
static int __cdecl NTDLL_vsnwprintf(WCHAR *str, unsigned int len,
const WCHAR *format, va_list valist)
{
unsigned int written = 0;
const WCHAR *iter = format;
char bufa[256], fmtbufa[64], *fmta;
TRACE("(%d,%s)\n",len,debugstr_w(format));
while (*iter)
{
while (*iter && *iter != (WCHAR)L'%')
{
if (written++ >= len)
return -1;
*str++ = *iter++;
}
if (*iter == (WCHAR)L'%')
{
fmta = fmtbufa;
*fmta++ = *iter++;
while (*iter == (WCHAR)L'0' ||
*iter == (WCHAR)L'+' ||
*iter == (WCHAR)L'-' ||
*iter == (WCHAR)L' ' ||
*iter == (WCHAR)L'0' ||
*iter == (WCHAR)L'*' ||
*iter == (WCHAR)L'#')
{
if (*iter == (WCHAR)L'*')
{
char *buffiter = bufa;
int fieldlen = va_arg(valist, int);
sprintf(buffiter, "%d", fieldlen);
while (*buffiter)
*fmta++ = *buffiter++;
}
else
*fmta++ = *iter;
iter++;
}
while (isdigit(*iter))
*fmta++ = *iter++;
if (*iter == (WCHAR)L'.')
{
*fmta++ = *iter++;
if (*iter == (WCHAR)L'*')
{
char *buffiter = bufa;
int fieldlen = va_arg(valist, int);
sprintf(buffiter, "%d", fieldlen);
while (*buffiter)
*fmta++ = *buffiter++;
}
else
while (isdigit(*iter))
*fmta++ = *iter++;
}
if (*iter == (WCHAR)L'h' ||
*iter == (WCHAR)L'l')
{
*fmta++ = *iter++;
*fmta++ = *iter++;
}
switch (*iter)
{
case (WCHAR)L's':
{
static const WCHAR none[] = { '(', 'n', 'u', 'l', 'l', ')', 0 };
const WCHAR *wstr = va_arg(valist, const WCHAR *);
const WCHAR *striter = wstr ? wstr : none;
while (*striter)
{
if (written++ >= len)
return -1;
*str++ = *striter++;
}
iter++;
break;
}
case (WCHAR)L'c':
if (written++ >= len)
return -1;
*str++ = va_arg(valist, WCHAR);
iter++;
break;
default:
{
/* For non wc types, use system sprintf and append to wide char output */
/* FIXME: for unrecognised types, should ignore % when printing */
char *bufaiter = bufa;
if (*iter == (WCHAR)L'p')
sprintf(bufaiter, "%08lX", va_arg(valist, long));
else
{
*fmta++ = *iter;
*fmta = '\0';
sprintf(bufaiter, fmtbufa, va_arg(valist, void *));
}
while (*bufaiter)
{
if (written++ >= len)
return -1;
*str++ = *bufaiter++;
}
iter++;
break;
}
}
}
}
if (written >= len)
return -1;
*str++ = (WCHAR)L'\0';
return (int)written;
}
/***********************************************************************
* _snwprintf (NTDLL)
*/
int __cdecl _snwprintf(WCHAR *str, unsigned int len, const WCHAR *format, ...)
{
int retval;
va_list valist;
va_start(valist, format);
retval = NTDLL_vsnwprintf(str, len, format, valist);
va_end(valist);
return retval;
}
/***********************************************************************
* NTDLL_swprintf (NTDLL)
*/
int __cdecl NTDLL_swprintf(WCHAR *str, const WCHAR *format, ...)
{
int retval;
va_list valist;
va_start(valist, format);
retval = NTDLL_vsnwprintf(str, INT_MAX, format, valist);
va_end(valist);
return retval;
}

View File

@ -4,6 +4,7 @@
*/
#include <stdlib.h>
#include <string.h>
#include "wine/exception.h"

View File

@ -43,6 +43,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "winreg.h"
#include "wine/winuser16.h"
#include "setupx16.h"

View File

@ -10,6 +10,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"

View File

@ -2,6 +2,7 @@
* USER initialization code
*/
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"

View File

@ -31,6 +31,7 @@ HKEY_DYN_DATA
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "debugtools.h"
#include "winreg.h"

View File

@ -28,6 +28,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "internet.h"

View File

@ -7,6 +7,7 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include "winbase.h"
#include "debugtools.h"
#include "heap.h"

View File

@ -11,7 +11,6 @@
#ifndef RC_INVOKED
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#endif

View File

@ -29,6 +29,7 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <string.h>
#include "wine/winbase16.h"
#include "winerror.h"
#include "snoop.h"

View File

@ -8,6 +8,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "config.h"
#include "winnt.h"

View File

@ -12,6 +12,7 @@
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "config.h"
#include "winnt.h"