summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-19 14:49:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-19 14:49:55 (GMT)
commitc510082005ccca4d37d2716a570a380dde7f2c40 (patch)
tree16eec0066c5ad47ec3132306e3005fd5044339d7
parent2e4dede38726df20d789751af9b335c2b4ab6e96 (diff)
parent515bd7c0e7439f19f59c33be1ff8089de8f4417f (diff)
downloadtcl-c510082005ccca4d37d2716a570a380dde7f2c40.zip
tcl-c510082005ccca4d37d2716a570a380dde7f2c40.tar.gz
tcl-c510082005ccca4d37d2716a570a380dde7f2c40.tar.bz2
Merge 8.7
-rw-r--r--generic/tclEncoding.c21
-rw-r--r--generic/tclListObj.c4
2 files changed, 17 insertions, 8 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index e47b521..8dae256 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1235,6 +1235,7 @@ Tcl_ExternalToUtfDStringEx(
"Parameter error: TCL_ENCODING_{START,STOP} bits set in flags.",
TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALFLAGS", NULL);
+ errno = EINVAL;
return TCL_ERROR;
}
@@ -1299,17 +1300,20 @@ Tcl_ExternalToUtfDStringEx(
/* Caller wants error message on failure */
if (result != TCL_OK && interp != NULL) {
char buf[TCL_INTEGER_SPACE];
- snprintf(buf, sizeof(buf), "%" TCL_Z_MODIFIER "u", nBytesProcessed);
+ snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "u", nBytesProcessed);
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf("unexpected byte sequence starting at index %"
- TCL_Z_MODIFIER "u: '\\x%02X'",
+ TCL_SIZE_MODIFIER "u: '\\x%02X'",
nBytesProcessed,
UCHAR(srcStart[nBytesProcessed])));
Tcl_SetErrorCode(
interp, "TCL", "ENCODING", "ILLEGALSEQUENCE", buf, NULL);
}
}
+ if (result != TCL_OK) {
+ errno = (result == TCL_CONVERT_NOSPACE) ? ENOMEM : EILSEQ;
+ }
return result;
}
@@ -1500,7 +1504,7 @@ Tcl_UtfToExternalDString(
* The parameter flags controls the behavior, if any of the bytes in
* the source buffer are invalid or cannot be represented in the
* target encoding. It should be composed by OR-ing the following:
- * - *At most one* of TCL_ENCODING_PROFILE{DEFAULT,TCL8,STRICT}
+ * - *At most one* of TCL_ENCODING_PROFILE_*
* - TCL_ENCODING_STOPONERROR: Backward compatibility. Sets the profile
* to TCL_ENCODING_PROFILE_STRICT overriding any specified profile flags
*
@@ -1563,6 +1567,7 @@ Tcl_UtfToExternalDStringEx(
"Parameter error: TCL_ENCODING_{START,STOP} bits set in flags.",
TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALFLAGS", NULL);
+ errno = EINVAL;
return TCL_ERROR;
}
@@ -1630,11 +1635,11 @@ Tcl_UtfToExternalDStringEx(
int ucs4;
char buf[TCL_INTEGER_SPACE];
TclUtfToUCS4(&srcStart[nBytesProcessed], &ucs4);
- snprintf(buf, sizeof(buf), "%" TCL_Z_MODIFIER "u", nBytesProcessed);
+ snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "u", nBytesProcessed);
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf(
- "unexpected character at index %" TCL_Z_MODIFIER
+ "unexpected character at index %" TCL_SIZE_MODIFIER
"u: 'U+%06X'",
pos,
ucs4));
@@ -1642,6 +1647,9 @@ Tcl_UtfToExternalDStringEx(
buf, NULL);
}
}
+ if (result != TCL_OK) {
+ errno = (result == TCL_CONVERT_NOSPACE) ? ENOMEM : EILSEQ;
+ }
return result;
}
@@ -4058,9 +4066,10 @@ EscapeToUtfProc(
if ((checked == dataPtr->numSubTables + 2)
|| (flags & TCL_ENCODING_END)) {
if (!PROFILE_STRICT(flags)) {
+ unsigned skip = longest > left ? left : longest;
/* Unknown escape sequence */
dst += Tcl_UniCharToUtf(UNICODE_REPLACE_CHAR, dst);
- src += longest;
+ src += skip;
continue;
}
result = TCL_CONVERT_SYNTAX;
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 1d5f7f1..fa94b3f 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -3470,8 +3470,8 @@ UpdateStringOfList(
* Mark the list as being canonical; although it will now have a string
* rep, it is one we derived through proper "canonical" quoting and so
* it's known to be free from nasties relating to [concat] and [eval].
- * However, we only do this if
- *
+ * However, we only do this if
+ *
* (a) the store is not shared as a shared store may be referenced by
* multiple lists with different string reps. (see [a366c6efee]), AND
*