*** no comment ***

This commit is contained in:
John Wiegley 2007-05-11 09:53:48 +00:00
parent 9e9a7f62bc
commit ad2535b032

View file

@ -243,10 +243,10 @@ namespace {
return amount_t::precision_t(exp); return amount_t::precision_t(exp);
#else #else
int decpt, sign; int decpt, sign;
char * buf = dtoa(val, 0, 0, &decpt, &sign, NULL); char * buf = dtoa(val, 0, 0, &decpt, &sign, NULL);
char * result; char * result;
int len = std::strlen(buf); int len = std::strlen(buf);
if (decpt <= len) { if (decpt <= len) {
decpt = len - decpt; decpt = len - decpt;
@ -256,7 +256,7 @@ namespace {
// order to convert this buffer into an integer. // order to convert this buffer into an integer.
int zeroes = decpt - len; int zeroes = decpt - len;
result = new char[len + zeroes]; result = new char[len + zeroes + 1];
std::strcpy(result, buf); std::strcpy(result, buf);
int i; int i;
@ -268,7 +268,7 @@ namespace {
} }
if (sign) { if (sign) {
char * newbuf = new char[std::strlen(result ? result : buf) + 4]; char * newbuf = new char[std::strlen(result ? result : buf) + 2];
newbuf[0] = '-'; newbuf[0] = '-';
std::strcpy(&newbuf[1], result ? result : buf); std::strcpy(&newbuf[1], result ? result : buf);
mpz_set_str(dest, newbuf, 10); mpz_set_str(dest, newbuf, 10);