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 */
......
...@@ -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 */
......
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