Browse Source

tighten up the error checks

Lee Thomason 10 years ago
parent
commit
7a93b33160
2 changed files with 3 additions and 3 deletions
  1. 1 1
      tinyxml2.cpp
  2. 2 2
      xmltest.cpp

+ 1 - 1
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;

+ 2 - 2
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 --------------