diff options
author | dgp <dgp@users.sourceforge.net> | 2014-12-23 17:48:36 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-12-23 17:48:36 (GMT) |
commit | a3babfe12a8c12394c0ae2e1a4bf6f4da3e88cbe (patch) | |
tree | c2fa633ff89d2a2617e06e5c6efe06b120eee62a | |
parent | b6fecacc22a9ba5f13cbab794af7dcc46ebc5bc3 (diff) | |
download | tcl-a3babfe12a8c12394c0ae2e1a4bf6f4da3e88cbe.zip tcl-a3babfe12a8c12394c0ae2e1a4bf6f4da3e88cbe.tar.gz tcl-a3babfe12a8c12394c0ae2e1a4bf6f4da3e88cbe.tar.bz2 |
Support TCL_ENCODING_CHAR_LIMIT in the Iso88591ToUtfProc driver.
-rw-r--r-- | generic/tclEncoding.c | 7 |
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) { |