don't fail in wxTransferStreamToFile if file size is exact multiple of 4KB (bug 1835918)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
47b6fabc7d
commit
07f87b6b2e
@ -2439,15 +2439,22 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
|
||||
return false;
|
||||
|
||||
char buf[4096];
|
||||
do
|
||||
for ( ;; )
|
||||
{
|
||||
stream.Read(buf, WXSIZEOF(buf));
|
||||
|
||||
const size_t nRead = stream.LastRead();
|
||||
if ( !nRead || !file.Write(buf, nRead) )
|
||||
if ( !nRead )
|
||||
{
|
||||
if ( stream.Eof() )
|
||||
break;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !file.Write(buf, nRead) )
|
||||
return false;
|
||||
}
|
||||
while ( !stream.Eof() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user