mirror of https://github.com/AxioDL/tinyxml2.git
Reuse code for error clearing
This commit is contained in:
parent
f80d78d938
commit
0d2cef0cba
|
@ -1955,9 +1955,7 @@ void XMLDocument::Clear()
|
|||
#ifdef DEBUG
|
||||
const bool hadError = Error();
|
||||
#endif
|
||||
_errorID = XML_SUCCESS;
|
||||
_errorStr1.Reset();
|
||||
_errorStr2.Reset();
|
||||
ClearError();
|
||||
|
||||
delete [] _charBuffer;
|
||||
_charBuffer = 0;
|
||||
|
@ -2162,7 +2160,7 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
|
|||
{
|
||||
// Clear any error from the last save, otherwise it will get reported
|
||||
// for *this* call.
|
||||
SetError(XML_SUCCESS, 0, 0);
|
||||
ClearError();
|
||||
XMLPrinter stream( fp, compact );
|
||||
Print( &stream );
|
||||
return _errorID;
|
||||
|
|
|
@ -1740,6 +1740,10 @@ public:
|
|||
|
||||
void SetError( XMLError error, const char* str1, const char* str2 );
|
||||
|
||||
void ClearError() {
|
||||
SetError(XML_SUCCESS, 0, 0);
|
||||
}
|
||||
|
||||
/// Return true if there was an error parsing the document.
|
||||
bool Error() const {
|
||||
return _errorID != XML_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue