Lines Matching refs:st

61 	_iconv_st *st;  in _icv_open()  local
63 if ((st = (_iconv_st *)malloc(sizeof(_iconv_st))) == NULL) { in _icv_open()
68 st->ustate = U0; in _icv_open()
69 st->_errno = 0; in _icv_open()
70 st->little_endian = false; in _icv_open()
71 st->bom_written = false; in _icv_open()
73 st->little_endian = true; in _icv_open()
74 st->bom_written = true; in _icv_open()
76 return ((void *) st); in _icv_open()
84 _icv_close(_iconv_st *st) in _icv_close() argument
86 if (!st) in _icv_close()
89 free(st); in _icv_close()
118 _icv_iconv(_iconv_st *st, char **inbuf, size_t *inbytesleft, in _icv_iconv() argument
130 if (st == NULL) { in _icv_iconv()
136 st->ustate = U0; in _icv_iconv()
137 st->_errno = 0; in _icv_iconv()
141 st->_errno = 0; /* reset internal errno */ in _icv_iconv()
150 switch (st->ustate) { in _icv_iconv()
155 if (st->little_endian) { in _icv_iconv()
156 st->ustate = U1; in _icv_iconv()
157 st->keepc[0] = **inbuf; in _icv_iconv()
168 st->_errno = errno = EILSEQ; in _icv_iconv()
170 st->ustate = U1; in _icv_iconv()
171 st->keepc[0] = **inbuf; in _icv_iconv()
174 st->ustate = U2; in _icv_iconv()
175 st->keepc[0] = **inbuf; in _icv_iconv()
179 st->_errno = errno = EILSEQ; in _icv_iconv()
181 st->ustate = U5; in _icv_iconv()
182 st->keepc[0] = **inbuf; in _icv_iconv()
188 if ((**inbuf & 0xc0) == MSB || st->little_endian) { in _icv_iconv()
190 st->keepc[1] = **inbuf; in _icv_iconv()
195 if (st->little_endian) { in _icv_iconv()
199 if (st->keepc[1] == 0 && (st->keepc[0] & 0x80) == 0) { in _icv_iconv()
200 *(*outbuf)++ = st->keepc[0]; in _icv_iconv()
202 st->ustate = U0; in _icv_iconv()
206 ucs = ((st->keepc[1] & 0xff) << 8) | (st->keepc[0] & 0xff); in _icv_iconv()
209 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
211 st->ustate = U4; in _icv_iconv()
214 st->keepc[0]&ONEBYTE, st->keepc[1]&ONEBYTE); in _icv_iconv()
218 st->_errno = errno = EILSEQ; in _icv_iconv()
223 first_byte = st->keepc[0]; in _icv_iconv()
230 st->_errno = errno = EILSEQ; in _icv_iconv()
232 st->ustate = U3; in _icv_iconv()
233 st->keepc[1] = **inbuf; in _icv_iconv()
238 st->ustate = U4; in _icv_iconv()
240 st->keepc[2] = **inbuf; in _icv_iconv()
242 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
244 fprintf(stderr, "UTF8: %02x%02x%02x --> ", st->keepc[0]&ONEBYTE, in _icv_iconv()
245 st->keepc[1]&ONEBYTE, **inbuf&ONEBYTE); in _icv_iconv()
249 st->_errno = errno = EILSEQ; in _icv_iconv()
258 st->_errno = errno = EILSEQ; in _icv_iconv()
277 st->ustate = U0; in _icv_iconv()
279 st->_errno = errno = E2BIG; in _icv_iconv()
284 first_byte = st->keepc[0]; in _icv_iconv()
292 st->_errno = errno = EILSEQ; in _icv_iconv()
295 st->ustate = U6; in _icv_iconv()
296 st->keepc[1] = **inbuf; in _icv_iconv()
302 st->ustate = U7; in _icv_iconv()
303 st->keepc[2] = **inbuf; in _icv_iconv()
306 st->_errno = errno = EILSEQ; in _icv_iconv()
313 st->keepc[3] = **inbuf; in _icv_iconv()
315 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
317 st->ustate = U4; in _icv_iconv()
322 st->_errno = errno = E2BIG; in _icv_iconv()
331 st->ustate = U0; in _icv_iconv()
336 st->_errno = errno = EILSEQ; in _icv_iconv()
339 st->_errno = errno = EILSEQ; in _icv_iconv()
340 st->ustate = U0; /* reset state */ in _icv_iconv()
344 if (st->_errno) { in _icv_iconv()
347 st->_errno, st->ustate); in _icv_iconv()
357 if (*inbytesleft == 0 && st->ustate != U0) in _icv_iconv()
366 switch (st->ustate) in _icv_iconv()
397 st->ustate = U0; in _icv_iconv()