minor bit twiddling

This commit is contained in:
John Wiegley 2005-03-08 16:08:59 +00:00
parent d790a3ad60
commit b671d2934b
4 changed files with 10 additions and 10 deletions

View file

@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT(ledger, 2.2, johnw@newartisans.com) AC_INIT(ledger, 2.3, johnw@newartisans.com)
AM_INIT_AUTOMAKE(ledger, 2.2) AM_INIT_AUTOMAKE(ledger, 2.3)
AC_CONFIG_SRCDIR([main.cc]) AC_CONFIG_SRCDIR([main.cc])
AC_CONFIG_HEADER([acconf.h]) AC_CONFIG_HEADER([acconf.h])

View file

@ -286,8 +286,8 @@ static void dataHandler(void *userData, const char *s, int len)
bool gnucash_parser_t::test(std::istream& in) const bool gnucash_parser_t::test(std::istream& in) const
{ {
char buf[128]; char buf[5];
in.getline(buf, 127); in.read(buf, 5);
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);
return std::strncmp(buf, "<?xml", 5) == 0; return std::strncmp(buf, "<?xml", 5) == 0;

6
ofx.cc
View file

@ -174,9 +174,9 @@ int ofx_proc_status_cb(struct OfxStatusData data, void * status_data)
bool ofx_parser_t::test(std::istream& in) const bool ofx_parser_t::test(std::istream& in) const
{ {
char buf[256]; char buf[80];
in.getline(buf, 255); in.getline(buf, 79);
if (std::strncmp(buf, "OFXHEADER", 9) == 0) { if (std::strncmp(buf, "OFXHEADER", 9) == 0) {
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);
return true; return true;
@ -186,7 +186,7 @@ bool ofx_parser_t::test(std::istream& in) const
return false; return false;
} }
in.getline(buf, 255); in.getline(buf, 79);
if (std::strncmp(buf, "<?OFX", 5) != 0 && if (std::strncmp(buf, "<?OFX", 5) != 0 &&
std::strncmp(buf, "<?ofx", 5) != 0) { std::strncmp(buf, "<?ofx", 5) != 0) {
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

6
xml.cc
View file

@ -134,15 +134,15 @@ static void dataHandler(void *userData, const char *s, int len)
bool xml_parser_t::test(std::istream& in) const bool xml_parser_t::test(std::istream& in) const
{ {
char buf[256]; char buf[80];
in.getline(buf, 255); in.getline(buf, 79);
if (std::strncmp(buf, "<?xml", 5) != 0) { if (std::strncmp(buf, "<?xml", 5) != 0) {
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);
return false; return false;
} }
in.getline(buf, 255); in.getline(buf, 79);
if (! std::strstr(buf, "<ledger")) { if (! std::strstr(buf, "<ledger")) {
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);
return false; return false;