diff options
author | dgp <dgp@users.sourceforge.net> | 2006-08-28 16:05:31 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2006-08-28 16:05:31 (GMT) |
commit | 9571f2381728758877fe7ef50963e3e373aad92f (patch) | |
tree | d56b5c209ddc88aa2b96deabf31937377f8a7010 /generic/tclParseExpr.c | |
parent | 484ddcb6a498fab5690d6e8d58fb6b75f16195c7 (diff) | |
download | tcl-9571f2381728758877fe7ef50963e3e373aad92f.zip tcl-9571f2381728758877fe7ef50963e3e373aad92f.tar.gz tcl-9571f2381728758877fe7ef50963e3e373aad92f.tar.bz2 |
* generic/tclStringObj.c: Revised ObjPrintfVA to take care
* generic/tclParseExpr.c: to copy only whole characters when
doing %s formatting. This relieves callers of TclObjPrintf() and
TclFormatToErrorInfo() from needing to fix arguments to character
boundaries. Tcl_ParseExpr() simplified by taking advantage.
[Bug 1547786]
Diffstat (limited to 'generic/tclParseExpr.c')
-rw-r--r-- | generic/tclParseExpr.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c index 9560630..4a2ab8d 100644 --- a/generic/tclParseExpr.c +++ b/generic/tclParseExpr.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParseExpr.c,v 1.39 2006/08/23 21:31:55 dgp Exp $ + * RCS: @(#) $Id: tclParseExpr.c,v 1.40 2006/08/28 16:05:32 dgp Exp $ */ #define OLD_EXPR_PARSER 0 @@ -2611,18 +2611,15 @@ Tcl_ParseExpr( TclObjPrintf(NULL, msg, "\nin expression \"%s%.*s%.*s%s%s%.*s%s\"", ((start - limit) < scratch.string) ? "" : "...", ((start - limit) < scratch.string) - ? (start - scratch.string) - : (start - Tcl_UtfPrev(start+1-limit+3, scratch.string)), + ? (start - scratch.string) : limit - 3, ((start - limit) < scratch.string) - ? scratch.string - : Tcl_UtfPrev(start+1-limit+3, scratch.string), + ? scratch.string : start - limit + 3, (scanned < limit) ? scanned : limit - 3, start, (scanned < limit) ? "" : "...", insertMark ? mark : "", (start + scanned + limit > scratch.end) - ? scratch.end - (start + scanned) - : Tcl_UtfPrev(start+scanned+limit-3+1, start+scanned) - - (start + scanned), start + scanned, + ? scratch.end - (start + scanned) : limit-3, + start + scanned, (start + scanned + limit > scratch.end) ? "" : "..." ); if (post != NULL) { |