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 /mpf/get_str.c | |
parent | 20a8322153e21c6c18e15b28c926defa5c8636ad (diff) | |
download | gmp-e3941492fc99d7f08a20eda8e83d812f8a092d70.tar.gz |
Allow bases <= 62. Return error for invalid bases.
Diffstat (limited to 'mpf/get_str.c')
-rw-r--r-- | mpf/get_str.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mpf/get_str.c b/mpf/get_str.c index b61e230ef..090781ab2 100644 --- a/mpf/get_str.c +++ b/mpf/get_str.c @@ -67,9 +67,15 @@ mpf_get_str (char *digit_ptr, mp_exp_t *exp, int base, size_t n_digits, mpf_srcp 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 NULL; + } } else { |