[3/6] try 2: msvcrt: implement _mbsnbcpy_s
Detlef Riekenberg
wine.dev at web.de
Thu Nov 15 17:53:58 CST 2007
On Do, 2007-11-15 at 17:37 +0100, Stefan Dösinger wrote:
> + const unsigned char small[] = "small";
> + int ret;
> + memset(dest, 'X', sizeof(dest));
> + ret = p_mbsnbcpy_s(dest, sizeof(dest), small, sizeof(small));
> + ok(ret == 0, "_mbsnbcpy_s: Copying a string into a big enough
> destination returned %d, expected 0\n", ret);
> + ok(dest[0] == 's' && dest[1] == 'm' && dest[2] == 'a' && dest[3]
> == 'l' &&
> + dest[4] == 'l' && dest[5] == '\0'&& dest[6] == 'X' && dest[7]
> == 'X
you can use memcmp, when small is defined different:
+ const unsigned char small[] = "small\0XX";
I also suggest to make the buffer larger as
you tell the api and always terminate the buffer
unsigned char dest[10];
dest[sizeof(dest)-1] = '\0';
--
By by ... Detlef
More information about the wine-devel
mailing list