diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-11 09:53:48 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:48 -0400 |
commit | ad2535b032139d67933de6b97ec82983eb2b78bf (patch) | |
tree | cecd2897ab4ee62a8d1bcc2a7d1a982440406ffb /src | |
parent | 9e9a7f62bc1f48ef5f6526b7ad2abd4514a7e5d1 (diff) | |
download | fork-ledger-ad2535b032139d67933de6b97ec82983eb2b78bf.tar.gz fork-ledger-ad2535b032139d67933de6b97ec82983eb2b78bf.tar.bz2 fork-ledger-ad2535b032139d67933de6b97ec82983eb2b78bf.zip |
*** no comment ***
Diffstat (limited to 'src')
-rw-r--r-- | src/amount.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/amount.cc b/src/amount.cc index 6479ca3d..7f418ac3 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -243,10 +243,10 @@ namespace { return amount_t::precision_t(exp); #else - int decpt, sign; + int decpt, sign; char * buf = dtoa(val, 0, 0, &decpt, &sign, NULL); char * result; - int len = std::strlen(buf); + int len = std::strlen(buf); if (decpt <= len) { decpt = len - decpt; @@ -256,7 +256,7 @@ namespace { // order to convert this buffer into an integer. int zeroes = decpt - len; - result = new char[len + zeroes]; + result = new char[len + zeroes + 1]; std::strcpy(result, buf); int i; @@ -268,7 +268,7 @@ namespace { } if (sign) { - char * newbuf = new char[std::strlen(result ? result : buf) + 4]; + char * newbuf = new char[std::strlen(result ? result : buf) + 2]; newbuf[0] = '-'; std::strcpy(&newbuf[1], result ? result : buf); mpz_set_str(dest, newbuf, 10); |