summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-11-19 02:34:49 (GMT)
committerhobbs <hobbs>2002-11-19 02:34:49 (GMT)
commitada87b51edc6c26dcb7261164f7092a397ba120c (patch)
tree504abe4bc769d428863271620704ff919b9629b9 /generic/tclUtil.c
parente5e99a4fbc43c79c182147cfa5b3f560000ac103 (diff)
downloadtcl-ada87b51edc6c26dcb7261164f7092a397ba120c.zip
tcl-ada87b51edc6c26dcb7261164f7092a397ba120c.tar.gz
tcl-ada87b51edc6c26dcb7261164f7092a397ba120c.tar.bz2
* generic/tclUtil.c (SetEndOffsetFromAny): handle integer offset
after the "end-" prefix. * generic/get.test: * generic/string.test: * generic/tclObj.c (SetIntFromAny, SetWideIntFromAny): * generic/tclGet.c (TclGetLong, Tcl_GetInt): simplify sign handling before calling strtoul(l). [Bug #634856]
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 2d6ba05..a4d783b 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.35 2002/11/12 02:26:40 hobbs Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.36 2002/11/19 02:34:50 hobbs Exp $
*/
#include "tclInt.h"
@@ -2406,14 +2406,15 @@ SetEndOffsetFromAny(interp, objPtr)
if (length <= 3) {
offset = 0;
- } else if (bytes[3] == '-') {
+ } else if ((length > 4) && (bytes[3] == '-')) {
/*
- * This is our limited string expression evaluator
+ * This is our limited string expression evaluator. Pass everything
+ * after "end-" to Tcl_GetInt, then reverse for offset.
*/
- if (Tcl_GetInt(interp, bytes+3, &offset) != TCL_OK) {
+ if (Tcl_GetInt(interp, bytes+4, &offset) != TCL_OK) {
return TCL_ERROR;
}
-
+ offset = -offset;
} else {
/*
* Conversion failed. Report the error.