diff options
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; } /* |
