summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-09-01 13:48:56 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-09-01 13:48:56 (GMT)
commite28f1eece4af6a2415de923fb4c3cfae7c055c8e (patch)
tree9ab2c073edc2963ca5c815b62437b9f46415df62
parent25b97a7df947a49be144f13ba4c392d3fda00e7d (diff)
downloadtcl-e28f1eece4af6a2415de923fb4c3cfae7c055c8e.zip
tcl-e28f1eece4af6a2415de923fb4c3cfae7c055c8e.tar.gz
tcl-e28f1eece4af6a2415de923fb4c3cfae7c055c8e.tar.bz2
Handle Unicode surrogates correctly in Tcl_AppendFormatToObj() and BuildCharSet(). Only makes a difference for TCL_UTF_MAX=4, when surrogates are used in the format string ... highly unlikely corner-case.
-rw-r--r--generic/tclScan.c4
-rw-r--r--generic/tclStringObj.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 7a6a8a2..e1fcad4 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -72,7 +72,7 @@ BuildCharSet(
CharSet *cset,
const char *format) /* Points to first char of set. */
{
- Tcl_UniChar ch, start;
+ Tcl_UniChar ch = 0, start;
int offset, nranges;
const char *end;
@@ -582,7 +582,7 @@ Tcl_ScanObjCmd(
char op = 0;
int width, underflow = 0;
Tcl_WideInt wideValue;
- Tcl_UniChar ch, sch;
+ Tcl_UniChar ch = 0, sch = 0;
Tcl_Obj **objs = NULL, *objPtr = NULL;
int flags;
char buf[513]; /* Temporary buffer to hold scanned number
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 6d97881..01b044e 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1682,6 +1682,7 @@ Tcl_AppendFormatToObj(
const char *span = format, *msg, *errCode;
int numBytes = 0, objIndex = 0, gotXpg = 0, gotSequential = 0;
int originalLength, limit;
+ Tcl_UniChar ch = 0;
static const char *mixedXPG =
"cannot mix \"%\" and \"%n$\" conversion specifiers";
static const char *const badIndex[2] = {
@@ -1709,7 +1710,6 @@ Tcl_AppendFormatToObj(
#endif
int newXpg, numChars, allocSegment = 0, segmentLimit, segmentNumBytes;
Tcl_Obj *segment;
- Tcl_UniChar ch = 0;
int step = TclUtfToUniChar(format, &ch);
format += step;