diff options
author | tege <tege@gmplib.org> | 2003-03-17 02:57:27 +0100 |
---|---|---|
committer | tege <tege@gmplib.org> | 2003-03-17 02:57:27 +0100 |
commit | e3941492fc99d7f08a20eda8e83d812f8a092d70 (patch) | |
tree | 0a7785fc818c1995de0a4af1fecad0cb381f4e04 /mpz/out_str.c | |
parent | 20a8322153e21c6c18e15b28c926defa5c8636ad (diff) | |
download | gmp-e3941492fc99d7f08a20eda8e83d812f8a092d70.tar.gz |
Allow bases <= 62. Return error for invalid bases.
Diffstat (limited to 'mpz/out_str.c')
-rw-r--r-- | mpz/out_str.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mpz/out_str.c b/mpz/out_str.c index 15db0af57..61dc0004b 100644 --- a/mpz/out_str.c +++ b/mpz/out_str.c @@ -41,9 +41,15 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x) if (base >= 0) { + num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz"; if (base == 0) base = 10; - num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz"; + else if (base > 36) + { + num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + if (base > 62) + return 0; + } } else { |