From 4a96c8d7d847b26cdbba60cb246fdb4401721b70 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 13 Mar 2006 23:44:32 +0000 Subject: *** empty log message *** --- balance.cc | 12 ++++++------ value.cc | 10 ++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/balance.cc b/balance.cc index 45fad2a0..c67ca2de 100644 --- a/balance.cc +++ b/balance.cc @@ -21,7 +21,7 @@ amount_t balance_t::amount(const commodity_t& commodity) const std::ostringstream errmsg; errmsg << "Requested amount of a balance with multiple commodities: " - << *this; + << temp; throw new amount_error(errmsg.str()); } } @@ -213,7 +213,7 @@ balance_t& balance_t::operator*=(const balance_t& bal) return *this = bal * temp; std::ostringstream errmsg; - errmsg << "Cannot multiply two balances: " << *this << " * " << bal; + errmsg << "Cannot multiply two balances: " << temp << " * " << bal; throw new amount_error(errmsg.str()); } } @@ -254,7 +254,7 @@ balance_t& balance_t::operator*=(const amount_t& amt) std::ostringstream errmsg; errmsg << "Attempt to multiply balance by a commodity" << " not found in that balance: " - << *this << " * " << amt; + << temp << " * " << amt; throw new amount_error(errmsg.str()); } } @@ -284,7 +284,7 @@ balance_t& balance_t::operator/=(const balance_t& bal) return *this /= temp; std::ostringstream errmsg; - errmsg << "Cannot divide between two balances: " << *this << " / " << bal; + errmsg << "Cannot divide between two balances: " << temp << " / " << bal; throw new amount_error(errmsg.str()); } } @@ -325,7 +325,7 @@ balance_t& balance_t::operator/=(const amount_t& amt) std::ostringstream errmsg; errmsg << "Attempt to divide balance by a commodity" << " not found in that balance: " - << *this << " * " << amt; + << temp << " * " << amt; throw new amount_error(errmsg.str()); } } @@ -348,7 +348,7 @@ balance_t::operator amount_t() const std::ostringstream errmsg; errmsg << "Cannot convert a balance with " - << "multiple commodities to an amount: " << *this; + << "multiple commodities to an amount: " << temp; throw new amount_error(errmsg.str()); } } diff --git a/value.cc b/value.cc index a60de5bd..807926bc 100644 --- a/value.cc +++ b/value.cc @@ -694,14 +694,12 @@ bool value_t::operator OP(const value_t& value) \ return *((amount_t *) data) OP *((amount_t *) value.data); \ \ case BALANCE: \ - return (*((amount_t *) data) OP \ - ((balance_t *) value.data)-> \ - amount(((amount_t *) data)->commodity())); \ + return (balance_t(*((amount_t *) data)) OP \ + *((balance_t *) value.data)); \ \ case BALANCE_PAIR: \ - return (*((amount_t *) data) OP \ - ((balance_pair_t *) value.data)-> \ - quantity.amount(((amount_t *) data)->commodity())); \ + return (balance_t(*((amount_t *) data)) OP \ + *((balance_pair_t *) value.data)); \ \ default: \ assert(0); \ -- cgit v1.2.3