summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binary.cc1
-rw-r--r--gnucash.cc1
-rw-r--r--ofx.cc4
-rw-r--r--qif.cc1
-rw-r--r--textual.cc1
-rw-r--r--xml.cc3
6 files changed, 11 insertions, 0 deletions
diff --git a/binary.cc b/binary.cc
index 367e4e75..4953cf7e 100644
--- a/binary.cc
+++ b/binary.cc
@@ -489,6 +489,7 @@ bool binary_parser_t::test(std::istream& in) const
read_binary_number<unsigned long>(in) == format_version)
return true;
+ in.clear();
in.seekg(0, std::ios::beg);
return false;
}
diff --git a/gnucash.cc b/gnucash.cc
index 49e12117..02e5b477 100644
--- a/gnucash.cc
+++ b/gnucash.cc
@@ -345,6 +345,7 @@ bool gnucash_parser_t::test(std::istream& in) const
{
char buf[5];
in.read(buf, 5);
+ in.clear();
in.seekg(0, std::ios::beg);
return std::strncmp(buf, "<?xml", 5) == 0;
diff --git a/ofx.cc b/ofx.cc
index 731105a5..5eed5c64 100644
--- a/ofx.cc
+++ b/ofx.cc
@@ -172,10 +172,12 @@ bool ofx_parser_t::test(std::istream& in) const
in.getline(buf, 79);
if (std::strncmp(buf, "OFXHEADER", 9) == 0) {
+ in.clear();
in.seekg(0, std::ios::beg);
return true;
}
else if (std::strncmp(buf, "<?xml", 5) != 0) {
+ in.clear();
in.seekg(0, std::ios::beg);
return false;
}
@@ -183,10 +185,12 @@ bool ofx_parser_t::test(std::istream& in) const
in.getline(buf, 79);
if (std::strncmp(buf, "<?OFX", 5) != 0 &&
std::strncmp(buf, "<?ofx", 5) != 0) {
+ in.clear();
in.seekg(0, std::ios::beg);
return false;
}
+ in.clear();
in.seekg(0, std::ios::beg);
return true;
}
diff --git a/qif.cc b/qif.cc
index 52ed6d48..429bdcc9 100644
--- a/qif.cc
+++ b/qif.cc
@@ -30,6 +30,7 @@ bool qif_parser_t::test(std::istream& in) const
char magic[sizeof(unsigned int) + 1];
in.read(magic, sizeof(unsigned int));
magic[sizeof(unsigned int)] = '\0';
+ in.clear();
in.seekg(0, std::ios::beg);
return (std::strcmp(magic, "!Typ") == 0 ||
diff --git a/textual.cc b/textual.cc
index 37373baa..9fb383ca 100644
--- a/textual.cc
+++ b/textual.cc
@@ -457,6 +457,7 @@ bool textual_parser_t::test(std::istream& in) const
#endif
}
+ in.clear();
in.seekg(0, std::ios::beg);
assert(in.good());
return true;
diff --git a/xml.cc b/xml.cc
index 4bebbf44..380416ed 100644
--- a/xml.cc
+++ b/xml.cc
@@ -158,16 +158,19 @@ bool xml_parser_t::test(std::istream& in) const
in.getline(buf, 79);
if (std::strncmp(buf, "<?xml", 5) != 0) {
+ in.clear();
in.seekg(0, std::ios::beg);
return false;
}
in.getline(buf, 79);
if (! std::strstr(buf, "<ledger")) {
+ in.clear();
in.seekg(0, std::ios::beg);
return false;
}
+ in.clear();
in.seekg(0, std::ios::beg);
return true;
}