summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-10-12 13:47:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-10-12 13:47:32 (GMT)
commit4dc1a8a58817ce403cd25a0f4b4ce2b2fa9ddd60 (patch)
treeb07a46ac5e1a5a18134a42d9ef1724d2438d4e4f /generic
parentae0ad313fd5ec45514945df2c2d55cf7d3bacff6 (diff)
parent66f257a58823378a79c3fb14169ed308b3b04d29 (diff)
downloadtcl-4dc1a8a58817ce403cd25a0f4b4ce2b2fa9ddd60.zip
tcl-4dc1a8a58817ce403cd25a0f4b4ce2b2fa9ddd60.tar.gz
tcl-4dc1a8a58817ce403cd25a0f4b4ce2b2fa9ddd60.tar.bz2
merge TclParseNumber fixes
Diffstat (limited to 'generic')
-rw-r--r--generic/tclStrToD.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index f69f6b9..6da6df3 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -396,6 +396,9 @@ static Tcl_WideUInt Nokia770Twiddle(Tcl_WideUInt w);
* - TCL_PARSE_SCAN_PREFIXES: ignore the prefixes 0b and 0o that are
* not part of the [scan] command's vocabulary. Use only in
* combination with TCL_PARSE_INTEGER_ONLY.
+ * - TCL_PARSE_BINARY_ONLY: parse only in the binary format, whether
+ * or not a prefix is present that would lead to binary parsing.
+ * Use only in combination with TCL_PARSE_INTEGER_ONLY.
* - TCL_PARSE_OCTAL_ONLY: parse only in the octal format, whether
* or not a prefix is present that would lead to octal parsing.
* Use only in combination with TCL_PARSE_INTEGER_ONLY.
@@ -627,6 +630,9 @@ TclParseNumber(
acceptPoint = p;
acceptLen = len;
if (c == 'x' || c == 'X') {
+ if (flags & (TCL_PARSE_OCTAL_ONLY|TCL_PARSE_BINARY_ONLY)) {
+ goto endgame;
+ }
state = ZERO_X;
break;
}
@@ -637,6 +643,9 @@ TclParseNumber(
goto zeroo;
}
if (c == 'b' || c == 'B') {
+ if (flags & TCL_PARSE_OCTAL_ONLY) {
+ goto endgame;
+ }
state = ZERO_B;
break;
}