summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--balance.cc12
-rw-r--r--value.cc10
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); \