Updated binary file version. (read_binary_journal): Read in the
"basket" account, if used. (write_binary_journal): Write out the "basket" account, if used.
This commit is contained in:
parent
75f110f842
commit
81e4851a6c
1 changed files with 10 additions and 1 deletions
11
binary.cc
11
binary.cc
|
|
@ -11,7 +11,7 @@
|
|||
namespace ledger {
|
||||
|
||||
static unsigned long binary_magic_number = 0xFFEED765;
|
||||
static unsigned long format_version = 0x00020034;
|
||||
static unsigned long format_version = 0x00020035;
|
||||
|
||||
static account_t ** accounts;
|
||||
static account_t ** accounts_next;
|
||||
|
|
@ -387,6 +387,8 @@ unsigned int read_binary_journal(std::istream& in,
|
|||
account_t::ident_t a_count = read_binary_number<account_t::ident_t>(data);
|
||||
accounts = accounts_next = new account_t *[a_count];
|
||||
journal->master = read_binary_account(data, journal, master);
|
||||
if (read_binary_number<bool>(data))
|
||||
journal->basket = read_binary_account(data, journal);
|
||||
|
||||
// Allocate the memory needed for the entries and transactions in
|
||||
// one large block, which is then chopped up and custom constructed
|
||||
|
|
@ -690,6 +692,13 @@ void write_binary_journal(std::ostream& out, journal_t * journal)
|
|||
write_binary_number<account_t::ident_t>(out, count_accounts(journal->master));
|
||||
write_binary_account(out, journal->master);
|
||||
|
||||
if (journal->basket) {
|
||||
write_binary_number<bool>(out, true);
|
||||
write_binary_account(out, journal->basket);
|
||||
} else {
|
||||
write_binary_number<bool>(out, false);
|
||||
}
|
||||
|
||||
// Write out the number of entries, transactions, and amounts
|
||||
|
||||
write_binary_number<unsigned long>(out, journal->entries.size());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue