msvcrt: Don't use wine/unicode.h header.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-07-21 12:21:59 +02:00 committed by Alexandre Julliard
parent b34b7e171e
commit 536be09b84
14 changed files with 83 additions and 86 deletions

View File

@ -92,7 +92,7 @@ int CDECL _cputws(const MSVCRT_wchar_t* str)
int len, retval = -1; int len, retval = -1;
if (!MSVCRT_CHECK_PMT(str != NULL)) return -1; if (!MSVCRT_CHECK_PMT(str != NULL)) return -1;
len = lstrlenW(str); len = MSVCRT_wcslen(str);
LOCK_CONSOLE; LOCK_CONSOLE;
if (WriteConsoleW(MSVCRT_console_out, str, len, &count, NULL) if (WriteConsoleW(MSVCRT_console_out, str, len, &count, NULL)

View File

@ -20,7 +20,6 @@
#include "msvcrt.h" #include "msvcrt.h"
#include "winnls.h" #include "winnls.h"
#include "wine/unicode.h"
/* Some abbreviations to make the following table readable */ /* Some abbreviations to make the following table readable */
#define _C_ MSVCRT__CONTROL #define _C_ MSVCRT__CONTROL

View File

@ -23,7 +23,7 @@
#include <math.h> #include <math.h>
#include "msvcrt.h" #include "msvcrt.h"
#include "wine/unicode.h" #include <winnls.h>
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@ -111,11 +111,11 @@ MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **wblk)
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 */
MSVCRT_wchar_t *wptr; MSVCRT_wchar_t *wptr;
for (wptr = wenviron_strings; *wptr; wptr += strlenW(wptr) + 1) for (wptr = wenviron_strings; *wptr; wptr += MSVCRT_wcslen(wptr) + 1)
{ {
/* Don't count environment variables starting with '=' which are command shell specific */ /* Don't count environment variables starting with '=' which are command shell specific */
if (*wptr != '=') count++; if (*wptr != '=') count++;
len += strlenW(wptr) + 1; len += MSVCRT_wcslen(wptr) + 1;
} }
if (wblk) if (wblk)
wblk = HeapReAlloc( GetProcessHeap(), 0, wblk, count* sizeof(MSVCRT_wchar_t*) + len * sizeof(MSVCRT_wchar_t)); wblk = HeapReAlloc( GetProcessHeap(), 0, wblk, count* sizeof(MSVCRT_wchar_t*) + len * sizeof(MSVCRT_wchar_t));
@ -126,7 +126,7 @@ MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **wblk)
if (count) if (count)
{ {
memcpy(&wblk[count],wenviron_strings,len * sizeof(MSVCRT_wchar_t)); memcpy(&wblk[count],wenviron_strings,len * sizeof(MSVCRT_wchar_t));
for (wptr = (MSVCRT_wchar_t*)&wblk[count]; *wptr; wptr += strlenW(wptr) + 1) for (wptr = (MSVCRT_wchar_t*)&wblk[count]; *wptr; wptr += MSVCRT_wcslen(wptr) + 1)
{ {
/* Skip special environment strings set by the command shell */ /* Skip special environment strings set by the command shell */
if (*wptr != '=') wblk[i++] = wptr; if (*wptr != '=') wblk[i++] = wptr;
@ -163,7 +163,7 @@ static char **build_argv( WCHAR **wargv )
static WCHAR **cmdline_to_argv( const WCHAR *src, int *ret_argc ) static WCHAR **cmdline_to_argv( const WCHAR *src, int *ret_argc )
{ {
WCHAR **argv, *arg, *dst; WCHAR **argv, *arg, *dst;
int argc, in_quotes = 0, bcount = 0, len = lstrlenW(src) + 1; int argc, in_quotes = 0, bcount = 0, len = MSVCRT_wcslen(src) + 1;
argc = 2 + len / 2; argc = 2 + len / 2;
argv = HeapAlloc( GetProcessHeap(), 0, argc * sizeof(*argv) + len * sizeof(WCHAR) ); argv = HeapAlloc( GetProcessHeap(), 0, argc * sizeof(*argv) + len * sizeof(WCHAR) );
@ -489,7 +489,7 @@ static int build_expanded_wargv(int *argc, MSVCRT_wchar_t **argv)
int len = 0; int len = 0;
is_expandable = FALSE; is_expandable = FALSE;
for(path_len = strlenW(initial_wargv[i])-1; path_len>=0; path_len--) { for(path_len = MSVCRT_wcslen(initial_wargv[i])-1; path_len>=0; path_len--) {
if(initial_wargv[i][path_len]=='*' || initial_wargv[i][path_len]=='?') if(initial_wargv[i][path_len]=='*' || initial_wargv[i][path_len]=='?')
is_expandable = TRUE; is_expandable = TRUE;
else if(initial_wargv[i][path_len]=='\\' || initial_wargv[i][path_len]=='/') else if(initial_wargv[i][path_len]=='\\' || initial_wargv[i][path_len]=='/')
@ -508,7 +508,7 @@ static int build_expanded_wargv(int *argc, MSVCRT_wchar_t **argv)
(data.cFileName[1]=='.' && data.cFileName[2]=='\0'))) (data.cFileName[1]=='.' && data.cFileName[2]=='\0')))
continue; continue;
len = strlenW(data.cFileName)+1; len = MSVCRT_wcslen(data.cFileName)+1;
if(argv) { if(argv) {
argv[args_no] = (MSVCRT_wchar_t*)(argv+*argc+1)+size; argv[args_no] = (MSVCRT_wchar_t*)(argv+*argc+1)+size;
memcpy(argv[args_no], initial_wargv[i], path_len*sizeof(MSVCRT_wchar_t)); memcpy(argv[args_no], initial_wargv[i], path_len*sizeof(MSVCRT_wchar_t));
@ -521,7 +521,7 @@ static int build_expanded_wargv(int *argc, MSVCRT_wchar_t **argv)
} }
if(!len) { if(!len) {
len = strlenW(initial_wargv[i])+1; len = MSVCRT_wcslen(initial_wargv[i])+1;
if(argv) { if(argv) {
argv[args_no] = (MSVCRT_wchar_t*)(argv+*argc+1)+size; argv[args_no] = (MSVCRT_wchar_t*)(argv+*argc+1)+size;
memcpy(argv[args_no], initial_wargv[i], len*sizeof(MSVCRT_wchar_t)); memcpy(argv[args_no], initial_wargv[i], len*sizeof(MSVCRT_wchar_t));

View File

@ -29,7 +29,6 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h" #include "winternl.h"
#include "wine/unicode.h"
#include "msvcrt.h" #include "msvcrt.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -92,7 +91,7 @@ static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata
RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
ft->time_write = dw; ft->time_write = dw;
ft->size = fd->nFileSizeLow; ft->size = fd->nFileSizeLow;
strcpyW(ft->name, fd->cFileName); MSVCRT_wcscpy(ft->name, fd->cFileName);
} }
/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata32_t */ /* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata32_t */
@ -112,7 +111,7 @@ static void msvcrt_wfttofd32(const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddat
RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
ft->time_write = dw; ft->time_write = dw;
ft->size = fd->nFileSizeLow; ft->size = fd->nFileSizeLow;
strcpyW(ft->name, fd->cFileName); MSVCRT_wcscpy(ft->name, fd->cFileName);
} }
/* INTERNAL: Translate WIN32_FIND_DATAA to finddatai64_t */ /* INTERNAL: Translate WIN32_FIND_DATAA to finddatai64_t */
@ -172,7 +171,7 @@ static void msvcrt_wfttofd64( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfindda
RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
ft->time_write = dw; ft->time_write = dw;
ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow; ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow;
strcpyW(ft->name, fd->cFileName); MSVCRT_wcscpy(ft->name, fd->cFileName);
} }
/* INTERNAL: Translate WIN32_FIND_DATAA to finddata64i32_t */ /* INTERNAL: Translate WIN32_FIND_DATAA to finddata64i32_t */
@ -212,7 +211,7 @@ static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfindd
RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
ft->time_write = dw; ft->time_write = dw;
ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow; ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow;
strcpyW(ft->name, fd->cFileName); MSVCRT_wcscpy(ft->name, fd->cFileName);
} }
/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata64i32_t */ /* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata64i32_t */
@ -232,7 +231,7 @@ static void msvcrt_wfttofd64i32( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfin
RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
ft->time_write = dw; ft->time_write = dw;
ft->size = fd->nFileSizeLow; ft->size = fd->nFileSizeLow;
strcpyW(ft->name, fd->cFileName); MSVCRT_wcscpy(ft->name, fd->cFileName);
} }
/********************************************************************* /*********************************************************************
@ -807,7 +806,7 @@ MSVCRT_wchar_t* CDECL MSVCRT__wgetcwd(MSVCRT_wchar_t * buf, int size)
*MSVCRT__errno() = MSVCRT_ERANGE; *MSVCRT__errno() = MSVCRT_ERANGE;
return NULL; /* buf too small */ return NULL; /* buf too small */
} }
strcpyW(buf,dir); MSVCRT_wcscpy(buf,dir);
return buf; return buf;
} }
@ -920,7 +919,7 @@ MSVCRT_wchar_t* CDECL MSVCRT__wgetdcwd(int drive, MSVCRT_wchar_t * buf, int size
TRACE(":returning %s\n", debugstr_w(dir)); TRACE(":returning %s\n", debugstr_w(dir));
if (!buf) if (!buf)
return MSVCRT__wcsdup(dir); /* allocate */ return MSVCRT__wcsdup(dir); /* allocate */
strcpyW(buf,dir); MSVCRT_wcscpy(buf,dir);
} }
return buf; return buf;
} }
@ -1204,8 +1203,8 @@ int CDECL MSVCRT__wsplitpath_s(const MSVCRT_wchar_t* inpath,
} }
if (ext) if (ext)
{ {
if (sz_ext <= strlenW(end)) goto do_error; if (sz_ext <= MSVCRT_wcslen(end)) goto do_error;
strcpyW( ext, end ); MSVCRT_wcscpy( ext, end );
} }
return 0; return 0;
do_error: do_error:
@ -1408,7 +1407,7 @@ VOID CDECL MSVCRT__wmakepath(MSVCRT_wchar_t *path, const MSVCRT_wchar_t *drive,
} }
if (directory && directory[0]) if (directory && directory[0])
{ {
unsigned int len = strlenW(directory); unsigned int len = MSVCRT_wcslen(directory);
memmove(p, directory, len * sizeof(MSVCRT_wchar_t)); memmove(p, directory, len * sizeof(MSVCRT_wchar_t));
p += len; p += len;
if (p[-1] != '/' && p[-1] != '\\') if (p[-1] != '/' && p[-1] != '\\')
@ -1416,7 +1415,7 @@ VOID CDECL MSVCRT__wmakepath(MSVCRT_wchar_t *path, const MSVCRT_wchar_t *drive,
} }
if (filename && filename[0]) if (filename && filename[0])
{ {
unsigned int len = strlenW(filename); unsigned int len = MSVCRT_wcslen(filename);
memmove(p, filename, len * sizeof(MSVCRT_wchar_t)); memmove(p, filename, len * sizeof(MSVCRT_wchar_t));
p += len; p += len;
} }
@ -1424,7 +1423,7 @@ VOID CDECL MSVCRT__wmakepath(MSVCRT_wchar_t *path, const MSVCRT_wchar_t *drive,
{ {
if (extension[0] != '.') if (extension[0] != '.')
*p++ = '.'; *p++ = '.';
strcpyW(p, extension); MSVCRT_wcscpy(p, extension);
} }
else else
*p = '\0'; *p = '\0';
@ -1565,7 +1564,7 @@ int CDECL MSVCRT__wmakepath_s(MSVCRT_wchar_t *path, MSVCRT_size_t size, const MS
if (directory && directory[0]) if (directory && directory[0])
{ {
unsigned int len = strlenW(directory); unsigned int len = MSVCRT_wcslen(directory);
unsigned int needs_separator = directory[len - 1] != '/' && directory[len - 1] != '\\'; unsigned int needs_separator = directory[len - 1] != '/' && directory[len - 1] != '\\';
unsigned int copylen = min(size - 1, len); unsigned int copylen = min(size - 1, len);
@ -1592,7 +1591,7 @@ int CDECL MSVCRT__wmakepath_s(MSVCRT_wchar_t *path, MSVCRT_size_t size, const MS
if (filename && filename[0]) if (filename && filename[0])
{ {
unsigned int len = strlenW(filename); unsigned int len = MSVCRT_wcslen(filename);
unsigned int copylen = min(size - 1, len); unsigned int copylen = min(size - 1, len);
if (size < 2) if (size < 2)
@ -1609,7 +1608,7 @@ int CDECL MSVCRT__wmakepath_s(MSVCRT_wchar_t *path, MSVCRT_size_t size, const MS
if (extension && extension[0]) if (extension && extension[0])
{ {
unsigned int len = strlenW(extension); unsigned int len = MSVCRT_wcslen(extension);
unsigned int needs_period = extension[0] != '.'; unsigned int needs_period = extension[0] != '.';
unsigned int copylen; unsigned int copylen;
@ -1750,7 +1749,7 @@ int CDECL MSVCRT__wsearchenv_s(const MSVCRT_wchar_t* file, const MSVCRT_wchar_t*
if (count > MAX_PATH) if (count > MAX_PATH)
FIXME("count > MAX_PATH not supported\n"); FIXME("count > MAX_PATH not supported\n");
fname_len = strlenW(file); fname_len = MSVCRT_wcslen(file);
*buf = '\0'; *buf = '\0';
/* Try CWD first */ /* Try CWD first */

View File

@ -20,7 +20,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "wine/unicode.h"
#include "msvcrt.h" #include "msvcrt.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -53,7 +52,7 @@ char * CDECL MSVCRT_getenv(const char *name)
MSVCRT_wchar_t * CDECL MSVCRT__wgetenv(const MSVCRT_wchar_t *name) MSVCRT_wchar_t * CDECL MSVCRT__wgetenv(const MSVCRT_wchar_t *name)
{ {
MSVCRT_wchar_t **environ; MSVCRT_wchar_t **environ;
unsigned int length=strlenW(name); unsigned int length=MSVCRT_wcslen(name);
/* Initialize the _wenviron array if it's not already created. */ /* Initialize the _wenviron array if it's not already created. */
if (!MSVCRT__wenviron) if (!MSVCRT__wenviron)
@ -62,7 +61,7 @@ MSVCRT_wchar_t * CDECL MSVCRT__wgetenv(const MSVCRT_wchar_t *name)
for (environ = MSVCRT__wenviron; *environ; environ++) for (environ = MSVCRT__wenviron; *environ; environ++)
{ {
MSVCRT_wchar_t *str = *environ; MSVCRT_wchar_t *str = *environ;
MSVCRT_wchar_t *pos = strchrW(str,'='); MSVCRT_wchar_t *pos = MSVCRT_wcschr(str,'=');
if (pos && ((pos - str) == length) && !MSVCRT__wcsnicmp(str,name,length)) if (pos && ((pos - str) == length) && !MSVCRT__wcsnicmp(str,name,length))
{ {
TRACE("(%s): got %s\n", debugstr_w(name), debugstr_w(pos + 1)); TRACE("(%s): got %s\n", debugstr_w(name), debugstr_w(pos + 1));
@ -131,7 +130,7 @@ int CDECL _wputenv(const MSVCRT_wchar_t *str)
if (!str) if (!str)
return -1; return -1;
name = HeapAlloc(GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(MSVCRT_wchar_t)); name = HeapAlloc(GetProcessHeap(), 0, (MSVCRT_wcslen(str) + 1) * sizeof(MSVCRT_wchar_t));
if (!name) if (!name)
return -1; return -1;
dst = name; dst = name;
@ -247,13 +246,13 @@ int CDECL _wdupenv_s(MSVCRT_wchar_t **buffer, MSVCRT_size_t *numberOfElements,
if (!(e = MSVCRT__wgetenv(varname))) return *MSVCRT__errno() = MSVCRT_EINVAL; if (!(e = MSVCRT__wgetenv(varname))) return *MSVCRT__errno() = MSVCRT_EINVAL;
sz = strlenW(e) + 1; sz = MSVCRT_wcslen(e) + 1;
if (!(*buffer = MSVCRT_malloc(sz * sizeof(MSVCRT_wchar_t)))) if (!(*buffer = MSVCRT_malloc(sz * sizeof(MSVCRT_wchar_t))))
{ {
if (numberOfElements) *numberOfElements = 0; if (numberOfElements) *numberOfElements = 0;
return *MSVCRT__errno() = MSVCRT_ENOMEM; return *MSVCRT__errno() = MSVCRT_ENOMEM;
} }
strcpyW(*buffer, e); MSVCRT_wcscpy(*buffer, e);
if (numberOfElements) *numberOfElements = sz; if (numberOfElements) *numberOfElements = sz;
return 0; return 0;
} }
@ -302,12 +301,12 @@ int CDECL _wgetenv_s(MSVCRT_size_t *pReturnValue, MSVCRT_wchar_t *buffer, MSVCRT
*pReturnValue = 0; *pReturnValue = 0;
return *MSVCRT__errno() = MSVCRT_EINVAL; return *MSVCRT__errno() = MSVCRT_EINVAL;
} }
*pReturnValue = strlenW(e) + 1; *pReturnValue = MSVCRT_wcslen(e) + 1;
if (numberOfElements < *pReturnValue) if (numberOfElements < *pReturnValue)
{ {
return *MSVCRT__errno() = MSVCRT_ERANGE; return *MSVCRT__errno() = MSVCRT_ERANGE;
} }
strcpyW(buffer, e); MSVCRT_wcscpy(buffer, e);
return 0; return 0;
} }

View File

@ -412,7 +412,7 @@ int CDECL MSVCRT___wcserror_s(MSVCRT_wchar_t* buffer, MSVCRT_size_t nc, const MS
if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr; if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr;
len = MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, NULL, 0) + 1 /* \n */; len = MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, NULL, 0) + 1 /* \n */;
if (str && *str) len += lstrlenW(str) + 2 /* ': ' */; if (str && *str) len += MSVCRT_wcslen(str) + 2 /* ': ' */;
if (len > nc) if (len > nc)
{ {
MSVCRT_INVALID_PMT("buffer[nc] is too small", MSVCRT_ERANGE); MSVCRT_INVALID_PMT("buffer[nc] is too small", MSVCRT_ERANGE);
@ -424,7 +424,7 @@ int CDECL MSVCRT___wcserror_s(MSVCRT_wchar_t* buffer, MSVCRT_size_t nc, const MS
lstrcatW(buffer, colonW); lstrcatW(buffer, colonW);
} }
else buffer[0] = '\0'; else buffer[0] = '\0';
len = lstrlenW(buffer); len = MSVCRT_wcslen(buffer);
MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, buffer + len, 256 - len); MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, buffer + len, 256 - len);
lstrcatW(buffer, nlW); lstrcatW(buffer, nlW);

View File

@ -41,11 +41,10 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h" #include "winternl.h"
#include "winnls.h"
#include "msvcrt.h" #include "msvcrt.h"
#include "mtdll.h" #include "mtdll.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@ -1535,7 +1534,7 @@ void CDECL MSVCRT_rewind(MSVCRT_FILE* file)
static int msvcrt_get_flags(const MSVCRT_wchar_t* mode, int *open_flags, int* stream_flags) static int msvcrt_get_flags(const MSVCRT_wchar_t* mode, int *open_flags, int* stream_flags)
{ {
int plus = strchrW(mode, '+') != NULL; int plus = MSVCRT_wcschr(mode, '+') != NULL;
TRACE("%s\n", debugstr_w(mode)); TRACE("%s\n", debugstr_w(mode));
@ -3137,7 +3136,7 @@ int CDECL MSVCRT__wstat64(const MSVCRT_wchar_t* path, struct MSVCRT__stat64 * bu
TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf); TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf);
plen = strlenW(path); plen = MSVCRT_wcslen(path);
while (plen && path[plen-1]==' ') while (plen && path[plen-1]==' ')
plen--; plen--;
@ -4683,7 +4682,7 @@ int CDECL MSVCRT_fputs(const char *s, MSVCRT_FILE* file)
*/ */
int CDECL MSVCRT_fputws(const MSVCRT_wchar_t *s, MSVCRT_FILE* file) int CDECL MSVCRT_fputws(const MSVCRT_wchar_t *s, MSVCRT_FILE* file)
{ {
MSVCRT_size_t i, len = strlenW(s); MSVCRT_size_t i, len = MSVCRT_wcslen(s);
BOOL tmp_buf; BOOL tmp_buf;
int ret; int ret;

View File

@ -35,7 +35,6 @@
#include "mtdll.h" #include "mtdll.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@ -568,8 +567,8 @@ MSVCRT_wchar_t* CDECL _W_Getdays(void)
TRACE("\n"); TRACE("\n");
for(i=0; i<7; i++) { for(i=0; i<7; i++) {
size += strlenW(cur->wstr.names.short_wday[i]) + 1; size += MSVCRT_wcslen(cur->wstr.names.short_wday[i]) + 1;
size += strlenW(cur->wstr.names.wday[i]) + 1; size += MSVCRT_wcslen(cur->wstr.names.wday[i]) + 1;
} }
out = MSVCRT_malloc((size+1)*sizeof(*out)); out = MSVCRT_malloc((size+1)*sizeof(*out));
if(!out) if(!out)
@ -578,12 +577,12 @@ MSVCRT_wchar_t* CDECL _W_Getdays(void)
size = 0; size = 0;
for(i=0; i<7; i++) { for(i=0; i<7; i++) {
out[size++] = ':'; out[size++] = ':';
len = strlenW(cur->wstr.names.short_wday[i]); len = MSVCRT_wcslen(cur->wstr.names.short_wday[i]);
memcpy(&out[size], cur->wstr.names.short_wday[i], len*sizeof(*out)); memcpy(&out[size], cur->wstr.names.short_wday[i], len*sizeof(*out));
size += len; size += len;
out[size++] = ':'; out[size++] = ':';
len = strlenW(cur->wstr.names.wday[i]); len = MSVCRT_wcslen(cur->wstr.names.wday[i]);
memcpy(&out[size], cur->wstr.names.wday[i], len*sizeof(*out)); memcpy(&out[size], cur->wstr.names.wday[i], len*sizeof(*out));
size += len; size += len;
} }
@ -642,8 +641,8 @@ MSVCRT_wchar_t* CDECL _W_Getmonths(void)
TRACE("\n"); TRACE("\n");
for(i=0; i<12; i++) { for(i=0; i<12; i++) {
size += strlenW(cur->wstr.names.short_mon[i]) + 1; size += MSVCRT_wcslen(cur->wstr.names.short_mon[i]) + 1;
size += strlenW(cur->wstr.names.mon[i]) + 1; size += MSVCRT_wcslen(cur->wstr.names.mon[i]) + 1;
} }
out = MSVCRT_malloc((size+1)*sizeof(*out)); out = MSVCRT_malloc((size+1)*sizeof(*out));
if(!out) if(!out)
@ -652,12 +651,12 @@ MSVCRT_wchar_t* CDECL _W_Getmonths(void)
size = 0; size = 0;
for(i=0; i<12; i++) { for(i=0; i<12; i++) {
out[size++] = ':'; out[size++] = ':';
len = strlenW(cur->wstr.names.short_mon[i]); len = MSVCRT_wcslen(cur->wstr.names.short_mon[i]);
memcpy(&out[size], cur->wstr.names.short_mon[i], len*sizeof(*out)); memcpy(&out[size], cur->wstr.names.short_mon[i], len*sizeof(*out));
size += len; size += len;
out[size++] = ':'; out[size++] = ':';
len = strlenW(cur->wstr.names.mon[i]); len = MSVCRT_wcslen(cur->wstr.names.mon[i]);
memcpy(&out[size], cur->wstr.names.mon[i], len*sizeof(*out)); memcpy(&out[size], cur->wstr.names.mon[i], len*sizeof(*out));
size += len; size += len;
} }

View File

@ -27,7 +27,7 @@
#include <limits.h> #include <limits.h>
#include "msvcrt.h" #include "msvcrt.h"
#include "wine/unicode.h" #include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);

View File

@ -1211,6 +1211,9 @@ int __cdecl MSVCRT__iswupper_l(MSVCRT_wchar_t, MSVCRT__locale_t);
int __cdecl MSVCRT__iswprint_l(MSVCRT_wchar_t, MSVCRT__locale_t); int __cdecl MSVCRT__iswprint_l(MSVCRT_wchar_t, MSVCRT__locale_t);
int __cdecl MSVCRT__iswpunct_l(MSVCRT_wchar_t, MSVCRT__locale_t); int __cdecl MSVCRT__iswpunct_l(MSVCRT_wchar_t, MSVCRT__locale_t);
MSVCRT_size_t __cdecl MSVCRT_wcslen(const MSVCRT_wchar_t*); MSVCRT_size_t __cdecl MSVCRT_wcslen(const MSVCRT_wchar_t*);
MSVCRT_wchar_t* __cdecl MSVCRT_wcscpy(MSVCRT_wchar_t*, const MSVCRT_wchar_t*);
MSVCRT_wchar_t* __cdecl MSVCRT_wcschr(const MSVCRT_wchar_t*, MSVCRT_wchar_t);
MSVCRT_wchar_t* __cdecl MSVCRT_wcscat(MSVCRT_wchar_t*, const MSVCRT_wchar_t*);
/* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd) /* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd)
* #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0) * #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0)

View File

@ -195,7 +195,7 @@ static inline int FUNC_NAME(pf_output_format_wstr)(FUNC_NAME(puts_clbk) pf_puts,
if(flags->Precision>=0) if(flags->Precision>=0)
len = MSVCRT_wcsnlen(str, flags->Precision); len = MSVCRT_wcsnlen(str, flags->Precision);
else else
len = strlenW(str); len = MSVCRT_wcslen(str);
} }
if(flags->Precision>=0 && flags->Precision<len) if(flags->Precision>=0 && flags->Precision<len)

View File

@ -31,9 +31,9 @@
#include <stdarg.h> #include <stdarg.h>
#include "msvcrt.h" #include "msvcrt.h"
#include <winnls.h>
#include "mtdll.h" #include "mtdll.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@ -44,15 +44,16 @@ static void msvcrt_search_executable(const MSVCRT_wchar_t *name, MSVCRT_wchar_t
{{'.','c','o','m',0}, {'.','e','x','e',0}, {'.','b','a','t',0}, {'.','c','m','d',0}}; {{'.','c','o','m',0}, {'.','e','x','e',0}, {'.','b','a','t',0}, {'.','c','m','d',0}};
MSVCRT_wchar_t buffer[MAX_PATH]; MSVCRT_wchar_t buffer[MAX_PATH];
const MSVCRT_wchar_t *env, *p; const MSVCRT_wchar_t *env, *p, *end;
unsigned int i, name_len, path_len; unsigned int i, name_len, path_len;
int extension = 1; int extension = 1;
*fullname = '\0'; *fullname = '\0';
msvcrt_set_errno(ERROR_FILE_NOT_FOUND); msvcrt_set_errno(ERROR_FILE_NOT_FOUND);
p = memchrW(name, '\0', MAX_PATH); end = name + MAX_PATH - 1;
if (!p) p = name + MAX_PATH - 1; for(p = name; p < end; p++)
if(!*p) break;
name_len = p - name; name_len = p - name;
/* FIXME extra-long names are silently truncated */ /* FIXME extra-long names are silently truncated */
@ -62,7 +63,7 @@ static void msvcrt_search_executable(const MSVCRT_wchar_t *name, MSVCRT_wchar_t
/* try current dir first */ /* try current dir first */
if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES) if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES)
{ {
strcpyW(fullname, buffer); MSVCRT_wcscpy(fullname, buffer);
return; return;
} }
@ -77,7 +78,7 @@ static void msvcrt_search_executable(const MSVCRT_wchar_t *name, MSVCRT_wchar_t
memcpy(buffer + name_len, suffix[i], 5 * sizeof(MSVCRT_wchar_t)); memcpy(buffer + name_len, suffix[i], 5 * sizeof(MSVCRT_wchar_t));
if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES) if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES)
{ {
strcpyW(fullname, buffer); MSVCRT_wcscpy(fullname, buffer);
return; return;
} }
} }
@ -104,10 +105,10 @@ static void msvcrt_search_executable(const MSVCRT_wchar_t *name, MSVCRT_wchar_t
} }
else buffer[path_len] = '\0'; else buffer[path_len] = '\0';
strcatW(buffer, name); MSVCRT_wcscat(buffer, name);
if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES) if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES)
{ {
strcpyW(fullname, buffer); MSVCRT_wcscpy(fullname, buffer);
return; return;
} }
} }
@ -119,7 +120,7 @@ static void msvcrt_search_executable(const MSVCRT_wchar_t *name, MSVCRT_wchar_t
memcpy(buffer + path_len + name_len, suffix[i], 5 * sizeof(MSVCRT_wchar_t)); memcpy(buffer + path_len + name_len, suffix[i], 5 * sizeof(MSVCRT_wchar_t));
if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES) if (GetFileAttributesW(buffer) != INVALID_FILE_ATTRIBUTES)
{ {
strcpyW(fullname, buffer); MSVCRT_wcscpy(fullname, buffer);
return; return;
} }
} }
@ -202,7 +203,7 @@ static MSVCRT_wchar_t* msvcrt_argvtos(const MSVCRT_wchar_t* const* arg, MSVCRT_w
size = 0; size = 0;
while (*a) while (*a)
{ {
size += strlenW(*a) + 1; size += MSVCRT_wcslen(*a) + 1;
a++; a++;
} }
@ -215,7 +216,7 @@ static MSVCRT_wchar_t* msvcrt_argvtos(const MSVCRT_wchar_t* const* arg, MSVCRT_w
p = ret; p = ret;
while (*a) while (*a)
{ {
int len = strlenW(*a); int len = MSVCRT_wcslen(*a);
memcpy(p,*a,len * sizeof(MSVCRT_wchar_t)); memcpy(p,*a,len * sizeof(MSVCRT_wchar_t));
p += len; p += len;
*p++ = delim; *p++ = delim;
@ -279,7 +280,7 @@ static MSVCRT_wchar_t *msvcrt_valisttos(const MSVCRT_wchar_t *arg0, __ms_va_list
for (arg = arg0; arg; arg = va_arg( alist, MSVCRT_wchar_t * )) for (arg = arg0; arg; arg = va_arg( alist, MSVCRT_wchar_t * ))
{ {
unsigned int len = strlenW( arg ) + 1; unsigned int len = MSVCRT_wcslen( arg ) + 1;
if (pos + len >= size) if (pos + len >= size)
{ {
size = max( 256, size * 2 ); size = max( 256, size * 2 );
@ -291,7 +292,7 @@ static MSVCRT_wchar_t *msvcrt_valisttos(const MSVCRT_wchar_t *arg0, __ms_va_list
} }
ret = new; ret = new;
} }
strcpyW( ret + pos, arg ); MSVCRT_wcscpy( ret + pos, arg );
pos += len; pos += len;
ret[pos - 1] = delim; ret[pos - 1] = delim;
} }
@ -348,7 +349,7 @@ static MSVCRT_wchar_t *msvcrt_get_comspec(void)
if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = ARRAY_SIZE(cmd); if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = ARRAY_SIZE(cmd);
if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t)))) if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t))))
{ {
if (!GetEnvironmentVariableW(comspec, ret, len)) strcpyW(ret, cmd); if (!GetEnvironmentVariableW(comspec, ret, len)) MSVCRT_wcscpy(ret, cmd);
} }
return ret; return ret;
} }
@ -1109,7 +1110,7 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wc
MSVCRT__close(fds[fdToDup]); MSVCRT__close(fds[fdToDup]);
if (!(comspec = msvcrt_get_comspec())) goto error; if (!(comspec = msvcrt_get_comspec())) goto error;
len = strlenW(comspec) + strlenW(flag) + strlenW(command) + 1; len = MSVCRT_wcslen(comspec) + MSVCRT_wcslen(flag) + MSVCRT_wcslen(command) + 1;
if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t)))) if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t))))
{ {
@ -1117,9 +1118,9 @@ MSVCRT_FILE* CDECL MSVCRT__wpopen(const MSVCRT_wchar_t* command, const MSVCRT_wc
goto error; goto error;
} }
strcpyW(fullcmd, comspec); MSVCRT_wcscpy(fullcmd, comspec);
strcatW(fullcmd, flag); MSVCRT_wcscat(fullcmd, flag);
strcatW(fullcmd, command); MSVCRT_wcscat(fullcmd, command);
if ((container->proc = (HANDLE)msvcrt_spawn(MSVCRT__P_NOWAIT, comspec, fullcmd, NULL, 1)) if ((container->proc = (HANDLE)msvcrt_spawn(MSVCRT__P_NOWAIT, comspec, fullcmd, NULL, 1))
== INVALID_HANDLE_VALUE) == INVALID_HANDLE_VALUE)
@ -1243,16 +1244,16 @@ int CDECL _wsystem(const MSVCRT_wchar_t* cmd)
if ( comspec == NULL) if ( comspec == NULL)
return -1; return -1;
len = strlenW(comspec) + strlenW(flag) + strlenW(cmd) + 1; len = MSVCRT_wcslen(comspec) + MSVCRT_wcslen(flag) + MSVCRT_wcslen(cmd) + 1;
if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t)))) if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t))))
{ {
HeapFree(GetProcessHeap(), 0, comspec); HeapFree(GetProcessHeap(), 0, comspec);
return -1; return -1;
} }
strcpyW(fullcmd, comspec); MSVCRT_wcscpy(fullcmd, comspec);
strcatW(fullcmd, flag); MSVCRT_wcscat(fullcmd, flag);
strcatW(fullcmd, cmd); MSVCRT_wcscat(fullcmd, cmd);
res = msvcrt_spawn(MSVCRT__P_WAIT, comspec, fullcmd, NULL, 1); res = msvcrt_spawn(MSVCRT__P_WAIT, comspec, fullcmd, NULL, 1);

View File

@ -32,7 +32,6 @@
#include "winnls.h" #include "winnls.h"
#include "winternl.h" #include "winternl.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);

View File

@ -28,7 +28,6 @@
#include "msvcrt.h" #include "msvcrt.h"
#include "winnls.h" #include "winnls.h"
#include "wtypes.h" #include "wtypes.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@ -79,7 +78,7 @@ MSVCRT_wchar_t* CDECL MSVCRT__wcsdup( const MSVCRT_wchar_t* str )
MSVCRT_wchar_t* ret = NULL; MSVCRT_wchar_t* ret = NULL;
if (str) if (str)
{ {
int size = (strlenW(str) + 1) * sizeof(MSVCRT_wchar_t); int size = (MSVCRT_wcslen(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 );
} }
@ -298,7 +297,7 @@ int CDECL MSVCRT__wcsnset_s( MSVCRT_wchar_t *str, MSVCRT_size_t size, MSVCRT_wch
MSVCRT_wchar_t* CDECL MSVCRT__wcsrev( MSVCRT_wchar_t* str ) MSVCRT_wchar_t* CDECL MSVCRT__wcsrev( MSVCRT_wchar_t* str )
{ {
MSVCRT_wchar_t* ret = str; MSVCRT_wchar_t* ret = str;
MSVCRT_wchar_t* end = str + strlenW(str) - 1; MSVCRT_wchar_t* end = str + MSVCRT_wcslen(str) - 1;
while (end > str) while (end > str)
{ {
MSVCRT_wchar_t t = *end; MSVCRT_wchar_t t = *end;
@ -552,7 +551,7 @@ static MSVCRT_size_t MSVCRT_wcsrtombs_l(char *mbstr, const MSVCRT_wchar_t **wcst
MSVCRT_size_t i; MSVCRT_size_t i;
if(!mbstr) if(!mbstr)
return strlenW(*wcstr); return MSVCRT_wcslen(*wcstr);
for(i=0; i<count; i++) { for(i=0; i<count; i++) {
if((*wcstr)[i] > 255) { if((*wcstr)[i] > 255) {
@ -1755,10 +1754,10 @@ MSVCRT_wchar_t * CDECL MSVCRT_wcstok_s( MSVCRT_wchar_t *str, const MSVCRT_wchar_
if (!str) str = *next_token; if (!str) str = *next_token;
while (*str && strchrW( delim, *str )) str++; while (*str && MSVCRT_wcschr( delim, *str )) str++;
if (!*str) return NULL; if (!*str) return NULL;
ret = str++; ret = str++;
while (*str && !strchrW( delim, *str )) str++; while (*str && !MSVCRT_wcschr( delim, *str )) str++;
if (*str) *str++ = 0; if (*str) *str++ = 0;
*next_token = str; *next_token = str;
return ret; return ret;
@ -2149,7 +2148,7 @@ INT CDECL MSVCRT_wcscpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, con
return MSVCRT_EINVAL; return MSVCRT_EINVAL;
} }
size = strlenW(wcSrc) + 1; size = MSVCRT_wcslen(wcSrc) + 1;
if(!MSVCRT_CHECK_PMT_ERR(size <= numElement, MSVCRT_ERANGE)) if(!MSVCRT_CHECK_PMT_ERR(size <= numElement, MSVCRT_ERANGE))
{ {
@ -2295,7 +2294,7 @@ INT CDECL MSVCRT_wcsncat_s(MSVCRT_wchar_t *dst, MSVCRT_size_t elem,
if (count == MSVCRT__TRUNCATE) if (count == MSVCRT__TRUNCATE)
{ {
srclen = strlenW(src); srclen = MSVCRT_wcslen(src);
if (srclen >= (elem - dststart)) if (srclen >= (elem - dststart))
{ {
srclen = elem - dststart - 1; srclen = elem - dststart - 1;
@ -2303,7 +2302,7 @@ INT CDECL MSVCRT_wcsncat_s(MSVCRT_wchar_t *dst, MSVCRT_size_t elem,
} }
} }
else else
srclen = min(strlenW(src), count); srclen = min(MSVCRT_wcslen(src), count);
if (srclen < (elem - dststart)) if (srclen < (elem - dststart))
{ {
memcpy(&dst[dststart], src, srclen*sizeof(MSVCRT_wchar_t)); memcpy(&dst[dststart], src, srclen*sizeof(MSVCRT_wchar_t));
@ -2766,7 +2765,7 @@ MSVCRT_size_t CDECL MSVCRT__wcsxfrm_l(MSVCRT_wchar_t *dest, const MSVCRT_wchar_t
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) { if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) {
MSVCRT_wcsncpy(dest, src, len); MSVCRT_wcsncpy(dest, src, len);
return strlenW(src); return MSVCRT_wcslen(src);
} }
ret = LCMapStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], ret = LCMapStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE],