summaryrefslogtreecommitdiffstats
path: root/generic/tclScan.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclScan.c')
-rw-r--r--generic/tclScan.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index fbfba2d..74ec2da 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -261,7 +261,7 @@ ValidateFormat(
Tcl_UniChar ch = 0;
int objIndex, xpgSize, nspace = numVars;
int *nassign = TclStackAlloc(interp, nspace * sizeof(int));
- char buf[TCL_UTF_MAX+1];
+ char buf[TCL_UTF_MAX + 1] = "";
Tcl_Obj *errorMsg; /* Place to build an error messages. Note that
* these are messy operations because we do
* not want to use the formatting engine;
@@ -881,9 +881,9 @@ Tcl_ScanObjCmd(
offset = TclUtfToUniChar(string, &sch);
i = (int)sch;
-#if TCL_UTF_MAX == 4
- if (!offset) {
- offset = TclUtfToUniChar(string, &sch);
+#if TCL_UTF_MAX <= 4
+ if ((sch >= 0xD800) && (offset < 3)) {
+ offset += TclUtfToUniChar(string+offset, &sch);
i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
}
#endif
@@ -943,7 +943,7 @@ Tcl_ScanObjCmd(
int code = Tcl_GetBignumFromObj(interp, objPtr, &big);
if (code == TCL_OK) {
- if (mp_isneg(&big)) {
+ if (big.sign != MP_ZPOS) {
code = TCL_ERROR;
}
mp_clear(&big);