msvcrt: Add _wcsset_s implementation.
This commit is contained in:
parent
8bfbe61386
commit
3af24fe1f4
|
@ -1509,7 +1509,7 @@
|
||||||
@ stub _wcsnset_s
|
@ stub _wcsnset_s
|
||||||
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
||||||
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
||||||
@ stub _wcsset_s
|
@ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
||||||
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
||||||
|
|
|
@ -1868,7 +1868,7 @@
|
||||||
@ stub _wcsnset_s
|
@ stub _wcsnset_s
|
||||||
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
||||||
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
||||||
@ stub _wcsset_s
|
@ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
||||||
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
||||||
|
|
|
@ -1883,7 +1883,7 @@
|
||||||
@ stub _wcsnset_s
|
@ stub _wcsnset_s
|
||||||
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
||||||
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
||||||
@ stub _wcsset_s
|
@ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||||
@ stub _wcstof_l
|
@ stub _wcstof_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
||||||
|
|
|
@ -1579,7 +1579,7 @@
|
||||||
@ stub _wcsnset_s
|
@ stub _wcsnset_s
|
||||||
@ cdecl _wcsrev(wstr) msvcr120._wcsrev
|
@ cdecl _wcsrev(wstr) msvcr120._wcsrev
|
||||||
@ cdecl _wcsset(wstr long) msvcr120._wcsset
|
@ cdecl _wcsset(wstr long) msvcr120._wcsset
|
||||||
@ stub _wcsset_s
|
@ cdecl _wcsset_s(wstr long long) msvcr120._wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) msvcr120._wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) msvcr120._wcstod_l
|
||||||
@ stub _wcstof_l
|
@ stub _wcstof_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) msvcr120._wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) msvcr120._wcstoi64
|
||||||
|
|
|
@ -1189,7 +1189,7 @@
|
||||||
@ stub _wcsnset_s
|
@ stub _wcsnset_s
|
||||||
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
||||||
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
||||||
@ stub _wcsset_s
|
@ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
||||||
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
||||||
|
|
|
@ -1164,7 +1164,7 @@
|
||||||
@ stub _wcsnset_s
|
@ stub _wcsnset_s
|
||||||
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
||||||
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
||||||
@ stub _wcsset_s
|
@ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
||||||
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
||||||
|
|
|
@ -1120,7 +1120,7 @@
|
||||||
# stub _wcsnset_s(wstr long long)
|
# stub _wcsnset_s(wstr long long)
|
||||||
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
|
||||||
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
|
||||||
# stub _wcsset_s(wstr long)
|
@ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s
|
||||||
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
|
||||||
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
@ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
|
||||||
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
@ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
|
||||||
|
|
|
@ -90,6 +90,7 @@ static size_t (__cdecl *p_mbrlen)(const char*, size_t, mbstate_t*);
|
||||||
static size_t (__cdecl *p_mbrtowc)(wchar_t*, const char*, size_t, mbstate_t*);
|
static size_t (__cdecl *p_mbrtowc)(wchar_t*, const char*, size_t, mbstate_t*);
|
||||||
static int (__cdecl *p__atodbl_l)(_CRT_DOUBLE*,char*,_locale_t);
|
static int (__cdecl *p__atodbl_l)(_CRT_DOUBLE*,char*,_locale_t);
|
||||||
static int (__cdecl *p__strnset_s)(char*,size_t,int,size_t);
|
static int (__cdecl *p__strnset_s)(char*,size_t,int,size_t);
|
||||||
|
static int (__cdecl *p__wcsset_s)(wchar_t*,size_t,wchar_t);
|
||||||
|
|
||||||
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
|
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
|
||||||
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
|
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
|
||||||
|
@ -2749,6 +2750,40 @@ static void test__strnset_s(void)
|
||||||
ok(!buf[0] && buf[1]=='c' && buf[2]=='b', "buf = %s\n", buf);
|
ok(!buf[0] && buf[1]=='c' && buf[2]=='b', "buf = %s\n", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test__wcsset_s(void)
|
||||||
|
{
|
||||||
|
wchar_t str[10];
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if(!p__wcsset_s) {
|
||||||
|
win_skip("_wcsset_s not available\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = p__wcsset_s(NULL, 0, 'a');
|
||||||
|
ok(r == EINVAL, "r = %d\n", r);
|
||||||
|
|
||||||
|
str[0] = 'a';
|
||||||
|
r = p__wcsset_s(str, 0, 'a');
|
||||||
|
ok(r == EINVAL, "r = %d\n", r);
|
||||||
|
ok(str[0] == 'a', "str[0] = %d\n", str[0]);
|
||||||
|
|
||||||
|
str[0] = 'a';
|
||||||
|
str[1] = 'b';
|
||||||
|
r = p__wcsset_s(str, 2, 'c');
|
||||||
|
ok(r == EINVAL, "r = %d\n", r);
|
||||||
|
ok(!str[0], "str[0] = %d\n", str[0]);
|
||||||
|
ok(str[1] == 'b', "str[1] = %d\n", str[1]);
|
||||||
|
|
||||||
|
str[0] = 'a';
|
||||||
|
str[1] = 0;
|
||||||
|
str[2] = 'b';
|
||||||
|
r = p__wcsset_s(str, 3, 'c');
|
||||||
|
ok(str[0] == 'c', "str[0] = %d\n", str[0]);
|
||||||
|
ok(str[1] == 0, "str[1] = %d\n", str[1]);
|
||||||
|
ok(str[2] == 'b', "str[2] = %d\n", str[2]);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(string)
|
START_TEST(string)
|
||||||
{
|
{
|
||||||
char mem[100];
|
char mem[100];
|
||||||
|
@ -2797,6 +2832,7 @@ START_TEST(string)
|
||||||
p_mbsrtowcs = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs");
|
p_mbsrtowcs = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs");
|
||||||
p__atodbl_l = (void*)GetProcAddress(hMsvcrt, "_atodbl_l");
|
p__atodbl_l = (void*)GetProcAddress(hMsvcrt, "_atodbl_l");
|
||||||
p__strnset_s = (void*)GetProcAddress(hMsvcrt, "_strnset_s");
|
p__strnset_s = (void*)GetProcAddress(hMsvcrt, "_strnset_s");
|
||||||
|
p__wcsset_s = (void*)GetProcAddress(hMsvcrt, "_wcsset_s");
|
||||||
|
|
||||||
/* MSVCRT memcpy behaves like memmove for overlapping moves,
|
/* MSVCRT memcpy behaves like memmove for overlapping moves,
|
||||||
MFC42 CString::Insert seems to rely on that behaviour */
|
MFC42 CString::Insert seems to rely on that behaviour */
|
||||||
|
@ -2851,4 +2887,5 @@ START_TEST(string)
|
||||||
test_strncpy();
|
test_strncpy();
|
||||||
test_strxfrm();
|
test_strxfrm();
|
||||||
test__strnset_s();
|
test__strnset_s();
|
||||||
|
test__wcsset_s();
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,26 @@ MSVCRT_wchar_t* CDECL MSVCRT__wcsrev( MSVCRT_wchar_t* str )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* _wcsset_s (MSVCRT.@)
|
||||||
|
*/
|
||||||
|
int CDECL MSVCRT__wcsset_s( MSVCRT_wchar_t *str, MSVCRT_size_t n, MSVCRT_wchar_t c )
|
||||||
|
{
|
||||||
|
MSVCRT_wchar_t *p = str;
|
||||||
|
|
||||||
|
if(!MSVCRT_CHECK_PMT(str != NULL)) return MSVCRT_EINVAL;
|
||||||
|
if(!MSVCRT_CHECK_PMT(n)) return MSVCRT_EINVAL;
|
||||||
|
|
||||||
|
while(*p && --n) *p++ = c;
|
||||||
|
if(!n) {
|
||||||
|
str[0] = 0;
|
||||||
|
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
|
||||||
|
*MSVCRT__errno() = MSVCRT_EINVAL;
|
||||||
|
return MSVCRT_EINVAL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* _wcsset (MSVCRT.@)
|
* _wcsset (MSVCRT.@)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue