Allow passing NULL buffer to wx{,F}File::{Read,Write} when count==0.
If the count of bytes to read or write is 0, the buffer pointer value shouldn't matter as it's not used at all anyhow, so relax the assert and allow it to be NULL in this case. Closes #16018. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -325,6 +325,9 @@ bool wxFile::ReadAll(wxString *str, const wxMBConv& conv)
|
||||
// read
|
||||
ssize_t wxFile::Read(void *pBuf, size_t nCount)
|
||||
{
|
||||
if ( !nCount )
|
||||
return 0;
|
||||
|
||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||
|
||||
ssize_t iRc = wxRead(m_fd, pBuf, nCount);
|
||||
@@ -341,6 +344,9 @@ ssize_t wxFile::Read(void *pBuf, size_t nCount)
|
||||
// write
|
||||
size_t wxFile::Write(const void *pBuf, size_t nCount)
|
||||
{
|
||||
if ( !nCount )
|
||||
return 0;
|
||||
|
||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||
|
||||
ssize_t iRc = wxWrite(m_fd, pBuf, nCount);
|
||||
|
Reference in New Issue
Block a user