From 484ddcb6a498fab5690d6e8d58fb6b75f16195c7 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 28 Aug 2006 14:13:22 +0000 Subject: * generic/tclStringObj.c: Corrected TclFormatObj's failure to count up the number of arguments required by examining the format string. [Bug 1547681] --- ChangeLog | 6 ++++++ generic/tclStringObj.c | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14f1f17..456f661 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-28 Don Porter + + * generic/tclStringObj.c: Corrected TclFormatObj's failure + to count up the number of arguments required by examining the + format string. [Bug 1547681] + 2006-08-27 Joe Mistachkin * generic/tclClock.c (ClockClicksObjCmd): Fix nested macro breakage diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index e0af618..c0736f3 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.55 2006/08/10 12:15:31 dkf Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.56 2006/08/28 14:13:22 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -2314,12 +2314,19 @@ FormatObjVA( { int code, objc; Tcl_Obj **objv, *element, *list = Tcl_NewObj(); + CONST char *p = format; Tcl_IncrRefCount(list); - element = va_arg(argList, Tcl_Obj *); - while (element != NULL) { - Tcl_ListObjAppendElement(NULL, list, element); + while (*p != '\0') { + if (*p++ != '%') { + continue; + } + if (*p == '%') { + continue; + } + p++; element = va_arg(argList, Tcl_Obj *); + Tcl_ListObjAppendElement(NULL, list, element); } Tcl_ListObjGetElements(NULL, list, &objc, &objv); code = TclAppendFormattedObjs(interp, objPtr, format, objc, objv); -- cgit v0.12