From 08e7f7be59d1f026bd91dffa47f0307c180a2df6 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 31 Jul 2014 15:19:14 +0400 Subject: [PATCH] fgetc() is not required to clear the error indicator on success --- tinyxml2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 927ec6f..25691b9 100755 --- a/tinyxml2.cpp +++ b/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; }