Mercurial > hg > th-libs
changeset 245:c8595941852b
Some more preparation work for precision support.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 16 Feb 2016 16:40:31 +0200 |
parents | 59c45e295524 |
children | e00b547af1a7 |
files | th_string.c |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/th_string.c Tue Feb 16 16:30:51 2016 +0200 +++ b/th_string.c Tue Feb 16 16:40:31 2016 +0200 @@ -112,8 +112,8 @@ // Simple implementations of printf() type functions // static int th_vput_itoa(void *ctx, int (*vputch)(void *ctx, const char ch), - int val, const int radix, const char padMode, const int width, - const BOOL unsig, const BOOL upcase, const BOOL sign) + int val, const int radix, const char padMode, const char padChar, + const int width, const BOOL unsig, const BOOL upcase, const BOOL sign) { char buf[64]; size_t pos = 0; @@ -192,7 +192,8 @@ static int th_vput_str(void *ctx, int (*vputch)(void *ctx, const char ch), - const char *str, const char padMode, const int width) + const char *str, const char padMode, const char padChar, + const int width, const int prec) { int nwidth = width - strlen(str); int ret = 0; @@ -301,7 +302,7 @@ goto out; if ((ret = th_vput_itoa(ctx, vputch, va_arg(ap, unsigned int), - 10, padMode, width, *fmt == 'u', FALSE, sign)) == EOF) + 10, padMode, padChar, width, *fmt == 'u', FALSE, sign)) == EOF) goto out; break; @@ -311,7 +312,7 @@ goto out; if ((ret = th_vput_itoa(ctx, vputch, va_arg(ap, unsigned int), - 16, padMode, width, TRUE, *fmt == 'X', FALSE)) == EOF) + 16, padMode, padChar, width, TRUE, *fmt == 'X', FALSE)) == EOF) goto out; break; @@ -323,7 +324,7 @@ if ((padMode != '-' && padMode != ' ') || sign) goto out; - if ((ret = th_vput_str(ctx, vputch, va_arg(ap, char *), padMode, width)) == EOF) + if ((ret = th_vput_str(ctx, vputch, va_arg(ap, char *), padMode, padChar, width, prec)) == EOF) goto out; break;