19 Oct
2022
19 Oct
'22
2:02 p.m.
On Wed Oct 19 13:58:40 2022 +0000, Bartosz Kosiorek wrote:
These methods should throw an EINVAL in case:
If numberOfElements is less than the length of the string, the functions also return EINVAL and set errno to EINVAL. More information is available at: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strlwr-s-s... In this change I would like to implement that behaviour (I checked it under Windows/native DLLs) and it is implemented in that way.. There already is a test that cover this case:
memcpy(buffer, "abcdefgh", sizeof("abcdefgh"));
errno = EBADF;
ret = p_mbsupr_s(buffer, sizeof("abcdefgh") - 1);
ok(ret == EINVAL, "Expected _mbsupr_s to return EINVAL, got %d\n", ret);
ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
or am I missing something? The function uses MSVCRT_CHECK_PMT macro to handle the error (it will return EINVAL in msvcrt and throw exception in newer versions). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1090#note_11344