diff options
author | Kevin B Kenny <kennykb@acm.org> | 2005-08-17 21:39:01 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2005-08-17 21:39:01 (GMT) |
commit | d1e6466fda61e50914eb78c463aedc608f6054d4 (patch) | |
tree | ea6d7dfda51f00f45b418d5ecfcb0a4d6c8be945 | |
parent | 4e4305ee7dd79f31de5f48205bea341099be3c5d (diff) | |
download | tcl-d1e6466fda61e50914eb78c463aedc608f6054d4.zip tcl-d1e6466fda61e50914eb78c463aedc608f6054d4.tar.gz tcl-d1e6466fda61e50914eb78c463aedc608f6054d4.tar.bz2 |
changed TclParseNumber to leave endPtrPtr on trailing whitespace
-rw-r--r-- | ChangeLog | 3 | ||||
-rwxr-xr-x | generic/tclStrToD.c | 10 |
2 files changed, 8 insertions, 5 deletions
@@ -12,7 +12,8 @@ there was very poor test coverage in those areas. * generic/tclParseExpr.c: Reworked parsing of numbers to call TclParseNumber rather than trying to do things locally. - * generic/tclStrToD.c: Corrected a comment. + * generic/tclStrToD.c: Corrected a comment. Changed so that + *endPtrPtr does not include any trailing whitespace. 2005-08-17 Don Porter <dgp@users.sourceforge.net> diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index d19270a..7333d4b 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.20 2005/08/17 20:49:55 kennykb Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.21 2005/08/17 21:39:01 kennykb Exp $ * *---------------------------------------------------------------------- */ @@ -784,6 +784,10 @@ TclParseNumber( Tcl_Interp* interp, /* Skip past trailing whitespace */ + if (endPtrPtr != NULL) { + *endPtrPtr = p; + } + while (len > 0 && isspace(UCHAR(*p))) { ++p; --len; @@ -791,9 +795,7 @@ TclParseNumber( Tcl_Interp* interp, /* Determine whether a partial string is acceptable. */ - if (endPtrPtr != NULL) { - *endPtrPtr = p; - } else if (len != 0 && *p != '\0') { + if (endPtrPtr == NULL && len != 0 && *p != '\0') { status = TCL_ERROR; } |