summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-19 20:54:19 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-19 20:54:19 -0400
commit9d4f8392632481ce5e174a4ebe52d4cb339b95dc (patch)
tree8832073e43e605792098a7b20aaaaee6f881603e
parent7e2af9b73d8ce594ef0a4d9dee0d940809ef4b6a (diff)
downloadfork-ledger-9d4f8392632481ce5e174a4ebe52d4cb339b95dc.tar.gz
fork-ledger-9d4f8392632481ce5e174a4ebe52d4cb339b95dc.tar.bz2
fork-ledger-9d4f8392632481ce5e174a4ebe52d4cb339b95dc.zip
the QIF parser was too order dependent
-rw-r--r--qif.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/qif.cc b/qif.cc
index 77dc791a..64c4223e 100644
--- a/qif.cc
+++ b/qif.cc
@@ -31,6 +31,10 @@ unsigned int parse_qif_file(std::istream& in, journal_t * journal,
account_t * misc = journal->find_account("Miscellaneous");
unsigned int count;
+ entry.reset(new entry_t);
+ xact = new transaction_t(master);
+ entry->add_transaction(xact);
+
path = journal->sources.back();
linenum = 1;
@@ -65,10 +69,6 @@ unsigned int parse_qif_file(std::istream& in, journal_t * journal,
break;
case 'D':
- entry.reset(new entry_t);
- xact = new transaction_t(master);
- entry->add_transaction(xact);
-
in >> line;
if (! parse_date(line, &entry->date))
throw parse_error(path, linenum, "Failed to parse date");
@@ -150,6 +150,10 @@ unsigned int parse_qif_file(std::istream& in, journal_t * journal,
if (journal->add_entry(entry.release()))
count++;
+
+ entry.reset(new entry_t);
+ xact = new transaction_t(master);
+ entry->add_transaction(xact);
break;
}
}