fix beg_line bug

This commit is contained in:
Levin Du 2008-07-29 17:37:35 +08:00
parent 7dfa17b260
commit bffdc6431d
2 changed files with 6 additions and 5 deletions

View file

@ -13,7 +13,7 @@ void format_emacs_transactions::write_entry(entry_t& entry)
break;
}
out << (((unsigned long)entry.beg_line) + 1) << " ";
out << ((unsigned long)entry.beg_line) << " ";
std::time_t date = entry.date().when;
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
@ -47,7 +47,7 @@ void format_emacs_transactions::operator()(transaction_t& xact)
out << "\n";
}
out << " (" << (((unsigned long)xact.beg_line) + 1) << " ";
out << " (" << ((unsigned long)xact.beg_line) << " ";
out << "\"" << xact_account(xact)->fullname() << "\" \""
<< xact.amount << "\"";

View file

@ -509,7 +509,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
TIMER_START(entry_xacts);
unsigned long end_pos;
unsigned long beg_line = linenum;
unsigned long beg_line;
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
unsigned long beg_pos = (unsigned long)in.tellg();
@ -524,6 +524,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
line[--len] = '\0';
end_pos = beg_pos + len + 1;
beg_line = linenum;
linenum++;
if (line[0] == ' ' || line[0] == '\t') {
@ -698,7 +699,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
unsigned long beg_pos = in.tellg();
unsigned long end_pos;
unsigned long beg_line = linenum;
unsigned long beg_line;
while (in.good() && ! in.eof()) {
try {
@ -711,6 +712,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
line[--len] = '\0';
end_pos = beg_pos + len + 1;
beg_line = linenum;
linenum++;
switch (line[0]) {
@ -951,7 +953,6 @@ unsigned int textual_parser_t::parse(std::istream& in,
}
default: {
unsigned int first_line = linenum;
unsigned long pos = beg_pos;
if (entry_t * entry =
parse_entry(in, line, account_stack.front(), *this, pos)) {