diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-02-27 19:58:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-02-27 19:58:22 (GMT) |
commit | 8ef8de11eed562a7015b9e8ff11a6a77124b1d19 (patch) | |
tree | 60f7e611e511bbd99c79c93e45da3aab170da9d9 /generic | |
parent | 22438af8abfb0b3cc6f608bd906d804bae7cc4de (diff) | |
download | tk-8ef8de11eed562a7015b9e8ff11a6a77124b1d19.zip tk-8ef8de11eed562a7015b9e8ff11a6a77124b1d19.tar.gz tk-8ef8de11eed562a7015b9e8ff11a6a77124b1d19.tar.bz2 |
Let TkGetIntForIndex() return TCL_ERROR for invalid index values, in stead of -1. So, callers of this function don't need to do that any more.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkObj.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tkObj.c b/generic/tkObj.c index bbd331c..cfcb770 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -238,11 +238,11 @@ TkGetIntForIndex(Tcl_Obj *indexObj, TkSizeT end, TkSizeT *indexPtr) { return TCL_ERROR; } #if TCL_MAJOR_VERSION < 9 - if (*indexPtr < -1) { - *indexPtr = TCL_INDEX_NONE; + if ((*indexPtr < -1) || (end < -1)) { + return TCL_ERROR; } #endif - if ((*indexPtr != TCL_INDEX_NONE) && (*indexPtr > end)) { + if ((*indexPtr + 1) > (end + 1)) { *indexPtr = end + 1; } return TCL_OK; |