Re: kernel32: WideCharToMultiByte: return error on negative dest len
"Dan Kegel" <dank(a)kegel.com> writes:
+static void test_negative_dest_length(void) +{ + int len; + char buf[10]; + + /* Test return on negative dest length */ + SetLastError( 0xdeadbeef ); + memset(buf,'x',sizeof(buf)); + len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buf, -1, NULL, NULL); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, + "WideCharToMultiByte(destlen -1): len=%d error=%x\n", len, GetLastError());
If you want to determine the behavior for negative values you have to test more than just -1, it may well be special. -- Alexandre Julliard julliard(a)winehq.org
Hello Dan and AJ, 2008/3/24, Alexandre Julliard <julliard(a)winehq.org>:
"Dan Kegel" <dank(a)kegel.com> writes:
+static void test_negative_dest_length(void) +{ + int len; + char buf[10]; + + /* Test return on negative dest length */ + SetLastError( 0xdeadbeef ); + memset(buf,'x',sizeof(buf)); + len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buf, -1, NULL, NULL); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, + "WideCharToMultiByte(destlen -1): len=%d error=%x\n", len, GetLastError());
If you want to determine the behavior for negative values you have to test more than just -1, it may well be special. The test is valid at least on xp, however it could be that wine internally relies on the broken behavior, so I'm not 100% sure whether it can be committed without checking for that first?
Cheers, Maarten
On Mon, Mar 24, 2008 at 10:54 AM, Maarten Lankhorst <m.b.lankhorst(a)gmail.com> wrote:
Hello Dan and AJ,
2008/3/24, Alexandre Julliard <julliard(a)winehq.org>:
"Dan Kegel" <dank(a)kegel.com> writes:
+static void test_negative_dest_length(void) +{ + int len; + char buf[10]; + + /* Test return on negative dest length */ + SetLastError( 0xdeadbeef ); + memset(buf,'x',sizeof(buf)); + len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buf, -1, NULL, NULL); + ok(len == 0 && GetLastError() == ERROR_INVALID_PARAMETER, + "WideCharToMultiByte(destlen -1): len=%d error=%x\n", len, GetLastError());
If you want to determine the behavior for negative values you have to test more than just -1, it may well be special. The test is valid at least on xp, however it could be that wine internally relies on the broken behavior, so I'm not 100% sure whether it can be committed without checking for that first?
It's invalid because -1 may be a special case, as Alexandre stated. That is, there may be a difference between length -1 and length -x, where x is a positive integer > 1. -- James Hawkins
participants (3)
-
Alexandre Julliard -
James Hawkins -
Maarten Lankhorst