Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libc/locale/cXXrtomb_iconv.h
Show All 33 Lines | |||||
#include <assert.h> | #include <assert.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <langinfo.h> | #include <langinfo.h> | ||||
#include <uchar.h> | #include <uchar.h> | ||||
#include "../iconv/citrus_hash.h" | #include "../iconv/citrus_hash.h" | ||||
#include "../iconv/citrus_module.h" | #include "../iconv/citrus_module.h" | ||||
#include "../iconv/citrus_iconv.h" | #include "../iconv/citrus_iconv.h" | ||||
#include "xlocale_private.h" | #include "mblocal.h" | ||||
typedef struct { | typedef struct { | ||||
bool initialized; | bool initialized; | ||||
struct _citrus_iconv iconv; | struct _citrus_iconv iconv; | ||||
union { | union { | ||||
charXX_t widechar[SRCBUF_LEN]; | charXX_t widechar[SRCBUF_LEN]; | ||||
char bytes[sizeof(charXX_t) * SRCBUF_LEN]; | char bytes[sizeof(charXX_t) * SRCBUF_LEN]; | ||||
} srcbuf; | } srcbuf; | ||||
Show All 9 Lines | cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps, | ||||
_ConversionState *cs; | _ConversionState *cs; | ||||
struct _citrus_iconv *handle; | struct _citrus_iconv *handle; | ||||
char *src, *dst; | char *src, *dst; | ||||
size_t srcleft, dstleft, invlen; | size_t srcleft, dstleft, invlen; | ||||
int err; | int err; | ||||
FIX_LOCALE(locale); | FIX_LOCALE(locale); | ||||
if (ps == NULL) | if (ps == NULL) | ||||
ps = &locale->cXXrtomb; | ps = &(XLOCALE_CTYPE(locale)->cXXrtomb); | ||||
cs = (_ConversionState *)ps; | cs = (_ConversionState *)ps; | ||||
handle = &cs->iconv; | handle = &cs->iconv; | ||||
/* Reinitialize mbstate_t. */ | /* Reinitialize mbstate_t. */ | ||||
if (s == NULL || !cs->initialized) { | if (s == NULL || !cs->initialized) { | ||||
if (_citrus_iconv_open(&handle, UTF_XX_INTERNAL, | if (_citrus_iconv_open(&handle, UTF_XX_INTERNAL, | ||||
nl_langinfo_l(CODESET, locale)) != 0) { | nl_langinfo_l(CODESET, locale)) != 0) { | ||||
cs->initialized = false; | cs->initialized = false; | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |