From 7d45ed6cdc2c7fbec1399d03f84ba42fa3c6b451 Mon Sep 17 00:00:00 2001 From: mdw Date: Sat, 15 Jul 2000 10:01:08 +0000 Subject: [PATCH] Bug fix in binary input. --- mptext.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mptext.c b/mptext.c index 891e414..952ec88 100644 --- a/mptext.c +++ b/mptext.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mptext.c,v 1.6 2000/06/25 12:58:23 mdw Exp $ + * $Id: mptext.c,v 1.7 2000/07/15 10:01:08 mdw Exp $ * * Textual representation of multiprecision numbers * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mptext.c,v $ + * Revision 1.7 2000/07/15 10:01:08 mdw + * Bug fix in binary input. + * * Revision 1.6 2000/06/25 12:58:23 mdw * Fix the derivation of `depth' commentary. * @@ -166,7 +169,7 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p) /* --- Handle an initial sign --- */ - if (ch == '-') { + if (radix >= 0 && ch == '-') { f |= f_neg; ch = ops->get(p); while (isspace(ch)) @@ -203,6 +206,9 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p) for (;; ch = ops->get(p)) { int x; + if (ch < 0) + break; + /* --- An underscore indicates a numbered base --- */ if (ch == '_' && r > 0 && r <= 36) { -- 2.11.0