Commit faa80596 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

utils: File: Save one useless loop iteration on EOF

parent e229a807
Pipeline #12598 passed with stage
in 29 minutes and 3 seconds
...@@ -71,6 +71,7 @@ bool copy( const std::string& from, const std::string& to ) ...@@ -71,6 +71,7 @@ bool copy( const std::string& from, const std::string& to )
return false; return false;
unsigned char buff[4096]; unsigned char buff[4096];
size_t nbRead; size_t nbRead;
do do
{ {
nbRead = fread( buff, 1, 4096, input.get() ); nbRead = fread( buff, 1, 4096, input.get() );
...@@ -82,8 +83,7 @@ bool copy( const std::string& from, const std::string& to ) ...@@ -82,8 +83,7 @@ bool copy( const std::string& from, const std::string& to )
} }
if ( fwrite( buff, 1, nbRead, output.get() ) == 0 ) if ( fwrite( buff, 1, nbRead, output.get() ) == 0 )
return false; return false;
} while ( feof( input.get() ) == 0 );
} while ( nbRead > 0 );
return true; return true;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment