diff options
author | deva <deva> | 2008-05-20 14:03:10 +0000 |
---|---|---|
committer | deva <deva> | 2008-05-20 14:03:10 +0000 |
commit | 556f00e4af55e78836c45f47b0662ab44bbb8b48 (patch) | |
tree | a5c315b35d400a397a35a86b86fe656d3a829af9 /server/src/queryparser.cc | |
parent | 91d56787bec83a3a7c2ad6afd84d2b82c5d869b9 (diff) |
Made fixes pointed out by GCC 4.2 and -D_FORTIFY_SOURCES=2
Diffstat (limited to 'server/src/queryparser.cc')
-rw-r--r-- | server/src/queryparser.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc index 9649f1f..889810f 100644 --- a/server/src/queryparser.cc +++ b/server/src/queryparser.cc @@ -29,6 +29,10 @@ QueryParser::QueryParser(std::string document) { this->document = document; + + // Make sure we always contain a valid xml document. + if(this->document == "") this->document = "<xml></xml>"; + p = 0; stack.push_back(&result); } @@ -62,6 +66,15 @@ int QueryParser::readData(char *data, size_t size) return len; } +void QueryParser::parseError(char *buf, size_t len, std::string error, int lineno) +{ + fprintf(stderr, "QueryParser error at line %d: %s\n", lineno, error.c_str()); + fprintf(stderr, "\tBuffer %u bytes: [", len); + if(fwrite(buf, len, 1, stderr) != len) {} + fprintf(stderr, "]\n"); + fflush(stderr); +} + #ifdef TEST_QUERYPARSER #include "queryhandler.h" |