diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-18 22:44:43 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-18 22:44:43 (GMT) |
commit | 5a02d5db9cec007d16a60b24bd8cd0b1912d123f (patch) | |
tree | f9868ebc5760bacfff4a34e36a004b12f2c8383d /generic/tclUtil.c | |
parent | 3097e10be1fdd2dac0d1865cf86b453e35fcc0f1 (diff) | |
parent | 3dd30ce854309c3433f211cacf5c430b9e8d0005 (diff) | |
download | tcl-5a02d5db9cec007d16a60b24bd8cd0b1912d123f.zip tcl-5a02d5db9cec007d16a60b24bd8cd0b1912d123f.tar.gz tcl-5a02d5db9cec007d16a60b24bd8cd0b1912d123f.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 8e2d4ba..44ecd90 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3888,15 +3888,18 @@ TclIndexEncode( *---------------------------------------------------------------------- */ -int +size_t TclIndexDecode( int encoded, /* Value to decode */ size_t endValue) /* Meaning of "end" to use, > TCL_INDEX_END */ { - if (encoded <= TCL_INDEX_END) { - return (encoded - TCL_INDEX_END) + endValue; + if (encoded > TCL_INDEX_END) { + return encoded; + } + if (endValue >= TCL_INDEX_END - (size_t)encoded) { + return endValue + encoded - TCL_INDEX_END; } - return encoded; + return TCL_INDEX_NONE; } /* |