Lines Matching refs:st

60 	_iconv_st *st;  in _icv_open()  local
62 if ((st = (_iconv_st *)malloc(sizeof(_iconv_st))) == NULL) { in _icv_open()
67 st->ustate = U0; in _icv_open()
68 st->_errno = 0; in _icv_open()
69 st->little_endian = false; in _icv_open()
70 st->bom_written = false; in _icv_open()
72 st->little_endian = true; in _icv_open()
73 st->bom_written = true; in _icv_open()
75 return ((void *) st); in _icv_open()
83 _icv_close(_iconv_st *st) in _icv_close() argument
85 if (!st) in _icv_close()
88 free(st); in _icv_close()
117 _icv_iconv(_iconv_st *st, char **inbuf, size_t *inbytesleft, in _icv_iconv() argument
129 if (st == NULL) { in _icv_iconv()
135 st->ustate = U0; in _icv_iconv()
136 st->_errno = 0; in _icv_iconv()
140 st->_errno = 0; /* reset internal errno */ in _icv_iconv()
149 switch (st->ustate) { in _icv_iconv()
154 if (st->little_endian) { in _icv_iconv()
155 st->ustate = U1; in _icv_iconv()
156 st->keepc[0] = **inbuf; in _icv_iconv()
167 st->_errno = errno = EILSEQ; in _icv_iconv()
169 st->ustate = U1; in _icv_iconv()
170 st->keepc[0] = **inbuf; in _icv_iconv()
173 st->ustate = U2; in _icv_iconv()
174 st->keepc[0] = **inbuf; in _icv_iconv()
178 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()
189 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()
239 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()
255 st->_errno = errno = EILSEQ; in _icv_iconv()
274 st->ustate = U0; in _icv_iconv()
276 st->_errno = errno; in _icv_iconv()
281 first_byte = st->keepc[0]; in _icv_iconv()
289 st->_errno = errno = EILSEQ; in _icv_iconv()
292 st->ustate = U6; in _icv_iconv()
293 st->keepc[1] = **inbuf; in _icv_iconv()
299 st->ustate = U7; in _icv_iconv()
300 st->keepc[2] = **inbuf; in _icv_iconv()
303 st->_errno = errno = EILSEQ; in _icv_iconv()
309 st->keepc[3] = **inbuf; in _icv_iconv()
311 convert_utf8_to_ucs4((uchar_t*)(&st->keepc[0]), utf8_len, &ucs); in _icv_iconv()
313 st->ustate = U4; in _icv_iconv()
317 st->_errno = errno = EILSEQ; in _icv_iconv()
320 st->_errno = errno = EILSEQ; in _icv_iconv()
321 st->ustate = U0; /* reset state */ in _icv_iconv()
325 if (st->_errno) { in _icv_iconv()
328 st->_errno, st->ustate); in _icv_iconv()
339 if (*inbytesleft == 0 && st->ustate != U0) in _icv_iconv()
348 switch (st->ustate) in _icv_iconv()
379 st->ustate = U0; in _icv_iconv()