From 6ac8f7b603a6135ff9eb7923e5e6027dbd89af56 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 5 Mar 2006 01:32:50 +0000 Subject: *** no comment *** --- amount.cc | 6 +++--- balance.cc | 15 ++------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/amount.cc b/amount.cc index 5de0264c..a2735d37 100644 --- a/amount.cc +++ b/amount.cc @@ -810,7 +810,7 @@ std::ostream& operator<<(std::ostream& _out, const amount_t& amt) } if (precision) { - out << ((comm.flags() & COMMODITY_STYLE_EUROPEAN) ? ',' : '.'); + out << ((comm.flags & COMMODITY_STYLE_EUROPEAN) ? ',' : '.'); std::ostringstream final; final.width(precision); @@ -828,8 +828,8 @@ std::ostream& operator<<(std::ostream& _out, const amount_t& amt) if (i == len) out << str; - else if (i < comm.precision()) - out << std::string(str, 0, comm.precision()); + else if (i < comm.precision) + out << std::string(str, 0, comm.precision); else out << std::string(str, 0, i); } diff --git a/balance.cc b/balance.cc index 8ca49ea0..7337dda8 100644 --- a/balance.cc +++ b/balance.cc @@ -87,10 +87,7 @@ void balance_t::write(std::ostream& out, balance_t& balance_t::operator*=(const balance_t& bal) { - if (! *this || ! bal) { - return (*this = 0L); - } - else if (amounts.size() == 1 && bal.amounts.size() == 1) { + if (amounts.size() == 1 && bal.amounts.size() == 1) { return *this *= (*bal.amounts.begin()).second; } else { @@ -103,15 +100,7 @@ balance_t& balance_t::operator*=(const balance_t& bal) balance_t& balance_t::operator/=(const balance_t& bal) { - if (! *this) { - return (*this = 0L); - } - else if (! bal) { - std::ostringstream errmsg; - errmsg << "Attempt to divide by zero: " << *this << " / " << bal; - throw amount_error(errmsg.str()); - } - else if (amounts.size() == 1 && bal.amounts.size() == 1) { + if (amounts.size() == 1 && bal.amounts.size() == 1) { return *this /= (*bal.amounts.begin()).second; } else if (*this == bal) { -- cgit v1.2.3