summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-17 20:52:20 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-17 20:55:15 -0400
commit6cb519231fba70ae5b84c1ae60aa8a653b14aa2e (patch)
tree0993d0feeaab0138beb975bc9d317078e32f13f9
parentc673b9669106412d75912124d16db5c975bb60bf (diff)
downloadfork-ledger-6cb519231fba70ae5b84c1ae60aa8a653b14aa2e.tar.gz
fork-ledger-6cb519231fba70ae5b84c1ae60aa8a653b14aa2e.tar.bz2
fork-ledger-6cb519231fba70ae5b84c1ae60aa8a653b14aa2e.zip
If AMOUNT_PARSE_NO_MIGRATE is set, do not set a commodity's precision even if
this is the first time a commodity is being seen. The reason is that it's quite possible (especially in bug reports) for the cost of a priced transaction to contain the first occurrence of a commodity.
-rw-r--r--amount.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/amount.cc b/amount.cc
index 69d26477..1ac2f407 100644
--- a/amount.cc
+++ b/amount.cc
@@ -1170,14 +1170,13 @@ void amount_t::parse(std::istream& in, unsigned char flags)
// Set the commodity's flags and precision accordingly
- if (newly_created || ! (flags & AMOUNT_PARSE_NO_MIGRATE)) {
+ if (! (flags & AMOUNT_PARSE_NO_MIGRATE)) {
commodity().add_flags(comm_flags);
if (quantity->prec > commodity().precision())
commodity().set_precision(quantity->prec);
- }
-
- if (flags & AMOUNT_PARSE_NO_MIGRATE)
+ } else {
quantity->flags |= BIGINT_KEEP_PREC;
+ }
// Now we have the final number. Remove commas and periods, if
// necessary.