Commit 5f31b329 authored by Alexandre Julliard's avatar Alexandre Julliard

Use MSVCRT_wchar_t instead of WCHAR so that the implementation matches

the prototypes.
parent 041756d8
...@@ -218,7 +218,7 @@ int MSVCRT___toascii(int c) ...@@ -218,7 +218,7 @@ int MSVCRT___toascii(int c)
* iswascii (MSVCRT.@) * iswascii (MSVCRT.@)
* *
*/ */
int MSVCRT_iswascii(WCHAR c) int MSVCRT_iswascii(MSVCRT_wchar_t c)
{ {
return ((unsigned)c < 0x80); return ((unsigned)c < 0x80);
} }
......
...@@ -53,13 +53,13 @@ unsigned int MSVCRT___setlc_active; ...@@ -53,13 +53,13 @@ unsigned int MSVCRT___setlc_active;
unsigned int MSVCRT___unguarded_readlc_active; unsigned int MSVCRT___unguarded_readlc_active;
double MSVCRT__HUGE; double MSVCRT__HUGE;
char **MSVCRT___argv; char **MSVCRT___argv;
WCHAR **MSVCRT___wargv; MSVCRT_wchar_t **MSVCRT___wargv;
char *MSVCRT__acmdln; char *MSVCRT__acmdln;
WCHAR *MSVCRT__wcmdln; MSVCRT_wchar_t *MSVCRT__wcmdln;
char **MSVCRT__environ = 0; char **MSVCRT__environ = 0;
WCHAR **MSVCRT__wenviron = 0; MSVCRT_wchar_t **MSVCRT__wenviron = 0;
char **MSVCRT___initenv = 0; char **MSVCRT___initenv = 0;
WCHAR **MSVCRT___winitenv = 0; MSVCRT_wchar_t **MSVCRT___winitenv = 0;
int MSVCRT_timezone; int MSVCRT_timezone;
int MSVCRT_app_type; int MSVCRT_app_type;
...@@ -104,11 +104,11 @@ char ** msvcrt_SnapshotOfEnvironmentA(char **blk) ...@@ -104,11 +104,11 @@ char ** msvcrt_SnapshotOfEnvironmentA(char **blk)
return blk; return blk;
} }
WCHAR ** msvcrt_SnapshotOfEnvironmentW(WCHAR **wblk) MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **wblk)
{ {
WCHAR* wenviron_strings = GetEnvironmentStringsW(); MSVCRT_wchar_t* wenviron_strings = GetEnvironmentStringsW();
int count = 1, len = 1, i = 0; /* keep space for the trailing NULLS */ int count = 1, len = 1, i = 0; /* keep space for the trailing NULLS */
WCHAR *wptr; MSVCRT_wchar_t *wptr;
for (wptr = wenviron_strings; *wptr; wptr += strlenW(wptr) + 1) for (wptr = wenviron_strings; *wptr; wptr += strlenW(wptr) + 1)
{ {
...@@ -116,15 +116,15 @@ WCHAR ** msvcrt_SnapshotOfEnvironmentW(WCHAR **wblk) ...@@ -116,15 +116,15 @@ WCHAR ** msvcrt_SnapshotOfEnvironmentW(WCHAR **wblk)
len += strlenW(wptr) + 1; len += strlenW(wptr) + 1;
} }
if (wblk) if (wblk)
wblk = HeapReAlloc( GetProcessHeap(), 0, wblk, count* sizeof(WCHAR*) + len * sizeof(WCHAR)); wblk = HeapReAlloc( GetProcessHeap(), 0, wblk, count* sizeof(MSVCRT_wchar_t*) + len * sizeof(MSVCRT_wchar_t));
else else
wblk = HeapAlloc(GetProcessHeap(), 0, count* sizeof(WCHAR*) + len * sizeof(WCHAR)); wblk = HeapAlloc(GetProcessHeap(), 0, count* sizeof(MSVCRT_wchar_t*) + len * sizeof(MSVCRT_wchar_t));
if (wblk) if (wblk)
{ {
if (count) if (count)
{ {
memcpy(&wblk[count],wenviron_strings,len * sizeof(WCHAR)); memcpy(&wblk[count],wenviron_strings,len * sizeof(MSVCRT_wchar_t));
for (wptr = (WCHAR*)&wblk[count]; *wptr; wptr += strlenW(wptr) + 1) for (wptr = (MSVCRT_wchar_t*)&wblk[count]; *wptr; wptr += strlenW(wptr) + 1)
{ {
wblk[i++] = wptr; wblk[i++] = wptr;
} }
...@@ -180,7 +180,7 @@ char** __p__acmdln(void) { return &MSVCRT__acmdln; } ...@@ -180,7 +180,7 @@ char** __p__acmdln(void) { return &MSVCRT__acmdln; }
/********************************************************************* /*********************************************************************
* __p__wcmdln (MSVCRT.@) * __p__wcmdln (MSVCRT.@)
*/ */
WCHAR** __p__wcmdln(void) { return &MSVCRT__wcmdln; } MSVCRT_wchar_t** __p__wcmdln(void) { return &MSVCRT__wcmdln; }
/********************************************************************* /*********************************************************************
* __p___argv (MSVCRT.@) * __p___argv (MSVCRT.@)
...@@ -190,7 +190,7 @@ char*** __p___argv(void) { return &MSVCRT___argv; } ...@@ -190,7 +190,7 @@ char*** __p___argv(void) { return &MSVCRT___argv; }
/********************************************************************* /*********************************************************************
* __p___wargv (MSVCRT.@) * __p___wargv (MSVCRT.@)
*/ */
WCHAR*** __p___wargv(void) { return &MSVCRT___wargv; } MSVCRT_wchar_t*** __p___wargv(void) { return &MSVCRT___wargv; }
/********************************************************************* /*********************************************************************
* __p__environ (MSVCRT.@) * __p__environ (MSVCRT.@)
...@@ -205,7 +205,7 @@ char*** __p__environ(void) ...@@ -205,7 +205,7 @@ char*** __p__environ(void)
/********************************************************************* /*********************************************************************
* __p__wenviron (MSVCRT.@) * __p__wenviron (MSVCRT.@)
*/ */
WCHAR*** __p__wenviron(void) MSVCRT_wchar_t*** __p__wenviron(void)
{ {
if (!MSVCRT__wenviron) if (!MSVCRT__wenviron)
MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(NULL); MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(NULL);
...@@ -220,7 +220,7 @@ char*** __p___initenv(void) { return &MSVCRT___initenv; } ...@@ -220,7 +220,7 @@ char*** __p___initenv(void) { return &MSVCRT___initenv; }
/********************************************************************* /*********************************************************************
* __p___winitenv (MSVCRT.@) * __p___winitenv (MSVCRT.@)
*/ */
WCHAR*** __p___winitenv(void) { return &MSVCRT___winitenv; } MSVCRT_wchar_t*** __p___winitenv(void) { return &MSVCRT___winitenv; }
/********************************************************************* /*********************************************************************
* __p__timezone (MSVCRT.@) * __p__timezone (MSVCRT.@)
...@@ -228,13 +228,13 @@ WCHAR*** __p___winitenv(void) { return &MSVCRT___winitenv; } ...@@ -228,13 +228,13 @@ WCHAR*** __p___winitenv(void) { return &MSVCRT___winitenv; }
int* __p__timezone(void) { return &MSVCRT_timezone; } int* __p__timezone(void) { return &MSVCRT_timezone; }
/* INTERNAL: Create a wide string from an ascii string */ /* INTERNAL: Create a wide string from an ascii string */
static WCHAR *wstrdupa(const char *str) static MSVCRT_wchar_t *wstrdupa(const char *str)
{ {
const size_t len = strlen(str) + 1 ; const size_t len = strlen(str) + 1 ;
WCHAR *wstr = MSVCRT_malloc(len* sizeof (WCHAR)); MSVCRT_wchar_t *wstr = MSVCRT_malloc(len* sizeof (MSVCRT_wchar_t));
if (!wstr) if (!wstr)
return NULL; return NULL;
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,str,len*sizeof(char),wstr,len* sizeof (WCHAR)); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,str,len,wstr,len);
return wstr; return wstr;
} }
...@@ -308,8 +308,8 @@ void __getmainargs(int *argc, char** *argv, char** *envp, ...@@ -308,8 +308,8 @@ void __getmainargs(int *argc, char** *argv, char** *envp,
/********************************************************************* /*********************************************************************
* __wgetmainargs (MSVCRT.@) * __wgetmainargs (MSVCRT.@)
*/ */
void __wgetmainargs(int *argc, WCHAR** *wargv, WCHAR** *wenvp, void __wgetmainargs(int *argc, MSVCRT_wchar_t** *wargv, MSVCRT_wchar_t** *wenvp,
int expand_wildcards, int *new_mode) int expand_wildcards, int *new_mode)
{ {
TRACE("(%p,%p,%p,%d,%p).\n", argc, wargv, wenvp, expand_wildcards, new_mode); TRACE("(%p,%p,%p,%d,%p).\n", argc, wargv, wenvp, expand_wildcards, new_mode);
*argc = MSVCRT___argc; *argc = MSVCRT___argc;
......
...@@ -97,7 +97,7 @@ int _chdir(const char * newdir) ...@@ -97,7 +97,7 @@ int _chdir(const char * newdir)
/********************************************************************* /*********************************************************************
* _wchdir (MSVCRT.@) * _wchdir (MSVCRT.@)
*/ */
int _wchdir(const WCHAR * newdir) int _wchdir(const MSVCRT_wchar_t * newdir)
{ {
if (!SetCurrentDirectoryW(newdir)) if (!SetCurrentDirectoryW(newdir))
{ {
...@@ -160,7 +160,7 @@ long _findfirst(const char * fspec, struct _finddata_t* ft) ...@@ -160,7 +160,7 @@ long _findfirst(const char * fspec, struct _finddata_t* ft)
/********************************************************************* /*********************************************************************
* _wfindfirst (MSVCRT.@) * _wfindfirst (MSVCRT.@)
*/ */
long _wfindfirst(const WCHAR * fspec, struct _wfinddata_t* ft) long _wfindfirst(const MSVCRT_wchar_t * fspec, struct _wfinddata_t* ft)
{ {
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;
HANDLE hfind; HANDLE hfind;
...@@ -239,9 +239,9 @@ char* _getcwd(char * buf, int size) ...@@ -239,9 +239,9 @@ char* _getcwd(char * buf, int size)
/********************************************************************* /*********************************************************************
* _wgetcwd (MSVCRT.@) * _wgetcwd (MSVCRT.@)
*/ */
WCHAR* _wgetcwd(WCHAR * buf, int size) MSVCRT_wchar_t* _wgetcwd(MSVCRT_wchar_t * buf, int size)
{ {
WCHAR dir[MAX_PATH]; MSVCRT_wchar_t dir[MAX_PATH];
int dir_len = GetCurrentDirectoryW(MAX_PATH,dir); int dir_len = GetCurrentDirectoryW(MAX_PATH,dir);
if (dir_len < 1) if (dir_len < 1)
...@@ -316,9 +316,9 @@ char* _getdcwd(int drive, char * buf, int size) ...@@ -316,9 +316,9 @@ char* _getdcwd(int drive, char * buf, int size)
/********************************************************************* /*********************************************************************
* _wgetdcwd (MSVCRT.@) * _wgetdcwd (MSVCRT.@)
*/ */
WCHAR* _wgetdcwd(int drive, WCHAR * buf, int size) MSVCRT_wchar_t* _wgetdcwd(int drive, MSVCRT_wchar_t * buf, int size)
{ {
static WCHAR* dummy; static MSVCRT_wchar_t* dummy;
TRACE(":drive %d(%c), size %d\n",drive, drive + 'A' - 1, size); TRACE(":drive %d(%c), size %d\n",drive, drive + 'A' - 1, size);
...@@ -326,8 +326,8 @@ WCHAR* _wgetdcwd(int drive, WCHAR * buf, int size) ...@@ -326,8 +326,8 @@ WCHAR* _wgetdcwd(int drive, WCHAR * buf, int size)
return _wgetcwd(buf,size); /* current */ return _wgetcwd(buf,size); /* current */
else else
{ {
WCHAR dir[MAX_PATH]; MSVCRT_wchar_t dir[MAX_PATH];
WCHAR drivespec[4] = {'A', ':', '\\', 0}; MSVCRT_wchar_t drivespec[4] = {'A', ':', '\\', 0};
int dir_len; int dir_len;
drivespec[0] += drive - 1; drivespec[0] += drive - 1;
...@@ -393,7 +393,7 @@ int _mkdir(const char * newdir) ...@@ -393,7 +393,7 @@ int _mkdir(const char * newdir)
/********************************************************************* /*********************************************************************
* _wmkdir (MSVCRT.@) * _wmkdir (MSVCRT.@)
*/ */
int _wmkdir(const WCHAR* newdir) int _wmkdir(const MSVCRT_wchar_t* newdir)
{ {
if (CreateDirectoryW(newdir,NULL)) if (CreateDirectoryW(newdir,NULL))
return 0; return 0;
...@@ -415,7 +415,7 @@ int _rmdir(const char * dir) ...@@ -415,7 +415,7 @@ int _rmdir(const char * dir)
/********************************************************************* /*********************************************************************
* _wrmdir (MSVCRT.@) * _wrmdir (MSVCRT.@)
*/ */
int _wrmdir(const WCHAR * dir) int _wrmdir(const MSVCRT_wchar_t * dir)
{ {
if (RemoveDirectoryW(dir)) if (RemoveDirectoryW(dir))
return 0; return 0;
...@@ -426,45 +426,45 @@ int _wrmdir(const WCHAR * dir) ...@@ -426,45 +426,45 @@ int _wrmdir(const WCHAR * dir)
/********************************************************************* /*********************************************************************
* _wsplitpath (MSVCRT.@) * _wsplitpath (MSVCRT.@)
*/ */
void _wsplitpath(const WCHAR *inpath, WCHAR *drv, WCHAR *dir, void _wsplitpath(const MSVCRT_wchar_t *inpath, MSVCRT_wchar_t *drv, MSVCRT_wchar_t *dir,
WCHAR *fname, WCHAR *ext ) MSVCRT_wchar_t *fname, MSVCRT_wchar_t *ext )
{ {
/* Modified PD code from 'snippets' collection. */ /* Modified PD code from 'snippets' collection. */
WCHAR ch, *ptr, *p; MSVCRT_wchar_t ch, *ptr, *p;
WCHAR pathbuff[MAX_PATH],*path=pathbuff; MSVCRT_wchar_t pathbuff[MAX_PATH],*path=pathbuff;
TRACE(":splitting path %s\n",debugstr_w(path)); TRACE(":splitting path %s\n",debugstr_w(path));
/* FIXME: Should be an strncpyW or something */ /* FIXME: Should be an strncpyW or something */
strcpyW(pathbuff, inpath); strcpyW(pathbuff, inpath);
/* convert slashes to backslashes for searching */ /* convert slashes to backslashes for searching */
for (ptr = (WCHAR*)path; *ptr; ++ptr) for (ptr = (MSVCRT_wchar_t*)path; *ptr; ++ptr)
if (*ptr == (WCHAR)L'/') if (*ptr == '/')
*ptr = (WCHAR)L'\\'; *ptr = '\\';
/* look for drive spec */ /* look for drive spec */
if ((ptr = strchrW(path, (WCHAR)L':')) != (WCHAR)L'\0') if ((ptr = strchrW(path, ':')) != 0)
{ {
++ptr; ++ptr;
if (drv) if (drv)
{ {
strncpyW(drv, path, ptr - path); strncpyW(drv, path, ptr - path);
drv[ptr - path] = (WCHAR)L'\0'; drv[ptr - path] = 0;
} }
path = ptr; path = ptr;
} }
else if (drv) else if (drv)
*drv = (WCHAR)L'\0'; *drv = 0;
/* find rightmost backslash or leftmost colon */ /* find rightmost backslash or leftmost colon */
if ((ptr = strrchrW(path, (WCHAR)L'\\')) == NULL) if ((ptr = strrchrW(path, '\\')) == NULL)
ptr = (strchrW(path, (WCHAR)L':')); ptr = (strchrW(path, ':'));
if (!ptr) if (!ptr)
{ {
ptr = (WCHAR *)path; /* no path */ ptr = (MSVCRT_wchar_t *)path; /* no path */
if (dir) if (dir)
*dir = (WCHAR)L'\0'; *dir = 0;
} }
else else
{ {
...@@ -472,25 +472,25 @@ void _wsplitpath(const WCHAR *inpath, WCHAR *drv, WCHAR *dir, ...@@ -472,25 +472,25 @@ void _wsplitpath(const WCHAR *inpath, WCHAR *drv, WCHAR *dir,
if (dir) if (dir)
{ {
ch = *ptr; ch = *ptr;
*ptr = (WCHAR)L'\0'; *ptr = 0;
strcpyW(dir, path); strcpyW(dir, path);
*ptr = ch; *ptr = ch;
} }
} }
if ((p = strrchrW(ptr, (WCHAR)L'.')) == NULL) if ((p = strrchrW(ptr, '.')) == NULL)
{ {
if (fname) if (fname)
strcpyW(fname, ptr); strcpyW(fname, ptr);
if (ext) if (ext)
*ext = (WCHAR)L'\0'; *ext = 0;
} }
else else
{ {
*p = (WCHAR)L'\0'; *p = 0;
if (fname) if (fname)
strcpyW(fname, ptr); strcpyW(fname, ptr);
*p = (WCHAR)L'.'; *p = '.';
if (ext) if (ext)
strcpyW(ext, p); strcpyW(ext, p);
} }
...@@ -498,13 +498,13 @@ void _wsplitpath(const WCHAR *inpath, WCHAR *drv, WCHAR *dir, ...@@ -498,13 +498,13 @@ void _wsplitpath(const WCHAR *inpath, WCHAR *drv, WCHAR *dir,
/* Fix pathological case - Win returns ':' as part of the /* Fix pathological case - Win returns ':' as part of the
* directory when no drive letter is given. * directory when no drive letter is given.
*/ */
if (drv && drv[0] == (WCHAR)L':') if (drv && drv[0] == ':')
{ {
*drv = (WCHAR)L'\0'; *drv = 0;
if (dir) if (dir)
{ {
pathbuff[0] = (WCHAR)L':'; pathbuff[0] = ':';
pathbuff[1] = (WCHAR)L'\0'; pathbuff[1] = 0;
strcatW(pathbuff,dir); strcatW(pathbuff,dir);
strcpyW(dir, pathbuff); strcpyW(dir, pathbuff);
} }
...@@ -714,10 +714,10 @@ VOID _makepath(char * path, const char * drive, ...@@ -714,10 +714,10 @@ VOID _makepath(char * path, const char * drive,
/********************************************************************* /*********************************************************************
* _wmakepath (MSVCRT.@) * _wmakepath (MSVCRT.@)
*/ */
VOID _wmakepath(WCHAR *path, const WCHAR *drive, const WCHAR *directory, VOID _wmakepath(MSVCRT_wchar_t *path, const MSVCRT_wchar_t *drive, const MSVCRT_wchar_t *directory,
const WCHAR *filename, const WCHAR *extension) const MSVCRT_wchar_t *filename, const MSVCRT_wchar_t *extension)
{ {
WCHAR ch; MSVCRT_wchar_t ch;
TRACE("%s %s %s %s\n", debugstr_w(drive), debugstr_w(directory), TRACE("%s %s %s %s\n", debugstr_w(drive), debugstr_w(directory),
debugstr_w(filename), debugstr_w(extension)); debugstr_w(filename), debugstr_w(extension));
...@@ -737,7 +737,7 @@ VOID _wmakepath(WCHAR *path, const WCHAR *drive, const WCHAR *directory, ...@@ -737,7 +737,7 @@ VOID _wmakepath(WCHAR *path, const WCHAR *drive, const WCHAR *directory,
ch = path[strlenW(path) - 1]; ch = path[strlenW(path) - 1];
if (ch != '/' && ch != '\\') if (ch != '/' && ch != '\\')
{ {
static const WCHAR backslashW[] = {'\\',0}; static const MSVCRT_wchar_t backslashW[] = {'\\',0};
strcatW(path, backslashW); strcatW(path, backslashW);
} }
} }
...@@ -748,7 +748,7 @@ VOID _wmakepath(WCHAR *path, const WCHAR *drive, const WCHAR *directory, ...@@ -748,7 +748,7 @@ VOID _wmakepath(WCHAR *path, const WCHAR *drive, const WCHAR *directory,
{ {
if ( extension[0] != '.' ) if ( extension[0] != '.' )
{ {
static const WCHAR dotW[] = {'.',0}; static const MSVCRT_wchar_t dotW[] = {'.',0};
strcatW(path, dotW); strcatW(path, dotW);
} }
strcatW(path, extension); strcatW(path, extension);
......
...@@ -61,10 +61,10 @@ char *MSVCRT_getenv(const char *name) ...@@ -61,10 +61,10 @@ char *MSVCRT_getenv(const char *name)
/********************************************************************* /*********************************************************************
* _wgetenv (MSVCRT.@) * _wgetenv (MSVCRT.@)
*/ */
WCHAR *_wgetenv(const WCHAR *name) MSVCRT_wchar_t *_wgetenv(const MSVCRT_wchar_t *name)
{ {
WCHAR* environ = GetEnvironmentStringsW(); MSVCRT_wchar_t* environ = GetEnvironmentStringsW();
WCHAR* pp,*pos = NULL; MSVCRT_wchar_t* pp,*pos = NULL;
unsigned int length=strlenW(name); unsigned int length=strlenW(name);
for (pp = environ; (*pp); pp = pp + strlenW(pp) + 1) for (pp = environ; (*pp); pp = pp + strlenW(pp) + 1)
...@@ -122,25 +122,25 @@ int _putenv(const char *str) ...@@ -122,25 +122,25 @@ int _putenv(const char *str)
/********************************************************************* /*********************************************************************
* _wputenv (MSVCRT.@) * _wputenv (MSVCRT.@)
*/ */
int _wputenv(const WCHAR *str) int _wputenv(const MSVCRT_wchar_t *str)
{ {
WCHAR name[256], value[512]; MSVCRT_wchar_t name[256], value[512];
WCHAR *dst = name; MSVCRT_wchar_t *dst = name;
int ret; int ret;
TRACE("%s\n", debugstr_w(str)); TRACE("%s\n", debugstr_w(str));
if (!str) if (!str)
return -1; return -1;
while (*str && *str != (WCHAR)L'=') while (*str && *str != '=')
*dst++ = *str++; *dst++ = *str++;
if (!*str++) if (!*str++)
return -1; return -1;
*dst = (WCHAR)L'\0'; *dst = 0;
dst = value; dst = value;
while (*str) while (*str)
*dst++ = *str++; *dst++ = *str++;
*dst = (WCHAR)L'\0'; *dst = 0;
ret = !SetEnvironmentVariableW(name, value[0] ? value : NULL); ret = !SetEnvironmentVariableW(name, value[0] ? value : NULL);
/* Update the __p__environ array only when already initialized */ /* Update the __p__environ array only when already initialized */
......
...@@ -87,7 +87,7 @@ static const unsigned int BAT = 'b' << 16 | 'a' << 8 | 't'; ...@@ -87,7 +87,7 @@ static const unsigned int BAT = 'b' << 16 | 'a' << 8 | 't';
static const unsigned int CMD = 'c' << 16 | 'm' << 8 | 'd'; static const unsigned int CMD = 'c' << 16 | 'm' << 8 | 'd';
static const unsigned int COM = 'c' << 16 | 'o' << 8 | 'm'; static const unsigned int COM = 'c' << 16 | 'o' << 8 | 'm';
#define TOUL(x) (ULONGLONG)((WCHAR)L##x) #define TOUL(x) (ULONGLONG)(x)
static const ULONGLONG WCEXE = TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e'); static const ULONGLONG WCEXE = TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e');
static const ULONGLONG WCBAT = TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t'); static const ULONGLONG WCBAT = TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t');
static const ULONGLONG WCCMD = TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d'); static const ULONGLONG WCCMD = TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d');
...@@ -291,7 +291,7 @@ int _access(const char *filename, int mode) ...@@ -291,7 +291,7 @@ int _access(const char *filename, int mode)
/********************************************************************* /*********************************************************************
* _waccess (MSVCRT.@) * _waccess (MSVCRT.@)
*/ */
int _waccess(const WCHAR *filename, int mode) int _waccess(const MSVCRT_wchar_t *filename, int mode)
{ {
DWORD attr = GetFileAttributesW(filename); DWORD attr = GetFileAttributesW(filename);
...@@ -332,7 +332,7 @@ int _chmod(const char *path, int flags) ...@@ -332,7 +332,7 @@ int _chmod(const char *path, int flags)
/********************************************************************* /*********************************************************************
* _wchmod (MSVCRT.@) * _wchmod (MSVCRT.@)
*/ */
int _wchmod(const WCHAR *path, int flags) int _wchmod(const MSVCRT_wchar_t *path, int flags)
{ {
DWORD oldFlags = GetFileAttributesW(path); DWORD oldFlags = GetFileAttributesW(path);
...@@ -364,7 +364,7 @@ int _unlink(const char *path) ...@@ -364,7 +364,7 @@ int _unlink(const char *path)
/********************************************************************* /*********************************************************************
* _wunlink (MSVCRT.@) * _wunlink (MSVCRT.@)
*/ */
int _wunlink(const WCHAR *path) int _wunlink(const MSVCRT_wchar_t *path)
{ {
TRACE("(%s)\n",debugstr_w(path)); TRACE("(%s)\n",debugstr_w(path));
if(DeleteFileW(path)) if(DeleteFileW(path))
...@@ -628,7 +628,7 @@ MSVCRT_FILE* _fdopen(int fd, const char *mode) ...@@ -628,7 +628,7 @@ MSVCRT_FILE* _fdopen(int fd, const char *mode)
/********************************************************************* /*********************************************************************
* _wfdopen (MSVCRT.@) * _wfdopen (MSVCRT.@)
*/ */
MSVCRT_FILE* _wfdopen(int fd, const WCHAR *mode) MSVCRT_FILE* _wfdopen(int fd, const MSVCRT_wchar_t *mode)
{ {
MSVCRT_FILE* file = msvcrt_alloc_fp(fd); MSVCRT_FILE* file = msvcrt_alloc_fp(fd);
...@@ -853,15 +853,15 @@ char *_mktemp(char *pattern) ...@@ -853,15 +853,15 @@ char *_mktemp(char *pattern)
/********************************************************************* /*********************************************************************
* _wmktemp (MSVCRT.@) * _wmktemp (MSVCRT.@)
*/ */
WCHAR *_wmktemp(WCHAR *pattern) MSVCRT_wchar_t *_wmktemp(MSVCRT_wchar_t *pattern)
{ {
int numX = 0; int numX = 0;
WCHAR *retVal = pattern; MSVCRT_wchar_t *retVal = pattern;
int id; int id;
WCHAR letter = (WCHAR)L'a'; MSVCRT_wchar_t letter = 'a';
while(*pattern) while(*pattern)
numX = (*pattern++ == (WCHAR)L'X')? numX + 1 : 0; numX = (*pattern++ == 'X')? numX + 1 : 0;
if (numX < 5) if (numX < 5)
return NULL; return NULL;
pattern--; pattern--;
...@@ -870,7 +870,7 @@ WCHAR *_wmktemp(WCHAR *pattern) ...@@ -870,7 +870,7 @@ WCHAR *_wmktemp(WCHAR *pattern)
while(numX--) while(numX--)
{ {
int tempNum = id / 10; int tempNum = id / 10;
*pattern-- = id - (tempNum * 10) + (WCHAR)L'0'; *pattern-- = id - (tempNum * 10) + '0';
id = tempNum; id = tempNum;
} }
pattern++; pattern++;
...@@ -880,7 +880,7 @@ WCHAR *_wmktemp(WCHAR *pattern) ...@@ -880,7 +880,7 @@ WCHAR *_wmktemp(WCHAR *pattern)
GetLastError() == ERROR_FILE_NOT_FOUND) GetLastError() == ERROR_FILE_NOT_FOUND)
return retVal; return retVal;
*pattern = letter++; *pattern = letter++;
} while(letter != (WCHAR)L'|'); } while(letter != '|');
return NULL; return NULL;
} }
...@@ -1007,7 +1007,7 @@ int MSVCRT__sopen( const char *path, int oflags, int shflags, ... ) ...@@ -1007,7 +1007,7 @@ int MSVCRT__sopen( const char *path, int oflags, int shflags, ... )
/********************************************************************* /*********************************************************************
* _wsopen (MSVCRT.@) * _wsopen (MSVCRT.@)
*/ */
int MSVCRT__wsopen( const WCHAR* path, int oflags, int shflags, ... ) int MSVCRT__wsopen( const MSVCRT_wchar_t* path, int oflags, int shflags, ... )
{ {
const unsigned int len = strlenW(path); const unsigned int len = strlenW(path);
char *patha = MSVCRT_calloc(len + 1,1); char *patha = MSVCRT_calloc(len + 1,1);
...@@ -1047,7 +1047,7 @@ int _open( const char *path, int flags, ... ) ...@@ -1047,7 +1047,7 @@ int _open( const char *path, int flags, ... )
/********************************************************************* /*********************************************************************
* _wopen (MSVCRT.@) * _wopen (MSVCRT.@)
*/ */
int _wopen(const WCHAR *path,int flags,...) int _wopen(const MSVCRT_wchar_t *path,int flags,...)
{ {
const unsigned int len = strlenW(path); const unsigned int len = strlenW(path);
char *patha = MSVCRT_calloc(len + 1,1); char *patha = MSVCRT_calloc(len + 1,1);
...@@ -1081,7 +1081,7 @@ int _creat(const char *path, int flags) ...@@ -1081,7 +1081,7 @@ int _creat(const char *path, int flags)
/********************************************************************* /*********************************************************************
* _wcreat (MSVCRT.@) * _wcreat (MSVCRT.@)
*/ */
int _wcreat(const WCHAR *path, int flags) int _wcreat(const MSVCRT_wchar_t *path, int flags)
{ {
int usedFlags = (flags & _O_TEXT)| _O_CREAT| _O_WRONLY| _O_TRUNC; int usedFlags = (flags & _O_TEXT)| _O_CREAT| _O_WRONLY| _O_TRUNC;
return _wopen(path, usedFlags); return _wopen(path, usedFlags);
...@@ -1253,7 +1253,7 @@ int MSVCRT__stat(const char* path, struct _stat * buf) ...@@ -1253,7 +1253,7 @@ int MSVCRT__stat(const char* path, struct _stat * buf)
/********************************************************************* /*********************************************************************
* _wstat (MSVCRT.@) * _wstat (MSVCRT.@)
*/ */
int _wstat(const WCHAR* path, struct _stat * buf) int _wstat(const MSVCRT_wchar_t* path, struct _stat * buf)
{ {
DWORD dw; DWORD dw;
WIN32_FILE_ATTRIBUTE_DATA hfi; WIN32_FILE_ATTRIBUTE_DATA hfi;
...@@ -1273,7 +1273,7 @@ int _wstat(const WCHAR* path, struct _stat * buf) ...@@ -1273,7 +1273,7 @@ int _wstat(const WCHAR* path, struct _stat * buf)
/* FIXME: rdev isn't drive num, despite what the docs says-what is it? */ /* FIXME: rdev isn't drive num, despite what the docs says-what is it? */
if (MSVCRT_iswalpha(*path)) if (MSVCRT_iswalpha(*path))
buf->st_dev = buf->st_rdev = toupperW(*path - (WCHAR)L'A'); /* drive num */ buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */
else else
buf->st_dev = buf->st_rdev = _getdrive() - 1; buf->st_dev = buf->st_rdev = _getdrive() - 1;
...@@ -1281,13 +1281,13 @@ int _wstat(const WCHAR* path, struct _stat * buf) ...@@ -1281,13 +1281,13 @@ int _wstat(const WCHAR* path, struct _stat * buf)
/* Dir, or regular file? */ /* Dir, or regular file? */
if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
(path[plen-1] == (WCHAR)L'\\')) (path[plen-1] == '\\'))
mode |= (_S_IFDIR | MSVCRT_S_IEXEC); mode |= (_S_IFDIR | MSVCRT_S_IEXEC);
else else
{ {
mode |= _S_IFREG; mode |= _S_IFREG;
/* executable? */ /* executable? */
if (plen > 6 && path[plen-4] == (WCHAR)L'.') /* shortest exe: "\x.exe" */ if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */
{ {
ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) |
((ULONGLONG)tolowerW(path[plen-3]) << 32); ((ULONGLONG)tolowerW(path[plen-3]) << 32);
...@@ -1339,9 +1339,9 @@ char *_tempnam(const char *dir, const char *prefix) ...@@ -1339,9 +1339,9 @@ char *_tempnam(const char *dir, const char *prefix)
/********************************************************************* /*********************************************************************
* _wtempnam (MSVCRT.@) * _wtempnam (MSVCRT.@)
*/ */
WCHAR *_wtempnam(const WCHAR *dir, const WCHAR *prefix) MSVCRT_wchar_t *_wtempnam(const MSVCRT_wchar_t *dir, const MSVCRT_wchar_t *prefix)
{ {
WCHAR tmpbuf[MAX_PATH]; MSVCRT_wchar_t tmpbuf[MAX_PATH];
TRACE("dir (%s) prefix (%s)\n",debugstr_w(dir),debugstr_w(prefix)); TRACE("dir (%s) prefix (%s)\n",debugstr_w(dir),debugstr_w(prefix));
if (GetTempFileNameW(dir,prefix,0,tmpbuf)) if (GetTempFileNameW(dir,prefix,0,tmpbuf))
...@@ -1383,7 +1383,7 @@ int _utime(const char* path, struct _utimbuf *t) ...@@ -1383,7 +1383,7 @@ int _utime(const char* path, struct _utimbuf *t)
/********************************************************************* /*********************************************************************
* _wutime (MSVCRT.@) * _wutime (MSVCRT.@)
*/ */
int _wutime(const WCHAR* path, struct _utimbuf *t) int _wutime(const MSVCRT_wchar_t* path, struct _utimbuf *t)
{ {
int fd = _wopen(path, _O_WRONLY | _O_BINARY); int fd = _wopen(path, _O_WRONLY | _O_BINARY);
...@@ -1587,7 +1587,7 @@ char *MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file) ...@@ -1587,7 +1587,7 @@ char *MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file)
*/ */
MSVCRT_wint_t MSVCRT_fgetwc(MSVCRT_FILE* file) MSVCRT_wint_t MSVCRT_fgetwc(MSVCRT_FILE* file)
{ {
WCHAR wc; MSVCRT_wchar_t wc;
if (_read(file->_file, &wc, sizeof(wc)) != sizeof(wc)) if (_read(file->_file, &wc, sizeof(wc)) != sizeof(wc))
return MSVCRT_WEOF; return MSVCRT_WEOF;
return wc; return wc;
...@@ -1620,10 +1620,10 @@ MSVCRT_wint_t MSVCRT_getwchar(void) ...@@ -1620,10 +1620,10 @@ MSVCRT_wint_t MSVCRT_getwchar(void)
/********************************************************************* /*********************************************************************
* fgetws (MSVCRT.@) * fgetws (MSVCRT.@)
*/ */
WCHAR *MSVCRT_fgetws(WCHAR *s, int size, MSVCRT_FILE* file) MSVCRT_wchar_t *MSVCRT_fgetws(MSVCRT_wchar_t *s, int size, MSVCRT_FILE* file)
{ {
int cc; int cc;
WCHAR * buf_start = s; MSVCRT_wchar_t * buf_start = s;
TRACE(":file(%p) fd (%d) str (%p) len (%d)\n", TRACE(":file(%p) fd (%d) str (%p) len (%d)\n",
file,file->_file,s,size); file,file->_file,s,size);
...@@ -1654,7 +1654,7 @@ WCHAR *MSVCRT_fgetws(WCHAR *s, int size, MSVCRT_FILE* file) ...@@ -1654,7 +1654,7 @@ WCHAR *MSVCRT_fgetws(WCHAR *s, int size, MSVCRT_FILE* file)
*/ */
MSVCRT_wint_t MSVCRT_fputwc(MSVCRT_wint_t wc, MSVCRT_FILE* file) MSVCRT_wint_t MSVCRT_fputwc(MSVCRT_wint_t wc, MSVCRT_FILE* file)
{ {
WCHAR mwc=wc; MSVCRT_wchar_t mwc=wc;
if (MSVCRT_fwrite( &mwc, sizeof(mwc), 1, file) != 1) if (MSVCRT_fwrite( &mwc, sizeof(mwc), 1, file) != 1)
return MSVCRT_WEOF; return MSVCRT_WEOF;
return wc; return wc;
...@@ -1732,7 +1732,7 @@ MSVCRT_FILE* MSVCRT_fopen(const char *path, const char *mode) ...@@ -1732,7 +1732,7 @@ MSVCRT_FILE* MSVCRT_fopen(const char *path, const char *mode)
/********************************************************************* /*********************************************************************
* _wfopen (MSVCRT.@) * _wfopen (MSVCRT.@)
*/ */
MSVCRT_FILE *_wfopen(const WCHAR *path, const WCHAR *mode) MSVCRT_FILE *_wfopen(const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode)
{ {
const unsigned int plen = strlenW(path), mlen = strlenW(mode); const unsigned int plen = strlenW(path), mlen = strlenW(mode);
char *patha = MSVCRT_calloc(plen + 1, 1); char *patha = MSVCRT_calloc(plen + 1, 1);
...@@ -1766,7 +1766,7 @@ MSVCRT_FILE* _fsopen(const char *path, const char *mode, int share) ...@@ -1766,7 +1766,7 @@ MSVCRT_FILE* _fsopen(const char *path, const char *mode, int share)
/********************************************************************* /*********************************************************************
* _wfsopen (MSVCRT.@) * _wfsopen (MSVCRT.@)
*/ */
MSVCRT_FILE* _wfsopen(const WCHAR *path, const WCHAR *mode, int share) MSVCRT_FILE* _wfsopen(const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode, int share)
{ {
FIXME(":(%s,%s,%d),ignoring share mode!\n", FIXME(":(%s,%s,%d),ignoring share mode!\n",
debugstr_w(path),debugstr_w(mode),share); debugstr_w(path),debugstr_w(mode),share);
...@@ -2001,7 +2001,7 @@ int MSVCRT_fputs(const char *s, MSVCRT_FILE* file) ...@@ -2001,7 +2001,7 @@ int MSVCRT_fputs(const char *s, MSVCRT_FILE* file)
/********************************************************************* /*********************************************************************
* fputws (MSVCRT.@) * fputws (MSVCRT.@)
*/ */
int MSVCRT_fputws(const WCHAR *s, MSVCRT_FILE* file) int MSVCRT_fputws(const MSVCRT_wchar_t *s, MSVCRT_FILE* file)
{ {
size_t len = strlenW(s); size_t len = strlenW(s);
return MSVCRT_fwrite(s,sizeof(*s),len,file) == len ? 0 : MSVCRT_EOF; return MSVCRT_fwrite(s,sizeof(*s),len,file) == len ? 0 : MSVCRT_EOF;
...@@ -2044,16 +2044,16 @@ char *MSVCRT_gets(char *buf) ...@@ -2044,16 +2044,16 @@ char *MSVCRT_gets(char *buf)
/********************************************************************* /*********************************************************************
* _getws (MSVCRT.@) * _getws (MSVCRT.@)
*/ */
WCHAR* MSVCRT__getws(WCHAR* buf) MSVCRT_wchar_t* MSVCRT__getws(MSVCRT_wchar_t* buf)
{ {
MSVCRT_wint_t cc; MSVCRT_wint_t cc;
WCHAR* ws = buf; MSVCRT_wchar_t* ws = buf;
for (cc = MSVCRT_fgetwc(MSVCRT_stdin); cc != MSVCRT_WEOF && cc != '\n'; for (cc = MSVCRT_fgetwc(MSVCRT_stdin); cc != MSVCRT_WEOF && cc != '\n';
cc = MSVCRT_fgetwc(MSVCRT_stdin)) cc = MSVCRT_fgetwc(MSVCRT_stdin))
{ {
if (cc != '\r') if (cc != '\r')
*buf++ = (WCHAR)cc; *buf++ = (MSVCRT_wchar_t)cc;
} }
*buf = '\0'; *buf = '\0';
...@@ -2090,9 +2090,9 @@ int MSVCRT_puts(const char *s) ...@@ -2090,9 +2090,9 @@ int MSVCRT_puts(const char *s)
/********************************************************************* /*********************************************************************
* _putws (MSVCRT.@) * _putws (MSVCRT.@)
*/ */
int _putws(const WCHAR *s) int _putws(const MSVCRT_wchar_t *s)
{ {
static const WCHAR nl = '\n'; static const MSVCRT_wchar_t nl = '\n';
size_t len = strlenW(s); size_t len = strlenW(s);
if (MSVCRT_fwrite(s,sizeof(*s),len,MSVCRT_stdout) != len) return MSVCRT_EOF; if (MSVCRT_fwrite(s,sizeof(*s),len,MSVCRT_stdout) != len) return MSVCRT_EOF;
return MSVCRT_fwrite(&nl,sizeof(nl),1,MSVCRT_stdout) == 1 ? 0 : MSVCRT_EOF; return MSVCRT_fwrite(&nl,sizeof(nl),1,MSVCRT_stdout) == 1 ? 0 : MSVCRT_EOF;
...@@ -2114,7 +2114,7 @@ int MSVCRT_remove(const char *path) ...@@ -2114,7 +2114,7 @@ int MSVCRT_remove(const char *path)
/********************************************************************* /*********************************************************************
* _wremove (MSVCRT.@) * _wremove (MSVCRT.@)
*/ */
int _wremove(const WCHAR *path) int _wremove(const MSVCRT_wchar_t *path)
{ {
TRACE("(%s)\n",debugstr_w(path)); TRACE("(%s)\n",debugstr_w(path));
if (DeleteFileW(path)) if (DeleteFileW(path))
...@@ -2141,7 +2141,7 @@ int MSVCRT_scanf(const char *format, ...) ...@@ -2141,7 +2141,7 @@ int MSVCRT_scanf(const char *format, ...)
/********************************************************************* /*********************************************************************
* wscanf (MSVCRT.@) * wscanf (MSVCRT.@)
*/ */
int MSVCRT_wscanf(const WCHAR *format, ...) int MSVCRT_wscanf(const MSVCRT_wchar_t *format, ...)
{ {
va_list valist; va_list valist;
int res; int res;
...@@ -2168,7 +2168,7 @@ int MSVCRT_rename(const char *oldpath,const char *newpath) ...@@ -2168,7 +2168,7 @@ int MSVCRT_rename(const char *oldpath,const char *newpath)
/********************************************************************* /*********************************************************************
* _wrename (MSVCRT.@) * _wrename (MSVCRT.@)
*/ */
int _wrename(const WCHAR *oldpath,const WCHAR *newpath) int _wrename(const MSVCRT_wchar_t *oldpath,const MSVCRT_wchar_t *newpath)
{ {
TRACE(":from %s to %s\n",debugstr_w(oldpath),debugstr_w(newpath)); TRACE(":from %s to %s\n",debugstr_w(oldpath),debugstr_w(newpath));
if (MoveFileExW(oldpath, newpath, MOVEFILE_COPY_ALLOWED)) if (MoveFileExW(oldpath, newpath, MOVEFILE_COPY_ALLOWED))
...@@ -2273,18 +2273,18 @@ int MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist) ...@@ -2273,18 +2273,18 @@ int MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist)
* Is final char included in written (then resize is too big) or not * Is final char included in written (then resize is too big) or not
* (then we must test for equality too)? * (then we must test for equality too)?
*/ */
int MSVCRT_vfwprintf(MSVCRT_FILE* file, const WCHAR *format, va_list valist) int MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, va_list valist)
{ {
WCHAR buf[2048], *mem = buf; MSVCRT_wchar_t buf[2048], *mem = buf;
int written, resize = sizeof(buf) / sizeof(WCHAR), retval; int written, resize = sizeof(buf) / sizeof(MSVCRT_wchar_t), retval;
/* See vfprintf comments */ /* See vfprintf comments */
while ((written = _vsnwprintf(mem, resize, format, valist)) == -1 || while ((written = _vsnwprintf(mem, resize, format, valist)) == -1 ||
written > resize) written > resize)
{ {
resize = (written == -1 ? resize * 2 : written + sizeof(WCHAR)); resize = (written == -1 ? resize * 2 : written + sizeof(MSVCRT_wchar_t));
if (mem != buf) if (mem != buf)
MSVCRT_free (mem); MSVCRT_free (mem);
if (!(mem = (WCHAR *)MSVCRT_malloc(resize*sizeof(*mem)))) if (!(mem = (MSVCRT_wchar_t *)MSVCRT_malloc(resize*sizeof(*mem))))
return MSVCRT_EOF; return MSVCRT_EOF;
} }
retval = MSVCRT_fwrite(mem, sizeof(*mem), written, file); retval = MSVCRT_fwrite(mem, sizeof(*mem), written, file);
...@@ -2304,7 +2304,7 @@ int MSVCRT_vprintf(const char *format, va_list valist) ...@@ -2304,7 +2304,7 @@ int MSVCRT_vprintf(const char *format, va_list valist)
/********************************************************************* /*********************************************************************
* vwprintf (MSVCRT.@) * vwprintf (MSVCRT.@)
*/ */
int MSVCRT_vwprintf(const WCHAR *format, va_list valist) int MSVCRT_vwprintf(const MSVCRT_wchar_t *format, va_list valist)
{ {
return MSVCRT_vfwprintf(MSVCRT_stdout,format,valist); return MSVCRT_vfwprintf(MSVCRT_stdout,format,valist);
} }
...@@ -2325,7 +2325,7 @@ int MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...) ...@@ -2325,7 +2325,7 @@ int MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...)
/********************************************************************* /*********************************************************************
* fwprintf (MSVCRT.@) * fwprintf (MSVCRT.@)
*/ */
int MSVCRT_fwprintf(MSVCRT_FILE* file, const WCHAR *format, ...) int MSVCRT_fwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...)
{ {
va_list valist; va_list valist;
int res; int res;
...@@ -2371,10 +2371,10 @@ int MSVCRT_ungetc(int c, MSVCRT_FILE * file) ...@@ -2371,10 +2371,10 @@ int MSVCRT_ungetc(int c, MSVCRT_FILE * file)
*/ */
MSVCRT_wint_t MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file) MSVCRT_wint_t MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file)
{ {
WCHAR mwc = wc; MSVCRT_wchar_t mwc = wc;
char * pp = (char *)&mwc; char * pp = (char *)&mwc;
int i; int i;
for(i=sizeof(WCHAR)-1;i>=0;i--) { for(i=sizeof(MSVCRT_wchar_t)-1;i>=0;i--) {
if(pp[i] != MSVCRT_ungetc(pp[i],file)) if(pp[i] != MSVCRT_ungetc(pp[i],file))
return MSVCRT_WEOF; return MSVCRT_WEOF;
} }
...@@ -2384,7 +2384,7 @@ MSVCRT_wint_t MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file) ...@@ -2384,7 +2384,7 @@ MSVCRT_wint_t MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file)
/********************************************************************* /*********************************************************************
* wprintf (MSVCRT.@) * wprintf (MSVCRT.@)
*/ */
int MSVCRT_wprintf(const WCHAR *format, ...) int MSVCRT_wprintf(const MSVCRT_wchar_t *format, ...)
{ {
va_list valist; va_list valist;
int res; int res;
......
...@@ -39,9 +39,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); ...@@ -39,9 +39,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
unsigned char MSVCRT_mbctype[257]; unsigned char MSVCRT_mbctype[257];
int MSVCRT___mb_cur_max = 1; int MSVCRT___mb_cur_max = 1;
static WCHAR msvcrt_mbc_to_wc(unsigned int ch) static MSVCRT_wchar_t msvcrt_mbc_to_wc(unsigned int ch)
{ {
WCHAR chW; MSVCRT_wchar_t chW;
char mbch[2]; char mbch[2];
int n_chars; int n_chars;
...@@ -527,7 +527,7 @@ unsigned char* _mbsrchr(const unsigned char* s, unsigned int x) ...@@ -527,7 +527,7 @@ unsigned char* _mbsrchr(const unsigned char* s, unsigned int x)
/********************************************************************* /*********************************************************************
* mbtowc(MSVCRT.@) * mbtowc(MSVCRT.@)
*/ */
int MSVCRT_mbtowc(WCHAR *dst, const char* str, MSVCRT_size_t n) int MSVCRT_mbtowc(MSVCRT_wchar_t *dst, const char* str, MSVCRT_size_t n)
{ {
if(n <= 0 || !str) if(n <= 0 || !str)
return 0; return 0;
...@@ -575,7 +575,7 @@ int _ismbbkana(unsigned int c) ...@@ -575,7 +575,7 @@ int _ismbbkana(unsigned int c)
*/ */
int _ismbcdigit(unsigned int ch) int _ismbcdigit(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & C1_DIGIT); return (get_char_typeW( wch ) & C1_DIGIT);
} }
...@@ -584,7 +584,7 @@ int _ismbcdigit(unsigned int ch) ...@@ -584,7 +584,7 @@ int _ismbcdigit(unsigned int ch)
*/ */
int _ismbcgraph(unsigned int ch) int _ismbcgraph(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA)); return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA));
} }
...@@ -593,7 +593,7 @@ int _ismbcgraph(unsigned int ch) ...@@ -593,7 +593,7 @@ int _ismbcgraph(unsigned int ch)
*/ */
int _ismbcalpha(unsigned int ch) int _ismbcalpha(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & C1_ALPHA); return (get_char_typeW( wch ) & C1_ALPHA);
} }
...@@ -602,7 +602,7 @@ int _ismbcalpha(unsigned int ch) ...@@ -602,7 +602,7 @@ int _ismbcalpha(unsigned int ch)
*/ */
int _ismbclower(unsigned int ch) int _ismbclower(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & C1_UPPER); return (get_char_typeW( wch ) & C1_UPPER);
} }
...@@ -611,7 +611,7 @@ int _ismbclower(unsigned int ch) ...@@ -611,7 +611,7 @@ int _ismbclower(unsigned int ch)
*/ */
int _ismbcupper(unsigned int ch) int _ismbcupper(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & C1_LOWER); return (get_char_typeW( wch ) & C1_LOWER);
} }
...@@ -620,7 +620,7 @@ int _ismbcupper(unsigned int ch) ...@@ -620,7 +620,7 @@ int _ismbcupper(unsigned int ch)
*/ */
int _ismbcsymbol(unsigned int ch) int _ismbcsymbol(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
WORD ctype; WORD ctype;
if (!GetStringTypeW(CT_CTYPE3, &wch, 1, &ctype)) if (!GetStringTypeW(CT_CTYPE3, &wch, 1, &ctype))
{ {
...@@ -635,7 +635,7 @@ int _ismbcsymbol(unsigned int ch) ...@@ -635,7 +635,7 @@ int _ismbcsymbol(unsigned int ch)
*/ */
int _ismbcalnum(unsigned int ch) int _ismbcalnum(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & (C1_ALPHA | C1_DIGIT)); return (get_char_typeW( wch ) & (C1_ALPHA | C1_DIGIT));
} }
...@@ -644,7 +644,7 @@ int _ismbcalnum(unsigned int ch) ...@@ -644,7 +644,7 @@ int _ismbcalnum(unsigned int ch)
*/ */
int _ismbcspace(unsigned int ch) int _ismbcspace(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & C1_SPACE); return (get_char_typeW( wch ) & C1_SPACE);
} }
...@@ -653,7 +653,7 @@ int _ismbcspace(unsigned int ch) ...@@ -653,7 +653,7 @@ int _ismbcspace(unsigned int ch)
*/ */
int _ismbcprint(unsigned int ch) int _ismbcprint(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA | C1_SPACE)); return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA | C1_SPACE));
} }
...@@ -662,7 +662,7 @@ int _ismbcprint(unsigned int ch) ...@@ -662,7 +662,7 @@ int _ismbcprint(unsigned int ch)
*/ */
int _ismbcpunct(unsigned int ch) int _ismbcpunct(unsigned int ch)
{ {
WCHAR wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & C1_PUNCT); return (get_char_typeW( wch ) & C1_PUNCT);
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "winerror.h" #include "winerror.h"
#include "winnls.h" #include "winnls.h"
#include "msvcrt/string.h"
#include "msvcrt/eh.h" #include "msvcrt/eh.h"
/* TLS data */ /* TLS data */
...@@ -50,15 +51,15 @@ extern int MSVCRT_current_lc_all_cp; ...@@ -50,15 +51,15 @@ extern int MSVCRT_current_lc_all_cp;
void _purecall(void); void _purecall(void);
void MSVCRT__set_errno(int); void MSVCRT__set_errno(int);
char* msvcrt_strndup(const char*,unsigned int); char* msvcrt_strndup(const char*,unsigned int);
LPWSTR msvcrt_wstrndup(LPCWSTR, unsigned int); MSVCRT_wchar_t *msvcrt_wstrndup(const MSVCRT_wchar_t*, unsigned int);
void MSVCRT__amsg_exit(int errnum); void MSVCRT__amsg_exit(int errnum);
extern char **MSVCRT__environ; extern char **MSVCRT__environ;
extern WCHAR **MSVCRT__wenviron; extern MSVCRT_wchar_t **MSVCRT__wenviron;
extern char ** msvcrt_SnapshotOfEnvironmentA(char **); extern char ** msvcrt_SnapshotOfEnvironmentA(char **);
extern WCHAR ** msvcrt_SnapshotOfEnvironmentW(WCHAR **); extern MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **);
/* FIXME: This should be declared in new.h but it's not an extern "C" so /* FIXME: This should be declared in new.h but it's not an extern "C" so
* it would not be much use anyway. Even for Winelib applications. * it would not be much use anyway. Even for Winelib applications.
......
...@@ -48,7 +48,7 @@ static int char2digit(char c, int base) { ...@@ -48,7 +48,7 @@ static int char2digit(char c, int base) {
/* helper function for *wscanf. Returns the value of character c in the /* helper function for *wscanf. Returns the value of character c in the
* given base, or -1 if the given character is not a digit of the base. * given base, or -1 if the given character is not a digit of the base.
*/ */
static int wchar2digit(WCHAR c, int base) { static int wchar2digit(MSVCRT_wchar_t c, int base) {
if ((c>=L'0') && (c<=L'9') && (c<=L'0'+base-1)) return (c-L'0'); if ((c>=L'0') && (c<=L'9') && (c<=L'0'+base-1)) return (c-L'0');
if (base<=10) return -1; if (base<=10) return -1;
if ((c>=L'A') && (c<=L'Z') && (c<=L'A'+base-11)) return (c-L'A'+10); if ((c>=L'A') && (c<=L'Z') && (c<=L'A'+base-11)) return (c-L'A'+10);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifdef WIDE_SCANF #ifdef WIDE_SCANF
#define _L_(x) L##x #define _L_(x) L##x
#define _CHAR_ WCHAR #define _CHAR_ MSVCRT_wchar_t
#define _EOF_ MSVCRT_WEOF #define _EOF_ MSVCRT_WEOF
#define _ISSPACE_(c) MSVCRT_iswspace(c) #define _ISSPACE_(c) MSVCRT_iswspace(c)
#define _ISDIGIT_(c) MSVCRT_iswdigit(c) #define _ISDIGIT_(c) MSVCRT_iswdigit(c)
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#define _GETC_(file) *file++ #define _GETC_(file) *file++
#define _UNGETC_(nch, file) file-- #define _UNGETC_(nch, file) file--
#ifdef WIDE_SCANF #ifdef WIDE_SCANF
#define _FUNCTION_ MSVCRT_swscanf(const WCHAR *file, const WCHAR *format, ...) #define _FUNCTION_ MSVCRT_swscanf(const MSVCRT_wchar_t *file, const MSVCRT_wchar_t *format, ...)
#else /* WIDE_SCANF */ #else /* WIDE_SCANF */
#define _FUNCTION_ MSVCRT_sscanf(const char *file, const char *format, ...) #define _FUNCTION_ MSVCRT_sscanf(const char *file, const char *format, ...)
#endif /* WIDE_SCANF */ #endif /* WIDE_SCANF */
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#ifdef WIDE_SCANF #ifdef WIDE_SCANF
#define _GETC_(file) MSVCRT_fgetwc(file) #define _GETC_(file) MSVCRT_fgetwc(file)
#define _UNGETC_(nch, file) MSVCRT_ungetwc(nch, file) #define _UNGETC_(nch, file) MSVCRT_ungetwc(nch, file)
#define _FUNCTION_ MSVCRT_fwscanf(MSVCRT_FILE* file, const WCHAR *format, ...) #define _FUNCTION_ MSVCRT_fwscanf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...)
#else /* WIDE_SCANF */ #else /* WIDE_SCANF */
#define _GETC_(file) MSVCRT_fgetc(file) #define _GETC_(file) MSVCRT_fgetc(file)
#define _UNGETC_(nch, file) MSVCRT_ungetc(nch, file) #define _UNGETC_(nch, file) MSVCRT_ungetc(nch, file)
...@@ -369,10 +369,10 @@ int _FUNCTION_ { ...@@ -369,10 +369,10 @@ int _FUNCTION_ {
if (!suppress) *sptr = 0; if (!suppress) *sptr = 0;
} }
break; break;
widecharstring: { /* read a word into a WCHAR * */ widecharstring: { /* read a word into a wchar_t* */
WCHAR*str = MSVCRT_wchar_t*str =
suppress ? NULL : va_arg(ap, WCHAR*); suppress ? NULL : va_arg(ap, MSVCRT_wchar_t*);
WCHAR*sptr = str; MSVCRT_wchar_t*sptr = str;
/* skip initial whitespace */ /* skip initial whitespace */
while ((nch!=_EOF_) && _ISSPACE_(nch)) while ((nch!=_EOF_) && _ISSPACE_(nch))
nch = _GETC_(file); nch = _GETC_(file);
...@@ -423,8 +423,8 @@ int _FUNCTION_ { ...@@ -423,8 +423,8 @@ int _FUNCTION_ {
} }
break; break;
widecharacter: { widecharacter: {
if (!suppress) { /* read single character into WCHAR */ if (!suppress) { /* read single character into a wchar_t */
WCHAR*c = va_arg(ap, WCHAR*); MSVCRT_wchar_t*c = va_arg(ap, MSVCRT_wchar_t*);
#ifdef WIDE_SCANF #ifdef WIDE_SCANF
*c = nch; *c = nch;
#else /* WIDE_SCANF */ #else /* WIDE_SCANF */
......
...@@ -35,17 +35,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); ...@@ -35,17 +35,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/* INTERNAL: MSVCRT_malloc() based wstrndup */ /* INTERNAL: MSVCRT_malloc() based wstrndup */
WCHAR* msvcrt_wstrndup(LPCWSTR buf, unsigned int size) MSVCRT_wchar_t* msvcrt_wstrndup(const MSVCRT_wchar_t *buf, unsigned int size)
{ {
WCHAR* ret; MSVCRT_wchar_t* ret;
unsigned int len = strlenW(buf), max_len; unsigned int len = strlenW(buf), max_len;
max_len = size <= len? size : len + 1; max_len = size <= len? size : len + 1;
ret = MSVCRT_malloc(max_len * sizeof (WCHAR)); ret = MSVCRT_malloc(max_len * sizeof (MSVCRT_wchar_t));
if (ret) if (ret)
{ {
memcpy(ret,buf,max_len * sizeof (WCHAR)); memcpy(ret,buf,max_len * sizeof (MSVCRT_wchar_t));
ret[max_len] = 0; ret[max_len] = 0;
} }
return ret; return ret;
...@@ -54,12 +54,12 @@ WCHAR* msvcrt_wstrndup(LPCWSTR buf, unsigned int size) ...@@ -54,12 +54,12 @@ WCHAR* msvcrt_wstrndup(LPCWSTR buf, unsigned int size)
/********************************************************************* /*********************************************************************
* _wcsdup (MSVCRT.@) * _wcsdup (MSVCRT.@)
*/ */
WCHAR* _wcsdup( const WCHAR* str ) MSVCRT_wchar_t* _wcsdup( const MSVCRT_wchar_t* str )
{ {
WCHAR* ret = NULL; MSVCRT_wchar_t* ret = NULL;
if (str) if (str)
{ {
int size = (strlenW(str) + 1) * sizeof(WCHAR); int size = (strlenW(str) + 1) * sizeof(MSVCRT_wchar_t);
ret = MSVCRT_malloc( size ); ret = MSVCRT_malloc( size );
if (ret) memcpy( ret, str, size ); if (ret) memcpy( ret, str, size );
} }
...@@ -69,7 +69,7 @@ WCHAR* _wcsdup( const WCHAR* str ) ...@@ -69,7 +69,7 @@ WCHAR* _wcsdup( const WCHAR* str )
/********************************************************************* /*********************************************************************
* _wcsicoll (MSVCRT.@) * _wcsicoll (MSVCRT.@)
*/ */
INT _wcsicoll( const WCHAR* str1, const WCHAR* str2 ) INT _wcsicoll( const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* str2 )
{ {
/* FIXME: handle collates */ /* FIXME: handle collates */
return strcmpiW( str1, str2 ); return strcmpiW( str1, str2 );
...@@ -78,9 +78,9 @@ INT _wcsicoll( const WCHAR* str1, const WCHAR* str2 ) ...@@ -78,9 +78,9 @@ INT _wcsicoll( const WCHAR* str1, const WCHAR* str2 )
/********************************************************************* /*********************************************************************
* _wcsnset (MSVCRT.@) * _wcsnset (MSVCRT.@)
*/ */
WCHAR* _wcsnset( WCHAR* str, WCHAR c, MSVCRT_size_t n ) MSVCRT_wchar_t* _wcsnset( MSVCRT_wchar_t* str, MSVCRT_wchar_t c, MSVCRT_size_t n )
{ {
WCHAR* ret = str; MSVCRT_wchar_t* ret = str;
while ((n-- > 0) && *str) *str++ = c; while ((n-- > 0) && *str) *str++ = c;
return ret; return ret;
} }
...@@ -88,13 +88,13 @@ WCHAR* _wcsnset( WCHAR* str, WCHAR c, MSVCRT_size_t n ) ...@@ -88,13 +88,13 @@ WCHAR* _wcsnset( WCHAR* str, WCHAR c, MSVCRT_size_t n )
/********************************************************************* /*********************************************************************
* _wcsrev (MSVCRT.@) * _wcsrev (MSVCRT.@)
*/ */
WCHAR* _wcsrev( WCHAR* str ) MSVCRT_wchar_t* _wcsrev( MSVCRT_wchar_t* str )
{ {
WCHAR* ret = str; MSVCRT_wchar_t* ret = str;
WCHAR* end = str + strlenW(str) - 1; MSVCRT_wchar_t* end = str + strlenW(str) - 1;
while (end > str) while (end > str)
{ {
WCHAR t = *end; MSVCRT_wchar_t t = *end;
*end-- = *str; *end-- = *str;
*str++ = t; *str++ = t;
} }
...@@ -104,9 +104,9 @@ WCHAR* _wcsrev( WCHAR* str ) ...@@ -104,9 +104,9 @@ WCHAR* _wcsrev( WCHAR* str )
/********************************************************************* /*********************************************************************
* _wcsset (MSVCRT.@) * _wcsset (MSVCRT.@)
*/ */
WCHAR* _wcsset( WCHAR* str, WCHAR c ) MSVCRT_wchar_t* _wcsset( MSVCRT_wchar_t* str, MSVCRT_wchar_t c )
{ {
WCHAR* ret = str; MSVCRT_wchar_t* ret = str;
while (*str) *str++ = c; while (*str) *str++ = c;
return ret; return ret;
} }
...@@ -114,37 +114,37 @@ WCHAR* _wcsset( WCHAR* str, WCHAR c ) ...@@ -114,37 +114,37 @@ WCHAR* _wcsset( WCHAR* str, WCHAR c )
/********************************************************************* /*********************************************************************
* _vsnwprintf (MSVCRT.@) * _vsnwprintf (MSVCRT.@)
*/ */
int _vsnwprintf(WCHAR *str, unsigned int len, int _vsnwprintf(MSVCRT_wchar_t *str, unsigned int len,
const WCHAR *format, va_list valist) const MSVCRT_wchar_t *format, va_list valist)
{ {
/* If you fix a bug in this function, fix it in ntdll/wcstring.c also! */ /* If you fix a bug in this function, fix it in ntdll/wcstring.c also! */
unsigned int written = 0; unsigned int written = 0;
const WCHAR *iter = format; const MSVCRT_wchar_t *iter = format;
char bufa[256], fmtbufa[64], *fmta; char bufa[256], fmtbufa[64], *fmta;
TRACE("(%d,%s)\n",len,debugstr_w(format)); TRACE("(%d,%s)\n",len,debugstr_w(format));
while (*iter) while (*iter)
{ {
while (*iter && *iter != (WCHAR)L'%') while (*iter && *iter != '%')
{ {
if (written++ >= len) if (written++ >= len)
return -1; return -1;
*str++ = *iter++; *str++ = *iter++;
} }
if (*iter == (WCHAR)L'%') if (*iter == '%')
{ {
fmta = fmtbufa; fmta = fmtbufa;
*fmta++ = *iter++; *fmta++ = *iter++;
while (*iter == (WCHAR)L'0' || while (*iter == '0' ||
*iter == (WCHAR)L'+' || *iter == '+' ||
*iter == (WCHAR)L'-' || *iter == '-' ||
*iter == (WCHAR)L' ' || *iter == ' ' ||
*iter == (WCHAR)L'0' || *iter == '0' ||
*iter == (WCHAR)L'*' || *iter == '*' ||
*iter == (WCHAR)L'#') *iter == '#')
{ {
if (*iter == (WCHAR)L'*') if (*iter == '*')
{ {
char *buffiter = bufa; char *buffiter = bufa;
int fieldlen = va_arg(valist, int); int fieldlen = va_arg(valist, int);
...@@ -160,10 +160,10 @@ int _vsnwprintf(WCHAR *str, unsigned int len, ...@@ -160,10 +160,10 @@ int _vsnwprintf(WCHAR *str, unsigned int len,
while (isdigit(*iter)) while (isdigit(*iter))
*fmta++ = *iter++; *fmta++ = *iter++;
if (*iter == (WCHAR)L'.') if (*iter == '.')
{ {
*fmta++ = *iter++; *fmta++ = *iter++;
if (*iter == (WCHAR)L'*') if (*iter == '*')
{ {
char *buffiter = bufa; char *buffiter = bufa;
int fieldlen = va_arg(valist, int); int fieldlen = va_arg(valist, int);
...@@ -175,17 +175,17 @@ int _vsnwprintf(WCHAR *str, unsigned int len, ...@@ -175,17 +175,17 @@ int _vsnwprintf(WCHAR *str, unsigned int len,
while (isdigit(*iter)) while (isdigit(*iter))
*fmta++ = *iter++; *fmta++ = *iter++;
} }
if (*iter == (WCHAR)L'h' || if (*iter == 'h' ||
*iter == (WCHAR)L'l') *iter == 'l')
*fmta++ = *iter++; *fmta++ = *iter++;
switch (*iter) switch (*iter)
{ {
case (WCHAR)L's': case 's':
{ {
static const WCHAR none[] = { '(', 'n', 'u', 'l', 'l', ')', 0 }; static const MSVCRT_wchar_t none[] = { '(', 'n', 'u', 'l', 'l', ')', 0 };
const WCHAR *wstr = va_arg(valist, const WCHAR *); const MSVCRT_wchar_t *wstr = va_arg(valist, const MSVCRT_wchar_t *);
const WCHAR *striter = wstr ? wstr : none; const MSVCRT_wchar_t *striter = wstr ? wstr : none;
while (*striter) while (*striter)
{ {
if (written++ >= len) if (written++ >= len)
...@@ -196,10 +196,10 @@ int _vsnwprintf(WCHAR *str, unsigned int len, ...@@ -196,10 +196,10 @@ int _vsnwprintf(WCHAR *str, unsigned int len,
break; break;
} }
case (WCHAR)L'c': case 'c':
if (written++ >= len) if (written++ >= len)
return -1; return -1;
*str++ = (WCHAR)va_arg(valist, int); *str++ = (MSVCRT_wchar_t)va_arg(valist, int);
iter++; iter++;
break; break;
...@@ -208,13 +208,13 @@ int _vsnwprintf(WCHAR *str, unsigned int len, ...@@ -208,13 +208,13 @@ int _vsnwprintf(WCHAR *str, unsigned int len,
/* For non wc types, use system sprintf and append to wide char output */ /* For non wc types, use system sprintf and append to wide char output */
/* FIXME: for unrecognised types, should ignore % when printing */ /* FIXME: for unrecognised types, should ignore % when printing */
char *bufaiter = bufa; char *bufaiter = bufa;
if (*iter == (WCHAR)L'p') if (*iter == 'p')
sprintf(bufaiter, "%08lX", va_arg(valist, long)); sprintf(bufaiter, "%08lX", va_arg(valist, long));
else else
{ {
*fmta++ = *iter; *fmta++ = *iter;
*fmta = '\0'; *fmta = '\0';
if (*iter == (WCHAR)L'f') if (*iter == 'f')
sprintf(bufaiter, fmtbufa, va_arg(valist, double)); sprintf(bufaiter, fmtbufa, va_arg(valist, double));
else else
sprintf(bufaiter, fmtbufa, va_arg(valist, void *)); sprintf(bufaiter, fmtbufa, va_arg(valist, void *));
...@@ -233,14 +233,14 @@ int _vsnwprintf(WCHAR *str, unsigned int len, ...@@ -233,14 +233,14 @@ int _vsnwprintf(WCHAR *str, unsigned int len,
} }
if (written >= len) if (written >= len)
return -1; return -1;
*str++ = (WCHAR)L'\0'; *str++ = 0;
return (int)written; return (int)written;
} }
/********************************************************************* /*********************************************************************
* vswprintf (MSVCRT.@) * vswprintf (MSVCRT.@)
*/ */
int MSVCRT_vswprintf( WCHAR* str, const WCHAR* format, va_list args ) int MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, va_list args )
{ {
return _vsnwprintf( str, INT_MAX, format, args ); return _vsnwprintf( str, INT_MAX, format, args );
} }
...@@ -248,7 +248,7 @@ int MSVCRT_vswprintf( WCHAR* str, const WCHAR* format, va_list args ) ...@@ -248,7 +248,7 @@ int MSVCRT_vswprintf( WCHAR* str, const WCHAR* format, va_list args )
/********************************************************************* /*********************************************************************
* wcscoll (MSVCRT.@) * wcscoll (MSVCRT.@)
*/ */
int MSVCRT_wcscoll( const WCHAR* str1, const WCHAR* str2 ) int MSVCRT_wcscoll( const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* str2 )
{ {
/* FIXME: handle collates */ /* FIXME: handle collates */
return strcmpW( str1, str2 ); return strcmpW( str1, str2 );
...@@ -257,12 +257,12 @@ int MSVCRT_wcscoll( const WCHAR* str1, const WCHAR* str2 ) ...@@ -257,12 +257,12 @@ int MSVCRT_wcscoll( const WCHAR* str1, const WCHAR* str2 )
/********************************************************************* /*********************************************************************
* wcspbrk (MSVCRT.@) * wcspbrk (MSVCRT.@)
*/ */
WCHAR* MSVCRT_wcspbrk( const WCHAR* str, const WCHAR* accept ) MSVCRT_wchar_t* MSVCRT_wcspbrk( const MSVCRT_wchar_t* str, const MSVCRT_wchar_t* accept )
{ {
const WCHAR* p; const MSVCRT_wchar_t* p;
while (*str) while (*str)
{ {
for (p = accept; *p; p++) if (*p == *str) return (WCHAR*)str; for (p = accept; *p; p++) if (*p == *str) return (MSVCRT_wchar_t*)str;
str++; str++;
} }
return NULL; return NULL;
...@@ -271,7 +271,7 @@ WCHAR* MSVCRT_wcspbrk( const WCHAR* str, const WCHAR* accept ) ...@@ -271,7 +271,7 @@ WCHAR* MSVCRT_wcspbrk( const WCHAR* str, const WCHAR* accept )
/********************************************************************* /*********************************************************************
* wctomb (MSVCRT.@) * wctomb (MSVCRT.@)
*/ */
INT MSVCRT_wctomb( char *dst, WCHAR ch ) INT MSVCRT_wctomb( char *dst, MSVCRT_wchar_t ch )
{ {
return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL ); return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL );
} }
...@@ -279,7 +279,7 @@ INT MSVCRT_wctomb( char *dst, WCHAR ch ) ...@@ -279,7 +279,7 @@ INT MSVCRT_wctomb( char *dst, WCHAR ch )
/********************************************************************* /*********************************************************************
* iswalnum (MSVCRT.@) * iswalnum (MSVCRT.@)
*/ */
INT MSVCRT_iswalnum( WCHAR wc ) INT MSVCRT_iswalnum( MSVCRT_wchar_t wc )
{ {
return isalnumW( wc ); return isalnumW( wc );
} }
...@@ -287,7 +287,7 @@ INT MSVCRT_iswalnum( WCHAR wc ) ...@@ -287,7 +287,7 @@ INT MSVCRT_iswalnum( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswalpha (MSVCRT.@) * iswalpha (MSVCRT.@)
*/ */
INT MSVCRT_iswalpha( WCHAR wc ) INT MSVCRT_iswalpha( MSVCRT_wchar_t wc )
{ {
return isalphaW( wc ); return isalphaW( wc );
} }
...@@ -295,7 +295,7 @@ INT MSVCRT_iswalpha( WCHAR wc ) ...@@ -295,7 +295,7 @@ INT MSVCRT_iswalpha( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswcntrl (MSVCRT.@) * iswcntrl (MSVCRT.@)
*/ */
INT MSVCRT_iswcntrl( WCHAR wc ) INT MSVCRT_iswcntrl( MSVCRT_wchar_t wc )
{ {
return iscntrlW( wc ); return iscntrlW( wc );
} }
...@@ -303,7 +303,7 @@ INT MSVCRT_iswcntrl( WCHAR wc ) ...@@ -303,7 +303,7 @@ INT MSVCRT_iswcntrl( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswdigit (MSVCRT.@) * iswdigit (MSVCRT.@)
*/ */
INT MSVCRT_iswdigit( WCHAR wc ) INT MSVCRT_iswdigit( MSVCRT_wchar_t wc )
{ {
return isdigitW( wc ); return isdigitW( wc );
} }
...@@ -311,7 +311,7 @@ INT MSVCRT_iswdigit( WCHAR wc ) ...@@ -311,7 +311,7 @@ INT MSVCRT_iswdigit( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswgraph (MSVCRT.@) * iswgraph (MSVCRT.@)
*/ */
INT MSVCRT_iswgraph( WCHAR wc ) INT MSVCRT_iswgraph( MSVCRT_wchar_t wc )
{ {
return isgraphW( wc ); return isgraphW( wc );
} }
...@@ -319,7 +319,7 @@ INT MSVCRT_iswgraph( WCHAR wc ) ...@@ -319,7 +319,7 @@ INT MSVCRT_iswgraph( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswlower (MSVCRT.@) * iswlower (MSVCRT.@)
*/ */
INT MSVCRT_iswlower( WCHAR wc ) INT MSVCRT_iswlower( MSVCRT_wchar_t wc )
{ {
return islowerW( wc ); return islowerW( wc );
} }
...@@ -327,7 +327,7 @@ INT MSVCRT_iswlower( WCHAR wc ) ...@@ -327,7 +327,7 @@ INT MSVCRT_iswlower( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswprint (MSVCRT.@) * iswprint (MSVCRT.@)
*/ */
INT MSVCRT_iswprint( WCHAR wc ) INT MSVCRT_iswprint( MSVCRT_wchar_t wc )
{ {
return isprintW( wc ); return isprintW( wc );
} }
...@@ -335,7 +335,7 @@ INT MSVCRT_iswprint( WCHAR wc ) ...@@ -335,7 +335,7 @@ INT MSVCRT_iswprint( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswpunct (MSVCRT.@) * iswpunct (MSVCRT.@)
*/ */
INT MSVCRT_iswpunct( WCHAR wc ) INT MSVCRT_iswpunct( MSVCRT_wchar_t wc )
{ {
return ispunctW( wc ); return ispunctW( wc );
} }
...@@ -343,7 +343,7 @@ INT MSVCRT_iswpunct( WCHAR wc ) ...@@ -343,7 +343,7 @@ INT MSVCRT_iswpunct( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswspace (MSVCRT.@) * iswspace (MSVCRT.@)
*/ */
INT MSVCRT_iswspace( WCHAR wc ) INT MSVCRT_iswspace( MSVCRT_wchar_t wc )
{ {
return isspaceW( wc ); return isspaceW( wc );
} }
...@@ -351,7 +351,7 @@ INT MSVCRT_iswspace( WCHAR wc ) ...@@ -351,7 +351,7 @@ INT MSVCRT_iswspace( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswupper (MSVCRT.@) * iswupper (MSVCRT.@)
*/ */
INT MSVCRT_iswupper( WCHAR wc ) INT MSVCRT_iswupper( MSVCRT_wchar_t wc )
{ {
return isupperW( wc ); return isupperW( wc );
} }
...@@ -359,7 +359,7 @@ INT MSVCRT_iswupper( WCHAR wc ) ...@@ -359,7 +359,7 @@ INT MSVCRT_iswupper( WCHAR wc )
/********************************************************************* /*********************************************************************
* iswxdigit (MSVCRT.@) * iswxdigit (MSVCRT.@)
*/ */
INT MSVCRT_iswxdigit( WCHAR wc ) INT MSVCRT_iswxdigit( MSVCRT_wchar_t wc )
{ {
return isxdigitW( wc ); return isxdigitW( wc );
} }
...@@ -367,7 +367,7 @@ INT MSVCRT_iswxdigit( WCHAR wc ) ...@@ -367,7 +367,7 @@ INT MSVCRT_iswxdigit( WCHAR wc )
/********************************************************************* /*********************************************************************
* _itow (MSVCRT.@) * _itow (MSVCRT.@)
*/ */
WCHAR* _itow(int value,WCHAR* out,int base) MSVCRT_wchar_t* _itow(int value,MSVCRT_wchar_t* out,int base)
{ {
char buf[64]; char buf[64];
_itoa(value, buf, base); _itoa(value, buf, base);
...@@ -378,11 +378,10 @@ WCHAR* _itow(int value,WCHAR* out,int base) ...@@ -378,11 +378,10 @@ WCHAR* _itow(int value,WCHAR* out,int base)
/********************************************************************* /*********************************************************************
* _ltow (MSVCRT.@) * _ltow (MSVCRT.@)
*/ */
WCHAR* _ltow(long value,WCHAR* out,int base) MSVCRT_wchar_t* _ltow(long value,MSVCRT_wchar_t* out,int base)
{ {
char buf[128]; char buf[128];
_ltoa(value, buf, base); _ltoa(value, buf, base);
MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, buf, -1, out, 128); MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, buf, -1, out, 128);
return out; return out;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment