summaryrefslogtreecommitdiff
path: root/gnucash.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-10-02 00:07:14 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-10-02 00:07:14 +0000
commit2a1055890241b1299d8b91d65038d0f4f5067fb5 (patch)
tree97616b59a3139a591458e4ac95580fa6937c39b4 /gnucash.cc
parent3afa81857a688cb2eca56945dc5c40b9825b2e69 (diff)
downloadfork-ledger-2a1055890241b1299d8b91d65038d0f4f5067fb5.tar.gz
fork-ledger-2a1055890241b1299d8b91d65038d0f4f5067fb5.tar.bz2
fork-ledger-2a1055890241b1299d8b91d65038d0f4f5067fb5.zip
*** empty log message ***
Diffstat (limited to 'gnucash.cc')
-rw-r--r--gnucash.cc17
1 files changed, 5 insertions, 12 deletions
diff --git a/gnucash.cc b/gnucash.cc
index 357ba97d..a056b352 100644
--- a/gnucash.cc
+++ b/gnucash.cc
@@ -44,7 +44,7 @@ static void startElement(void *userData, const char *name, const char **atts)
{
if (std::strcmp(name, "gnc:account") == 0) {
assert(! curr_account);
- curr_account = new account(name);
+ curr_account = new account;
}
else if (std::strcmp(name, "act:name") == 0)
action = ACCOUNT_NAME;
@@ -111,14 +111,8 @@ static void endElement(void *userData, const char *name)
}
else if (std::strcmp(name, "gnc:transaction") == 0) {
assert(curr_entry);
- if (! curr_entry->validate()) {
- std::cerr << "Failed to balance the following transaction, "
- << "ending on line "
- << XML_GetCurrentLineNumber(current_parser) << std::endl;
- curr_entry->print(std::cerr);
- } else {
- main_ledger.entries.push_back(curr_entry);
- }
+ assert(curr_entry->validate());
+ main_ledger.entries.push_back(curr_entry);
curr_entry = NULL;
}
action = NO_ACTION;
@@ -195,7 +189,6 @@ static void dataHandler(void *userData, const char *s, int len)
accounts_iterator i = accounts_by_id.find(std::string(s, len));
if (i == accounts_by_id.end()) {
std::cerr << "Could not find account " << std::string(s, len)
- << " at line " << XML_GetCurrentLineNumber(current_parser)
<< std::endl;
std::exit(1);
}
@@ -203,9 +196,9 @@ static void dataHandler(void *userData, const char *s, int len)
transaction * xact = curr_entry->xacts.back();
xact->acct = (*i).second;
- std::string value = curr_quant + " " + (*i).second->comm->symbol;
+ std::string value = curr_quant + " " + xact->acct->comm->symbol;
- if (curr_value->comm() == (*i).second->comm) {
+ if (curr_value->comm() == xact->acct->comm) {
// assert: value must be equal to curr_value.
delete curr_value;
curr_value = NULL;