diff options
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llmetricperformancetester.cpp | 2 | ||||
| -rw-r--r-- | indra/llcommon/llsdserialize.h | 16 | ||||
| -rw-r--r-- | indra/llcommon/llsdserialize_xml.cpp | 18 | 
3 files changed, 22 insertions, 14 deletions
| diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 41d3eb0bf3..731e58bd20 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -100,7 +100,7 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i  	LLSD ret;  	LLSD cur; -	while (!is.eof() && LLSDSerialize::fromXML(cur, is)) +	while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))  	{  		for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter)  		{ diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 86e3fc864c..e7a5507385 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -300,7 +300,7 @@ public:  	/**   	 * @brief Constructor  	 */ -	LLSDXMLParser(); +	LLSDXMLParser(bool emit_errors=true);  protected:  	/**  @@ -747,25 +747,25 @@ public:  		return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY);  	} -	static S32 fromXMLEmbedded(LLSD& sd, std::istream& str) +	static S32 fromXMLEmbedded(LLSD& sd, std::istream& str, bool emit_errors=true)  	{  		// no need for max_bytes since xml formatting is not  		// subvertable by bad sizes. -		LLPointer<LLSDXMLParser> p = new LLSDXMLParser; +		LLPointer<LLSDXMLParser> p = new LLSDXMLParser(emit_errors);  		return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED);  	}  	// Line oriented parser, 30% faster than fromXML(), but can  	// only be used when you know you have the complete XML  	// document available in the stream. -	static S32 fromXMLDocument(LLSD& sd, std::istream& str) +	static S32 fromXMLDocument(LLSD& sd, std::istream& str, bool emit_errors=true)  	{ -		LLPointer<LLSDXMLParser> p = new LLSDXMLParser(); +		LLPointer<LLSDXMLParser> p = new LLSDXMLParser(emit_errors);  		return p->parseLines(str, sd);  	} -	static S32 fromXML(LLSD& sd, std::istream& str) +	static S32 fromXML(LLSD& sd, std::istream& str, bool emit_errors=true)  	{ -		return fromXMLEmbedded(sd, str); -//		return fromXMLDocument(sd, str); +		return fromXMLEmbedded(sd, str, emit_errors); +//		return fromXMLDocument(sd, str, emit_errors);  	}  	/* diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 34b3dbb99a..cef743a7be 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -250,7 +250,7 @@ std::string LLSDXMLFormatter::escapeString(const std::string& in)  class LLSDXMLParser::Impl  {  public: -	Impl(); +	Impl(bool emit_errors);  	~Impl();  	S32 parse(std::istream& input, LLSD& data); @@ -294,6 +294,7 @@ private:  	static const XML_Char* findAttribute(const XML_Char* name, const XML_Char** pairs); +	bool mEmitErrors;  	XML_Parser	mParser; @@ -315,7 +316,8 @@ private:  }; -LLSDXMLParser::Impl::Impl() +LLSDXMLParser::Impl::Impl(bool emit_errors) +	: mEmitErrors(emit_errors)  {  	mParser = XML_ParserCreate(NULL);  	reset(); @@ -402,7 +404,10 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)  		{  			((char*) buffer)[count ? count - 1 : 0] = '\0';  		} -		llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; +		if (mEmitErrors) +		{ +			llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; +		}  		data = LLSD();  		return LLSDParser::PARSE_FAILURE;  	} @@ -480,7 +485,10 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data)  	if (status == XML_STATUS_ERROR    		&& !mGracefullStop)  	{ -		llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; +		if (mEmitErrors) +		{ +			llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; +		}  		return LLSDParser::PARSE_FAILURE;  	} @@ -897,7 +905,7 @@ LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* na  /**   * LLSDXMLParser   */ -LLSDXMLParser::LLSDXMLParser() : impl(* new Impl) +LLSDXMLParser::LLSDXMLParser(bool emit_errors /* = true */) : impl(* new Impl(emit_errors))  {  } | 
