From 853c39d78bd252df042b45ed8046ba7a6ce230e4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 30 Mar 2007 16:27:52 +0000 Subject: [PATCH] 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 --- src/common/filefn.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 1a25881ada..42bbb0bf07 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -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; } -- 2.45.2