Bug fix in binary input.
authormdw <mdw>
Sat, 15 Jul 2000 10:01:08 +0000 (10:01 +0000)
committermdw <mdw>
Sat, 15 Jul 2000 10:01:08 +0000 (10:01 +0000)
mptext.c

index 891e414..952ec88 100644 (file)
--- 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) {