mirror of https://github.com/AxioDL/tinyxml2.git
Merge pull request #104 from Vasily-Biryukov/master
LoadFile() returns XML_NO_ERROR for empty documents
This commit is contained in:
commit
761c4c2ed5
|
@ -1608,6 +1608,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
||||||
fseek( fp, 0, SEEK_SET );
|
fseek( fp, 0, SEEK_SET );
|
||||||
|
|
||||||
if ( size == 0 ) {
|
if ( size == 0 ) {
|
||||||
|
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
|
||||||
return _errorID;
|
return _errorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1158,6 +1158,13 @@ int main( int argc, const char ** argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
XMLDocument doc;
|
||||||
|
XMLError error = doc.LoadFile( "resources/empty.xml" );
|
||||||
|
XMLTest( "Loading an empty file", XML_ERROR_EMPTY_DOCUMENT, error );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------- Performance tracking --------------
|
// ----------- Performance tracking --------------
|
||||||
{
|
{
|
||||||
#if defined( _MSC_VER )
|
#if defined( _MSC_VER )
|
||||||
|
|
Loading…
Reference in New Issue