summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 deaabaa..83510cc 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1290,6 +1290,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;
}
@@ -1333,17 +1334,20 @@ Tcl_ExternalToUtfDStringEx(
/* Caller wants error message on failure */
if (result != TCL_OK && interp != NULL) {
char buf[TCL_INTEGER_SPACE];
- snprintf(buf, sizeof(buf), "%u", nBytesProcessed);
+ snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "u", nBytesProcessed);
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf("unexpected byte sequence starting at index %"
- "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;
}
@@ -1527,7 +1531,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
*
@@ -1590,6 +1594,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,21 +1635,25 @@ Tcl_UtfToExternalDStringEx(
} else {
/* Caller wants error message on failure */
if (result != TCL_OK && interp != NULL) {
- int pos = Tcl_NumUtfChars(srcStart, nBytesProcessed);
+ Tcl_Size pos = Tcl_NumUtfChars(srcStart, nBytesProcessed);
int ucs4;
char buf[TCL_INTEGER_SPACE];
TclUtfToUCS4(&srcStart[nBytesProcessed], &ucs4);
- snprintf(buf, sizeof(buf), "%u", nBytesProcessed);
+ snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "u", nBytesProcessed);
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf(
- "unexpected character at index %d: 'U+%06X'",
+ "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;
}
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 2f433c5..f1b5258 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -3448,8 +3448,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
*