fixed a bug of not honoring precision specified with %.* in computing string length given for 's' and 'S'
This commit is contained in:
		| @ -465,7 +465,14 @@ static int fmtoutv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_data_t* data, v | |||||||
|  |  | ||||||
| 		#if defined(MOO_OOCH_IS_UCH) | 		#if defined(MOO_OOCH_IS_UCH) | ||||||
| 			/* get the length */ | 			/* get the length */ | ||||||
| 			for (bslen = 0; bsp[bslen]; bslen++); | 			if (flagc & FLAGC_DOT) | ||||||
|  | 			{ | ||||||
|  | 				for (bslen = 0; bslen < precision && bsp[bslen]; bslen++); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				for (bslen = 0; bsp[bslen]; bslen++); | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			if (moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, moo->cmgr, 0) <= -1) goto oops; | 			if (moo_conv_bchars_to_uchars_with_cmgr(bsp, &bslen, MOO_NULL, &slen, moo->cmgr, 0) <= -1) goto oops; | ||||||
|  |  | ||||||
| @ -534,7 +541,14 @@ static int fmtoutv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_data_t* data, v | |||||||
|  |  | ||||||
| 		#if defined(MOO_OOCH_IS_BCH) | 		#if defined(MOO_OOCH_IS_BCH) | ||||||
| 			/* get the length */ | 			/* get the length */ | ||||||
| 			for (uslen = 0; usp[uslen]; uslen++); | 			if (flagc & FLAGC_DOT) | ||||||
|  | 			{ | ||||||
|  | 				for (uslen = 0; uslen < precision && usp[uslen]; uslen++); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				for (uslen = 0; usp[uslen]; uslen++); | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			if (moo_conv_uchars_to_bchars_with_cmgr(usp, &uslen, MOO_NULL, &slen, moo->cmgr) <= -1) goto oops; | 			if (moo_conv_uchars_to_bchars_with_cmgr(usp, &uslen, MOO_NULL, &slen, moo->cmgr) <= -1) goto oops; | ||||||
|  |  | ||||||
|  | |||||||
| @ -429,7 +429,7 @@ MOO_INLINE int moo_conv_bchars_to_uchars_with_cmgr ( | |||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			n = cmgr->bctouc (p, mlen, q); | 			n = cmgr->bctouc(p, mlen, q); | ||||||
| 			if (n == 0) | 			if (n == 0) | ||||||
| 			{ | 			{ | ||||||
| 				/* invalid sequence */ | 				/* invalid sequence */ | ||||||
| @ -485,7 +485,7 @@ MOO_INLINE int moo_conv_bchars_to_uchars_with_cmgr ( | |||||||
| 		{ | 		{ | ||||||
| 			moo_oow_t n; | 			moo_oow_t n; | ||||||
|  |  | ||||||
| 			n = cmgr->bctouc (p, mlen, &w); | 			n = cmgr->bctouc(p, mlen, &w); | ||||||
| 			if (n == 0) | 			if (n == 0) | ||||||
| 			{ | 			{ | ||||||
| 				/* invalid sequence */ | 				/* invalid sequence */ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user