touched up code related to QSE_SIO_IGNOREMBWCERR.

set QSE_SIO_IGNOREMBWCERR to qse_sio_in, qse_sio_out, qse_sio_err by default
This commit is contained in:
2011-09-12 06:44:56 +00:00
parent e2affec43b
commit e2a65338c8
6 changed files with 27 additions and 71 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: sio.c 565 2011-09-11 02:48:21Z hyunghwan.chung $
* $Id: sio.c 566 2011-09-11 12:44:56Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -56,7 +56,7 @@ static qse_sio_t __sio_in =
{
QSE_NULL,
0,
0,
QSE_TIO_IGNOREMBWCERR,
__sio_input,
__sio_output,
@ -98,7 +98,7 @@ static qse_sio_t __sio_out =
{
QSE_NULL,
0,
0,
QSE_TIO_IGNOREMBWCERR,
__sio_input,
__sio_output,
@ -140,7 +140,7 @@ static qse_sio_t __sio_err =
{
QSE_NULL,
0,
0,
QSE_TIO_IGNOREMBWCERR,
__sio_input,
__sio_output,

View File

@ -1,5 +1,5 @@
/*
* $Id: tio-get.c 565 2011-09-11 02:48:21Z hyunghwan.chung $
* $Id: tio-get.c 566 2011-09-11 12:44:56Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -55,7 +55,8 @@ static qse_ssize_t tio_getc (qse_tio_t* tio, qse_char_t* c)
&tio->inbuf[left], QSE_COUNTOF(tio->inbuf)-left);
if (n == 0)
{
if (tio->inbuf_curp < tio->inbuf_len)
if (tio->inbuf_curp < tio->inbuf_len &&
!(tio->flags & QSE_TIO_IGNOREMBWCERR))
{
/* gargage left in the buffer */
tio->errnum = QSE_TIO_EICSEQ;
@ -86,7 +87,9 @@ static qse_ssize_t tio_getc (qse_tio_t* tio, qse_char_t* c)
/* illegal sequence */
if (tio->flags & QSE_TIO_IGNOREMBWCERR)
{
*c = tio->inbuf[tio->inbuf_curp++];
/* *c = tio->inbuf[tio->inbuf_curp++]; */
*c = QSE_WT('?');
tio->inbuf_curp++;
return 1;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: tio-put.c 565 2011-09-11 02:48:21Z hyunghwan.chung $
* $Id: tio-put.c 566 2011-09-11 12:44:56Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -62,6 +62,7 @@ static qse_ssize_t tio_putc (qse_tio_t* tio, qse_char_t c, int* flush_needed)
}
else if (n > QSE_COUNTOF(mc))
{
if (tio->flags & QSE_TIO_IGNOREMBWCERR) return 1;
tio->errnum = QSE_TIO_ENOSPC;
return -1;
}