diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-08 00:19:48 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:40 -0400 |
commit | ee4a16743960122bf2b626f62827b7332680ebf5 (patch) | |
tree | dab8682d742718a86f0529dd86a0c832ffeb0102 /src/xmlparse.cc | |
parent | 30978b7fe5ee93413b2e05b54942f6550832b222 (diff) | |
download | ledger-ee4a16743960122bf2b626f62827b7332680ebf5.tar.gz ledger-ee4a16743960122bf2b626f62827b7332680ebf5.tar.bz2 ledger-ee4a16743960122bf2b626f62827b7332680ebf5.zip |
Corrected memory crashes when running the register command.
Diffstat (limited to 'src/xmlparse.cc')
-rw-r--r-- | src/xmlparse.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/xmlparse.cc b/src/xmlparse.cc index 34a16124..ff724dfe 100644 --- a/src/xmlparse.cc +++ b/src/xmlparse.cc @@ -329,25 +329,25 @@ void xml_write_value(std::ostream& out, const value_t& value, switch (value.type) { case value_t::BOOLEAN: for (int i = 0; i < depth + 2; i++) out << ' '; - out << "<boolean>" << *((bool *) value.data) << "</boolean>\n"; + out << "<boolean>" << value.as_boolean() << "</boolean>\n"; break; case value_t::INTEGER: for (int i = 0; i < depth + 2; i++) out << ' '; - out << "<integer>" << *((long *) value.data) << "</integer>\n"; + out << "<integer>" << value.as_long() << "</integer>\n"; break; case value_t::AMOUNT: - xml_write_amount(out, *((amount_t *) value.data), depth + 2); + xml_write_amount(out, value.as_amount(), depth + 2); break; case value_t::BALANCE: - bal = (balance_t *) value.data; + bal = &value.as_balance(); // fall through... case value_t::BALANCE_PAIR: if (! bal) - bal = &((balance_pair_t *) value.data)->quantity; + bal = &value.as_balance_pair()->quantity; for (int i = 0; i < depth + 2; i++) out << ' '; out << "<balance>\n"; |