summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-07-13 06:24:35 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:15 -0400
commitb22b655c34fd31a95993e8cf2ab7b03b67b25d78 (patch)
tree4271df7623fe1499b64f81accf6666dd99974f96
parentd4bdaa2d2b746fa400ae313b9655eefeb8094ad4 (diff)
downloadfork-ledger-b22b655c34fd31a95993e8cf2ab7b03b67b25d78.tar.gz
fork-ledger-b22b655c34fd31a95993e8cf2ab7b03b67b25d78.tar.bz2
fork-ledger-b22b655c34fd31a95993e8cf2ab7b03b67b25d78.zip
(parse): Removed some unnecessary code which was actually causing
price histories to be parsed wrong when compiler optimizations were used (at least on my machine).
-rw-r--r--textual.cc17
1 files changed, 2 insertions, 15 deletions
diff --git a/textual.cc b/textual.cc
index ab74dd81..de4d32e4 100644
--- a/textual.cc
+++ b/textual.cc
@@ -554,6 +554,8 @@ unsigned int textual_parser_t::parse(std::istream& in,
char * b = skip_ws(line + 1);
char * p = std::strchr(b, ' ');
if (! p) break;
+ p = std::strchr(skip_ws(p), ' ');
+ if (! p) break;
*p++ = '\0';
struct std::tm when;
@@ -563,21 +565,6 @@ unsigned int textual_parser_t::parse(std::istream& in,
throw parse_error(path, linenum, "Failed to parse date");
}
- int hour, min, sec;
-
- if (! *p) break; hour = (*p++ - '0') * 10;
- if (! *p) break; hour += *p++ - '0';
- p++; if (! *p) break;
- if (! *p) break; min = (*p++ - '0') * 10;
- if (! *p) break; min += *p++ - '0';
- p++; if (! *p) break;
- if (! *p) break; sec = (*p++ - '0') * 10;
- if (! *p) break; sec += *p++ - '0';
- p++; if (! *p) break;
-
- date = std::time_t(((unsigned long) date) +
- hour * 3600 + min * 60 + sec);
-
std::string symbol;
amount_t price;