fixed a bug of not honoring precision specified with %.* in computing string length given for 's' and 'S'

This commit is contained in:
hyung-hwan 2019-01-31 09:12:24 +00:00
parent 6cdec68b01
commit 8994e67067

View File

@ -466,7 +466,15 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
#if defined(HCL_OOCH_IS_UCH) #if defined(HCL_OOCH_IS_UCH)
/* get the length */ /* get the length */
if (flagc & FLAGC_DOT)
{
for (bslen = 0; bslen < precision && bsp[bslen]; bslen++);
}
else
{
for (bslen = 0; bsp[bslen]; bslen++); for (bslen = 0; bsp[bslen]; bslen++);
}
/*if (hcl_convbtooochars(hcl, bsp, &bslen, HCL_NULL, &slen) <= -1) goto oops;*/ /*if (hcl_convbtooochars(hcl, bsp, &bslen, HCL_NULL, &slen) <= -1) goto oops;*/
if (hcl_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, HCL_NULL, &slen, hcl->cmgr, 0) <= -1) goto oops; if (hcl_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, HCL_NULL, &slen, hcl->cmgr, 0) <= -1) goto oops;
@ -537,7 +545,14 @@ static int logfmtv (hcl_t* hcl, const fmtchar_t* fmt, hcl_fmtout_t* data, va_lis
#if defined(HCL_OOCH_IS_BCH) #if defined(HCL_OOCH_IS_BCH)
/* get the length */ /* get the length */
if (flagc & FLAGC_DOT)
{
for (uslen = 0; uslen < precision && usp[uslen]; uslen++);
}
else
{
for (uslen = 0; usp[uslen]; uslen++); for (uslen = 0; usp[uslen]; uslen++);
}
/*if (hcl_convutooochars(hcl, usp, &uslen, HCL_NULL, &slen) <= -1) goto oops;*/ /*if (hcl_convutooochars(hcl, usp, &uslen, HCL_NULL, &slen) <= -1) goto oops;*/
if (hcl_conv_uchars_to_bchars_with_cmgr(usp, &uslen, HCL_NULL, &slen, hcl->cmgr) <= -1) goto oops; if (hcl_conv_uchars_to_bchars_with_cmgr(usp, &uslen, HCL_NULL, &slen, hcl->cmgr) <= -1) goto oops;