summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-12-23 17:48:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-12-23 17:48:36 (GMT)
commit14d329d47289cb067dc22eba521ef517a4a8ec15 (patch)
treec2fa633ff89d2a2617e06e5c6efe06b120eee62a
parentd6c73b078b083eaf42088b8350aeb628a0d96c0a (diff)
downloadtcl-14d329d47289cb067dc22eba521ef517a4a8ec15.zip
tcl-14d329d47289cb067dc22eba521ef517a4a8ec15.tar.gz
tcl-14d329d47289cb067dc22eba521ef517a4a8ec15.tar.bz2
Support TCL_ENCODING_CHAR_LIMIT in the Iso88591ToUtfProc driver.
-rw-r--r--generic/tclEncoding.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 0fe224e..3df720d 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2826,8 +2826,11 @@ Iso88591ToUtfProc(
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
- int result, numChars;
+ int result, numChars, charLimit = INT_MAX;
+ if (flags & TCL_ENCODING_CHAR_LIMIT) {
+ charLimit = *dstCharsPtr;
+ }
srcStart = src;
srcEnd = src + srcLen;
@@ -2835,7 +2838,7 @@ Iso88591ToUtfProc(
dstEnd = dst + dstLen - TCL_UTF_MAX;
result = TCL_OK;
- for (numChars = 0; src < srcEnd; numChars++) {
+ for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
Tcl_UniChar ch;
if (dst > dstEnd) {