Explorar o código

fgetc() is not required to clear the error indicator on success

Dmitry-Me %!s(int64=11) %!d(string=hai) anos
pai
achega
08e7f7be59
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      tinyxml2.cpp

+ 1 - 2
tinyxml2.cpp

@@ -1689,8 +1689,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
     Clear();
 
     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 );
         return _errorID;
     }