Pārlūkot izejas kodu

Merge pull request #191 from Dmitry-Me/dontIgnoreFgetcReturnValue

fgetc() is not required to clear the error indicator on success
Lee Thomason 11 gadi atpakaļ
vecāks
revīzija
fca00d0ebc
1 mainītis faili ar 1 papildinājumiem un 2 dzēšanām
  1. 1 2
      tinyxml2.cpp

+ 1 - 2
tinyxml2.cpp

@@ -1689,8 +1689,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
     Clear();
     Clear();
 
 
     fseek( fp, 0, SEEK_SET );
     fseek( fp, 0, SEEK_SET );
-    fgetc( fp );
-    if ( ferror( fp ) != 0 ) {
+    if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) {
         SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
         SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
         return _errorID;
         return _errorID;
     }
     }