simple changes to fmtoutv.h
This commit is contained in:
parent
450f9a8b5c
commit
ea9f9b81e1
@ -168,16 +168,8 @@ static int fmtoutv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_data_t* data, v
|
|||||||
if (cvlen == 0 || cvlen > bclen)
|
if (cvlen == 0 || cvlen > bclen)
|
||||||
{
|
{
|
||||||
/* conversion error. just emit the byte as it is. */
|
/* conversion error. just emit the byte as it is. */
|
||||||
#if defined(FMTOUT_STRICT)
|
ch = *checkpoint;
|
||||||
goto oops;
|
cvlen = 1;
|
||||||
#else
|
|
||||||
cmgr = moo_get_utf8_cmgr();
|
|
||||||
if (cmgr == moo->cmgr || (cvlen = cmgr->bctouc(checkpoint, bclen, &ch)) == 0 || cvlen > bclen)
|
|
||||||
{
|
|
||||||
cmgr = moo_get_mb8_cmgr();
|
|
||||||
if (cmgr == moo->cmgr || (cvlen = cmgr->bctouc(checkpoint, bclen, &ch)) == 0 || cvlen > bclen) goto oops;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
checkpoint += cvlen;
|
checkpoint += cvlen;
|
||||||
PUT_OOCH (ch, 1);
|
PUT_OOCH (ch, 1);
|
||||||
@ -506,21 +498,7 @@ static int fmtoutv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_data_t* data, v
|
|||||||
/* get the required length for successful conversion in a fail-safe manner */
|
/* get the required length for successful conversion in a fail-safe manner */
|
||||||
cmgr = moo->cmgr;
|
cmgr = moo->cmgr;
|
||||||
bslen = obslen;
|
bslen = obslen;
|
||||||
if (moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, cmgr, 0) <= -1)
|
if (moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, cmgr, 0) <= -1) goto oops;
|
||||||
{
|
|
||||||
#if defined(FMTOUT_STRICT)
|
|
||||||
goto oops;
|
|
||||||
#else
|
|
||||||
cmgr = moo_get_utf8_cmgr();
|
|
||||||
bslen = obslen;
|
|
||||||
if (cmgr == moo->cmgr || moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, cmgr, 0) <= -1)
|
|
||||||
{
|
|
||||||
cmgr = moo_get_mb8_cmgr();
|
|
||||||
bslen = obslen;
|
|
||||||
if (cmgr == moo->cmgr || moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, cmgr, 0) <= -1) goto oops;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* slen holds the length after conversion */
|
/* slen holds the length after conversion */
|
||||||
n = slen;
|
n = slen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user