Lines Matching refs:st

65 	_iconv_st *st;  in _icv_open()  local
67 if ((st = (_iconv_st *)malloc(sizeof(_iconv_st))) == NULL) { in _icv_open()
72 st->ustate = U0; in _icv_open()
73 st->_errno = 0; in _icv_open()
74 st->little_endian = false; in _icv_open()
75 st->bom_written = false; in _icv_open()
77 st->little_endian = true; in _icv_open()
78 st->bom_written = true; in _icv_open()
80 return ((void *) st); in _icv_open()
88 _icv_close(_iconv_st *st) in _icv_close() argument
90 if (!st) in _icv_close()
93 free(st); in _icv_close()
122 _icv_iconv(_iconv_st *st, char **inbuf, size_t *inbytesleft, in _icv_iconv() argument
134 if (st == NULL) { in _icv_iconv()
140 st->ustate = U0; in _icv_iconv()
141 st->_errno = 0; in _icv_iconv()
145 st->_errno = 0; /* reset internal errno */ in _icv_iconv()
154 switch (st->ustate) { in _icv_iconv()
159 if (st->little_endian) { in _icv_iconv()
160 st->ustate = U1; in _icv_iconv()
161 st->keepc[0] = **inbuf; in _icv_iconv()
172 st->_errno = errno = EILSEQ; in _icv_iconv()
174 st->ustate = U1; in _icv_iconv()
175 st->keepc[0] = **inbuf; in _icv_iconv()
178 st->ustate = U2; in _icv_iconv()
179 st->keepc[0] = **inbuf; in _icv_iconv()
183 st->_errno = errno = EILSEQ; in _icv_iconv()
185 st->ustate = U5; in _icv_iconv()
186 st->keepc[0] = **inbuf; in _icv_iconv()
192 if ((**inbuf & 0xc0) == 0x80 || st->little_endian) { in _icv_iconv()
194 st->keepc[1] = **inbuf; in _icv_iconv()
199 if (st->little_endian) { in _icv_iconv()
203 if (st->keepc[1] == 0 && (st->keepc[0] & 0x80) == 0) { in _icv_iconv()
204 *(*outbuf)++ = st->keepc[0]; in _icv_iconv()
206 st->ustate = U0; in _icv_iconv()
210 ucs = ((st->keepc[1] & 0xff)<< 8) | (st->keepc[0] & 0xff); in _icv_iconv()
213 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
215 st->ustate = U4; in _icv_iconv()
218 st->keepc[0]&ONEBYTE, st->keepc[1]&ONEBYTE); in _icv_iconv()
222 st->_errno = errno = EILSEQ; in _icv_iconv()
227 first_byte = st->keepc[0]; in _icv_iconv()
234 st->_errno = errno = EILSEQ; in _icv_iconv()
236 st->ustate = U3; in _icv_iconv()
237 st->keepc[1] = **inbuf; in _icv_iconv()
242 st->ustate = U4; in _icv_iconv()
244 st->keepc[2] = **inbuf; in _icv_iconv()
246 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
248 fprintf(stderr, "UTF8: %02x%02x%02x --> ", st->keepc[0]&ONEBYTE, in _icv_iconv()
249 st->keepc[1]&ONEBYTE, **inbuf&ONEBYTE); in _icv_iconv()
253 st->_errno = errno = EILSEQ; in _icv_iconv()
260 st->_errno = errno = EILSEQ; in _icv_iconv()
281 st->ustate = U0; in _icv_iconv()
283 st->_errno = errno = E2BIG; in _icv_iconv()
288 first_byte = st->keepc[0]; in _icv_iconv()
296 st->_errno = errno = EILSEQ; in _icv_iconv()
298 st->ustate = U6; in _icv_iconv()
299 st->keepc[1] = **inbuf; in _icv_iconv()
305 st->ustate = U7; in _icv_iconv()
306 st->keepc[2] = **inbuf; in _icv_iconv()
309 st->_errno = errno = EILSEQ; in _icv_iconv()
314 st->keepc[3] = **inbuf; in _icv_iconv()
317 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
318 st->ustate = U4; in _icv_iconv()
323 st->_errno = errno = EILSEQ; in _icv_iconv()
326 st->_errno = errno = EILSEQ; in _icv_iconv()
327 st->ustate = U0; /* reset state */ in _icv_iconv()
331 if (st->_errno) { in _icv_iconv()
334 st->_errno, st->ustate); in _icv_iconv()
343 if (*inbytesleft == 0 && st->ustate != U0) in _icv_iconv()
353 switch (st->ustate) { in _icv_iconv()
383 st->ustate = U0; in _icv_iconv()