diff options
| -rw-r--r-- | generic/tclEncoding.c | 12 | ||||
| -rw-r--r-- | generic/tclStringObj.c | 2 | ||||
| -rw-r--r-- | generic/tclUtf.c | 4 |
3 files changed, 18 insertions, 0 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index abce00b..f067d92 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2533,12 +2533,14 @@ UtfToUtfProc( dstEnd = dst + dstLen - ((flags & ENCODING_UTF) ? TCL_UTF_MAX : 6); +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, dstLen); +#endif profile = CHANNEL_PROFILE_GET(flags); for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) { @@ -2754,12 +2756,14 @@ Utf32ToUtfProc( } result = TCL_OK; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, dstLen); +#endif /* * Check alignment with utf-32 (4 == sizeof(UTF-32)) @@ -3030,12 +3034,14 @@ Utf16ToUtfProc( } result = TCL_OK; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, dstLen); +#endif /* * Check alignment with utf-16 (2 == sizeof(UTF-16)) @@ -3450,12 +3456,14 @@ TableToUtfProc( dstStart = dst; dstEnd = dst + dstLen - TCL_UTF_MAX; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, dstLen); +#endif toUnicode = (const unsigned short *const *) dataPtr->toUnicode; prefixBytes = dataPtr->prefixBytes; @@ -3698,12 +3706,14 @@ Iso88591ToUtfProc( dstStart = dst; dstEnd = dst + dstLen - TCL_UTF_MAX; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, dstLen); +#endif result = TCL_OK; for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) { @@ -3944,12 +3954,14 @@ EscapeToUtfProc( dstStart = dst; dstEnd = dst + dstLen - TCL_UTF_MAX; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, dstLen); +#endif state = PTR2INT(*statePtr); if (flags & TCL_ENCODING_START) { diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 916b765..63e38bb 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -4504,12 +4504,14 @@ ExtendStringRepWithUnicode( copyBytes: dst = objPtr->bytes + origLength; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(dst, 0xff, stringPtr->allocated - origLength); +#endif for (i = 0; i < numChars; i++) { dst += Tcl_UniCharToUtf(unicode[i], dst); } diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 54cef2f..68112c5 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -349,12 +349,14 @@ Tcl_UniCharToUtfDString( p = string; wEnd = uniStr + uniLength; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Once TCL_UTF_MAX == 3 is removed and Tcl_UniCharToUtf restored to its * prior non-stateful nature, this call to memset can also be removed. */ memset(p, 0xff, Tcl_DStringLength(dsPtr) - oldLength); +#endif for (w = uniStr; w < wEnd; ) { p += Tcl_UniCharToUtf(*w, p); @@ -400,12 +402,14 @@ Tcl_Char16ToUtfDString( p = string; wEnd = uniStr + uniLength; +#if TCL_UTF_MAX < 4 /* Initialize the buffer so that some random data doesn't trick * Tcl_UniCharToUtf() into thinking it should combine surrogate pairs. * Because TCL_COMBINE is used here, memset() is required even when * TCL_UTF_MAX == 4. */ memset(p, 0xff, Tcl_DStringLength(dsPtr) - oldLength); +#endif for (w = uniStr; w < wEnd; ) { if (!len && ((*w & 0xFC00) != 0xDC00)) { |
