X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/fe6657c961b01ec72e9f35f4c3d96b11b31cf09c..45c0fd363937c6e9b05da04a9167e9912c05ca0c:/mptext.c diff --git a/mptext.c b/mptext.c index 9cca8a8..ee73fed 100644 --- a/mptext.c +++ b/mptext.c @@ -7,7 +7,7 @@ * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -41,7 +41,7 @@ /* --- Maximum recursion depth --- * * - * This is the number of bits in a @size_t@ object. Why? + * This is the number of bits in a @size_t@ object. Why? * * To see this, let %$b = \textit{MPW\_MAX} + 1$% and let %$Z$% be the * largest @size_t@ value. Then the largest possible @mp@ is %$M - 1$% where @@ -123,7 +123,7 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p) /* --- Initialize the stacks --- */ mp_build(&rr, &rd, &rd + 1); - pow[0] = &rr; + pow[0] = &rr; pows = 1; sp = 0; @@ -262,7 +262,7 @@ restart: a |= MPW(x) << b; } else { a |= MPW(x) >> (bit - b); - b += MPW_BITS - bit; + b += MPW_BITS - bit; *--v = MPW(a); n--; if (!n) { @@ -337,7 +337,7 @@ restart: x = ch - '0'; else { if (rd <= 36) - ch = tolower(ch); + ch = tolower(ch); if (ch >= 'a' && ch <= 'z') /* ASCII dependent! */ x = ch - 'a' + 10; else if (ch >= 'A' && ch <= 'Z') @@ -441,7 +441,7 @@ restart: /* --- Bail out if the number was bad --- */ done: - if (!(f & f_ok)) + if (!(f & f_ok)) return (0); /* --- Set the sign and return --- */ @@ -689,8 +689,8 @@ int mp_write(mp *m, int radix, const mptext_ops *ops, void *p) case 8: case -8: return (binary(m, 3, radix, ops, p)); case 16: case -16: return (binary(m, 4, radix, ops, p)); case 32: case -32: return (binary(m, 5, radix, ops, p)); - case -64: return (binary(m, 6, radix, ops, p)); - case -128: return (binary(m, 7, radix, ops, p)); + case -64: return (binary(m, 6, radix, ops, p)); + case -128: return (binary(m, 7, radix, ops, p)); } /* --- If the number is small, do it the easy way --- */ @@ -757,7 +757,7 @@ static int verify(dstr *v) if (m) { if (!ob) { fprintf(stderr, "*** unexpected successful parse\n" - "*** input [%2i] = ", ib); + "*** input [%2i] = ", ib); if (ib < 0) type_hex.dump(&v[1], stderr); else @@ -769,17 +769,17 @@ static int verify(dstr *v) mp_writedstr(m, &d, ob); if (d.len != v[3].len || memcmp(d.buf, v[3].buf, d.len) != 0) { fprintf(stderr, "*** failed read or write\n" - "*** input [%2i] = ", ib); + "*** input [%2i] = ", ib); if (ib < 0) type_hex.dump(&v[1], stderr); else fputs(v[1].buf, stderr); - fprintf(stderr, "\n*** output [%2i] = ", ob); + fprintf(stderr, "\n*** output [%2i] = ", ob); if (ob < 0) type_hex.dump(&d, stderr); else fputs(d.buf, stderr); - fprintf(stderr, "\n*** expected [%2i] = ", ob); + fprintf(stderr, "\n*** expected [%2i] = ", ob); if (ob < 0) type_hex.dump(&v[3], stderr); else @@ -792,7 +792,7 @@ static int verify(dstr *v) } else { if (ob) { fprintf(stderr, "*** unexpected parse failure\n" - "*** input [%2i] = ", ib); + "*** input [%2i] = ", ib); if (ib < 0) type_hex.dump(&v[1], stderr); else @@ -810,17 +810,17 @@ static int verify(dstr *v) if (v[1].len - off != v[4].len || memcmp(v[1].buf + off, v[4].buf, v[4].len) != 0) { fprintf(stderr, "*** leftovers incorrect\n" - "*** input [%2i] = ", ib); + "*** input [%2i] = ", ib); if (ib < 0) type_hex.dump(&v[1], stderr); else fputs(v[1].buf, stderr); fprintf(stderr, "\n*** expected `%s'\n" - "*** found `%s'\n", + "*** found `%s'\n", v[4].buf, v[1].buf + off); ok = 0; } - + dstr_destroy(&d); assert(mparena_count(MPARENA_GLOBAL) == 0); return (ok);