fix error handling in the generic branch of wxCopyFile()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-03-30 16:27:52 +00:00
parent 56ba039411
commit 853c39d78b

View File

@ -1120,18 +1120,17 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
// copy contents of file1 to file2
char buf[4096];
size_t count;
for ( ;; )
{
count = fileIn.Read(buf, WXSIZEOF(buf));
if ( fileIn.Error() )
ssize_t count = fileIn.Read(buf, WXSIZEOF(buf));
if ( count == wxInvalidOffset )
return false;
// end of file?
if ( !count )
break;
if ( fileOut.Write(buf, count) < count )
if ( fileOut.Write(buf, count) < (size_t)count )
return false;
}