mptext.c: Fix hopeless incorrectness in raw base conversions.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 1 Sep 2011 23:49:10 +0000 (00:49 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 1 Sep 2011 23:52:30 +0000 (00:52 +0100)
Both mp_write and mp_read are broken.  The former would write a digit
`0' for a zero input, and attempt to prefix its output with a `-' sign
on negative input, both of which are impossible to decode unambiguously.
The latter would skip leading whitespace characters, which makes
encodings beginning with certain bytes decode incorrectly.

Include tests for these cases, and fix the bugs.


No differences found