safec
3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
|
#include "safe_str_lib.h"
Functions | |
EXPORT errno_t | mbsrtowcs_s (size_t *restrict retval, wchar_t *restrict dest, rsize_t dmax, const char **restrict src, rsize_t len, mbstate_t *restrict ps) |
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer. More... | |
EXPORT errno_t mbsrtowcs_s | ( | size_t *restrict | retval, |
wchar_t *restrict | dest, | ||
rsize_t | dmax, | ||
const char **restrict | src, | ||
rsize_t | len, | ||
mbstate_t *restrict | ps | ||
) |
Does not permit the ps
parameter (the pointer to the conversion state) to be a null pointer.
The restartable mbsrtowcs_s
function converts a null-terminated multibyte character sequence from the current LC_CTYPE locale to wchar, which begins in the conversion state described by *ps
, from the array whose first element is pointed to by *src
to its wide character representation. If dest is not null, converted characters are stored in the successive elements of the wchar_t
array pointed to by dest
. No more than len
wide characters are written to the destination array. Each multibyte character is converted as if by a call to mbrtowc
. mbsrtowcs_s
clobbers the destination array from the terminating null and until dmax
. In extension to mbstowc_s
you can re-use the state via ps
. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with 0.
The conversion stops if:
*src
is set to NULL
and *ps
represents the initial shift state.*src
is set to point at the beginning of the first unconverted multibyte character.len
. *src
is set to point at the beginning of the first unconverted multibyte character. This condition is not checked if dest==NULL
.[out] | retval | pointer to a size_t object where the result will be stored |
[out] | dest | pointer to wide character array where the results will be stored |
[in] | dmax | restricted maximum length of dest |
[in] | src | pointer to the string that will be copied to dest |
[in] | len | maximal number of wide characters to be copied to dest |
[in] | ps | pointer to the conversion state object |
RSIZE_MAX_WSTR
(unless dest is null). wcsnlen_s(src, dmax)
. mbsrtowcs_s
nulls dest. EOK | on successful conversion. |
ESNULLP | when retval, ps, src or *src are a NULL pointer |
ESZEROL | when dmax = 0, unless dest is NULL |
ESLEMAX | when dmax > RSIZE_MAX_WSTR, unless dest is NULL |
ESOVRLP | when src and dest overlap |
ESNOSPC | when there is no null character in the first dmax multibyte characters in the *src array and len is greater than dmax (unless dest is null) |