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)
|
||||
{
|
||||
/* conversion error. just emit the byte as it is. */
|
||||
#if defined(FMTOUT_STRICT)
|
||||
goto oops;
|
||||
#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
|
||||
ch = *checkpoint;
|
||||
cvlen = 1;
|
||||
}
|
||||
checkpoint += cvlen;
|
||||
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 */
|
||||
cmgr = moo->cmgr;
|
||||
bslen = obslen;
|
||||
if (moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, cmgr, 0) <= -1)
|
||||
{
|
||||
#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
|
||||
}
|
||||
if (moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, cmgr, 0) <= -1) goto oops;
|
||||
|
||||
/* slen holds the length after conversion */
|
||||
n = slen;
|
||||
|
Loading…
Reference in New Issue
Block a user