msvcrt: Added space for nullbyte in size returned by wcstombs_s and mbstowcs_s.
This commit is contained in:
parent
f54b168855
commit
fdffe548f1
|
@ -1900,7 +1900,7 @@ int CDECL MSVCRT__mbstowcs_s_l(MSVCRT_size_t *ret, MSVCRT_wchar_t *wcstr,
|
||||||
if(!wcstr && !size) {
|
if(!wcstr && !size) {
|
||||||
conv = MSVCRT__mbstowcs_l(NULL, mbstr, 0, locale);
|
conv = MSVCRT__mbstowcs_l(NULL, mbstr, 0, locale);
|
||||||
if(ret)
|
if(ret)
|
||||||
*ret = conv;
|
*ret = conv+1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1337,6 +1337,10 @@ static void test_mbstowcs(void)
|
||||||
ok(ret == 3, "ret = %d\n", (int)ret);
|
ok(ret == 3, "ret = %d\n", (int)ret);
|
||||||
ok(!memcmp(wOut, wHiragana, sizeof(wHiragana)), "wOut = %s\n", wine_dbgstr_w(wOut));
|
ok(!memcmp(wOut, wHiragana, sizeof(wHiragana)), "wOut = %s\n", wine_dbgstr_w(wOut));
|
||||||
|
|
||||||
|
err = pmbstowcs_s(&ret, NULL, 0, mHiragana, 1);
|
||||||
|
ok(err == 0, "err = %d\n", err);
|
||||||
|
ok(ret == 3, "ret = %d\n", (int)ret);
|
||||||
|
|
||||||
err = pwcstombs_s(&ret, mOut, 6, wSimple, _TRUNCATE);
|
err = pwcstombs_s(&ret, mOut, 6, wSimple, _TRUNCATE);
|
||||||
ok(err == 0, "err = %d\n", err);
|
ok(err == 0, "err = %d\n", err);
|
||||||
ok(ret == 5, "ret = %d\n", (int)ret);
|
ok(ret == 5, "ret = %d\n", (int)ret);
|
||||||
|
@ -1346,6 +1350,10 @@ static void test_mbstowcs(void)
|
||||||
ok(err == 0, "err = %d\n", err);
|
ok(err == 0, "err = %d\n", err);
|
||||||
ok(ret == 5, "ret = %d\n", (int)ret);
|
ok(ret == 5, "ret = %d\n", (int)ret);
|
||||||
ok(!memcmp(mOut, mHiragana, sizeof(mHiragana)), "mOut = %s\n", mOut);
|
ok(!memcmp(mOut, mHiragana, sizeof(mHiragana)), "mOut = %s\n", mOut);
|
||||||
|
|
||||||
|
err = pwcstombs_s(&ret, NULL, 0, wHiragana, 1);
|
||||||
|
ok(err == 0, "err = %d\n", err);
|
||||||
|
ok(ret == 5, "ret = %d\n", (int)ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_gcvt(void)
|
static void test_gcvt(void)
|
||||||
|
|
|
@ -341,7 +341,7 @@ MSVCRT_size_t CDECL MSVCRT__wcstombs_s_l(MSVCRT_size_t *ret, char *mbstr,
|
||||||
if(!mbstr && !size) {
|
if(!mbstr && !size) {
|
||||||
conv = MSVCRT__wcstombs_l(NULL, wcstr, 0, locale);
|
conv = MSVCRT__wcstombs_l(NULL, wcstr, 0, locale);
|
||||||
if(ret)
|
if(ret)
|
||||||
*ret = conv;
|
*ret = conv+1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue