summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-08-28 14:13:22 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-08-28 14:13:22 (GMT)
commit484ddcb6a498fab5690d6e8d58fb6b75f16195c7 (patch)
tree11888e917d8f13929f3ff16d8e4a19a7b8dae2f6
parentc22de5144f416a709ff386b57b1484fa09ec5ed1 (diff)
downloadtcl-484ddcb6a498fab5690d6e8d58fb6b75f16195c7.zip
tcl-484ddcb6a498fab5690d6e8d58fb6b75f16195c7.tar.gz
tcl-484ddcb6a498fab5690d6e8d58fb6b75f16195c7.tar.bz2
* generic/tclStringObj.c: Corrected TclFormatObj's failure
to count up the number of arguments required by examining the format string. [Bug 1547681]
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclStringObj.c15
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 <dgp@users.sourceforge.net>
+
+ * 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 <joe@mistachkin.com>
* 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);