From e2120257dda4d91b48bb031a96edda810ce30dfb Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 30 Sep 2008 12:49:34 +0000 Subject: Changed SAXParser parse method to take a buffer and a size instead of a c++ string. Made the queryhandler use a read loop, parsing on-the-fly to determine when the entire document has been read. --- server/src/queryparser.cc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'server/src/queryparser.cc') diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc index 0135515..abb41b5 100644 --- a/server/src/queryparser.cc +++ b/server/src/queryparser.cc @@ -26,14 +26,10 @@ */ #include "queryparser.h" -QueryParser::QueryParser(std::string document) +QueryParser::QueryParser() { - this->document = document; this->timestamp = 0; - // Make sure we always contain a valid xml document. - if(this->document == "") this->document = ""; - p = 0; stack.push_back(&result); } @@ -72,15 +68,6 @@ void QueryParser::endTag(std::string name) if(name == "group") stack.pop_back(); } -// FIXME: This is *not* the optimal way to do this. -int QueryParser::readData(char *data, size_t size) -{ - size_t len = document.size() - p < size ? document.size() - p : size; - strncpy(data, document.c_str() + p, len); - p += len; - 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()); -- cgit v1.2.3