1 #include "mb_wc_common.h"
6 #define WIN32_LEAN_AND_MEAN
10 static int __MINGW_ATTRIB_NONNULL(1)
11 __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp,
12 const unsigned int mb_max)
28 int size = WideCharToMultiByte (cp, 0 /* Is this correct flag? */,
31 if (size == 0 || invalid_char)
41 wcrtomb (char *dst, wchar_t wc, mbstate_t * __UNUSED_PARAM (ps))
43 char byte_bucket [MB_LEN_MAX];
44 char* tmp_dst = dst ? dst : byte_bucket;
45 return (size_t)__wcrtomb_cp (tmp_dst, wc, get_codepage (),
49 size_t wcsrtombs (char *dst, const wchar_t **src, size_t len,
50 mbstate_t * __UNUSED_PARAM (ps))
54 const unsigned int cp = get_codepage();
55 const unsigned int mb_max = MB_CUR_MAX;
56 const wchar_t *pwc = *src;
58 if (src == NULL || *src == NULL) /* undefined behavior */
65 if ((ret = __wcrtomb_cp (dst, *pwc, cp, mb_max)) <= 0)
69 if (*(dst - 1) == '\0')
71 *src = (wchar_t*) NULL;;
80 char byte_bucket [MB_LEN_MAX];
83 if ((ret = __wcrtomb_cp (byte_bucket, *pwc, cp, mb_max))
87 if (byte_bucket [ret - 1] == '\0')