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:
@@ -2439,15 +2439,22 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
do
|
for ( ;; )
|
||||||
{
|
{
|
||||||
stream.Read(buf, WXSIZEOF(buf));
|
stream.Read(buf, WXSIZEOF(buf));
|
||||||
|
|
||||||
const size_t nRead = stream.LastRead();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
while ( !stream.Eof() );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user