Add a test for handling overlapped buffers by WideCharToMultiByte
Dmitry Timoshkov
dmitry at baikal.ru
Fri Jul 15 09:13:44 CDT 2005
Hello,
here is a test case for an old problem I found some time ago.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Add a test for handling overlapped buffers by WideCharToMultiByte.
--- cvs/hq/wine/dlls/kernel/tests/codepage.c Fri Jan 23 01:10:34 2004
+++ wine/dlls/kernel/tests/codepage.c Fri Jul 15 14:05:02 2005
@@ -56,7 +56,21 @@ static void test_negative_source_length(
"MultiByteToWideChar(-2002): len=%d error=%ld\n",len,GetLastError());
}
+static void test_overlapped_buffers(void)
+{
+ static const WCHAR strW[] = {'j','u','s','t',' ','a',' ','t','e','s','t',0};
+ static const char strA[] = "just a test";
+ char buf[256];
+ int ret;
+
+ lstrcpyW((WCHAR *)(buf + 1), strW);
+ ret = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)(buf + 1), -1, buf, sizeof(buf), NULL, NULL);
+ ok(ret == sizeof(strA), "unexpected ret %d != %d\n", ret, sizeof(strA));
+ ok(!memcmp(buf, strA, sizeof(strA)), "conversion failed: %s\n", buf);
+}
+
START_TEST(codepage)
{
test_negative_source_length();
+ test_overlapped_buffers();
}
More information about the wine-patches
mailing list