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