From 7a93b33160dedbce228b3a35851e520f6ecd84aa Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Fri, 22 May 2015 11:00:32 -0700 Subject: [PATCH] tighten up the error checks --- tinyxml2.cpp | 2 +- xmltest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 81296e6..cefd22d 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1857,7 +1857,7 @@ XMLError XMLDocument::LoadFile( FILE* fp ) return _errorID; } - if ( filelength >= (size_t)-1 ) { + if ( (size_t)filelength >= (size_t)-1 ) { // Cannot handle files which won't fit in buffer together with null terminator SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); return _errorID; diff --git a/xmltest.cpp b/xmltest.cpp index 7a6d866..f3fa7b2 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -1474,9 +1474,9 @@ int main( int argc, const char ** argv ) doc.Parse(xml0); XMLTest("Test that the code changes do not affect normal parsing", doc.Error(), false); doc.Parse(xml1); - XMLTest("Test that the second declaration throws an error", doc.Error(), true); + XMLTest("Test that the second declaration throws an error", doc.ErrorID(), XML_ERROR_PARSING_DECLARATION); doc.Parse(xml2); - XMLTest("Test that declaration after a child throws an error", doc.Error(), true); + XMLTest("Test that declaration after a child throws an error", doc.ErrorID(), XML_ERROR_PARSING_DECLARATION); } // ----------- Performance tracking --------------