changeset 281:0c70dcfb6796

Remember to initialize th_printf_ctx.ipos to 0!
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 22 Feb 2016 12:01:29 +0200
parents 454f0d37d94b
children f0cb48b34463
files th_string.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_string.c	Mon Feb 22 11:53:47 2016 +0200
+++ b/th_string.c	Mon Feb 22 12:01:29 2016 +0200
@@ -381,6 +381,7 @@
     ctx.buf = buf;
     ctx.size = size;
     ctx.pos = 0;
+    ctx.ipos = 0;
 
     ret = th_vprintf_do(&ctx, th_pbuf_vputch, fmt, ap);
 
@@ -418,6 +419,7 @@
     th_printf_ctx ctx;
     ctx.data = (void *) fh;
     ctx.pos = 0;
+    ctx.ipos = 0;
 
     return th_vprintf_do(&ctx, th_stdio_vputch, fmt, ap);
 #else
@@ -437,6 +439,8 @@
 #ifdef TH_USE_INTERNAL_SPRINTF
     ctx.data = (void *) fh;
     ctx.pos = 0;
+    ctx.ipos = 0;
+
     ret = th_vprintf_do(&ctx, th_stdio_vputch, fmt, ap);
 #else
     ret = fprintf(fh, fmt, ap);