diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-24 10:23:33 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-24 10:23:33 (GMT) |
commit | da116b95a31241dc3abb6eed7d8f8eb3a9487232 (patch) | |
tree | 3b98b64461c97646bdbd3e8235aad6b7bf1bb2c3 /generic/tclInt.h | |
parent | b48319b304980c06ca5dd093770f8234eb8dbec5 (diff) | |
parent | 2ca7ab9af0d59c9907dde3d844e1785d33df4812 (diff) | |
download | tcl-da116b95a31241dc3abb6eed7d8f8eb3a9487232.zip tcl-da116b95a31241dc3abb6eed7d8f8eb3a9487232.tar.gz tcl-da116b95a31241dc3abb6eed7d8f8eb3a9487232.tar.bz2 |
Merge 8.6. This mainly introduces the overlong check into Tcl_UtfPrev(). 10 testcase changed results, all of them due to the Tcl_UtfPrev() improvement. Tcl_UtfNext() is not affected: Previous implementation was based on Tcl_UtfToUniChar(), which already did this check.
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 8d2e68a..2ff644e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4689,6 +4689,14 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; (numChars) = _count; \ } while (0); +#define TclUtfPrev(src, start) \ + (((src) < (start) + 2) ? (start) : \ + ((unsigned char) *((src) - 1)) < 0x80 ? (src) - 1 : \ + Tcl_UtfPrev(src, start)) + +#define TclUtfNext(src) \ + ((((unsigned char) *(src)) < 0x80) ? (src) + 1 : Tcl_UtfNext(src)) + /* *---------------------------------------------------------------- * Macro that encapsulates the logic that determines when it is safe to |