Commit 3773035a authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

The Win9x platforms support WideCharToMultiByte and

MultiByteToWideChar but not lstrcmpW! So I implemented our own so that we can have a meaningful test.
parent 872f9450
...@@ -22,6 +22,16 @@ ...@@ -22,6 +22,16 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
/* lstrcmpW is not supported on Win9x! */
static int mylstrcmpW(const WCHAR* str1, const WCHAR* str2)
{
while (*str1 && *str1==*str2) {
str1++;
str2++;
}
return *str1-*str2;
}
static void test_negative_source_length(void) static void test_negative_source_length(void)
{ {
int len; int len;
...@@ -31,14 +41,16 @@ static void test_negative_source_length(void) ...@@ -31,14 +41,16 @@ static void test_negative_source_length(void)
/* Test, whether any negative source length works as strlen() + 1 */ /* Test, whether any negative source length works as strlen() + 1 */
SetLastError( 0xdeadbeef ); SetLastError( 0xdeadbeef );
memset(buf,'x',sizeof(buf));
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL); len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL);
ok(len == 7 && !lstrcmpA(buf, "foobar") && GetLastError() == 0xdeadbeef, ok(len == 7 && !lstrcmpA(buf, "foobar") && GetLastError() == 0xdeadbeef,
"any negative value should work as strlen() + 1"); "WideCharToMultiByte(-2002): len=%d error=%ld",len,GetLastError());
SetLastError( 0xdeadbeef ); SetLastError( 0xdeadbeef );
memset(bufW,'x',sizeof(bufW));
len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10); len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10);
ok(len == 7 && !lstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef, ok(len == 7 && !mylstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef,
"any negative value should work as strlen() + 1"); "MultiByteToWideChar(-2002): len=%d error=%ld",len,GetLastError());
} }
START_TEST(codepage) START_TEST(codepage)
......
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