Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Jul 19, 2023
2 parents 2e4dede + 515bd7c commit c510082
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
21 changes: 15 additions & 6 deletions generic/tclEncoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1630,18 +1635,21 @@ 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));
Tcl_SetErrorCode(interp, "TCL", "ENCODING", "ILLEGALSEQUENCE",
buf, NULL);
}
}
if (result != TCL_OK) {
errno = (result == TCL_CONVERT_NOSPACE) ? ENOMEM : EILSEQ;
}
return result;
}

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions generic/tclListObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit c510082

Please sign in to comment.