Applied patch [ 1263950 ] wxConnection fixes for Unicode

By Jurgen Doornik


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-09-11 18:31:34 +00:00
parent 41884be320
commit 9d86099269
7 changed files with 772 additions and 272 deletions

View File

@@ -30,10 +30,10 @@ IMPLEMENT_CLASS(wxServerBase, wxObject)
IMPLEMENT_CLASS(wxClientBase, wxObject)
IMPLEMENT_CLASS(wxConnectionBase, wxObject)
wxConnectionBase::wxConnectionBase(wxChar *buffer, int size)
wxConnectionBase::wxConnectionBase(wxChar *buffer, int bytes)
: m_connected(true),
m_buffer(buffer),
m_buffersize(size),
m_buffersize(bytes),
m_deletebufferwhendone(false)
{
if ( buffer == (wxChar *)NULL )
@@ -80,7 +80,10 @@ wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
{ // we're in charge of buffer, increase it
if ( m_buffer )
delete m_buffer;
m_buffer = new wxChar[bytes];
// the argument specifies **byte size**, but m_buffer is of type
// wxChar. Under unicode: sizeof(wxChar) > 1, so the buffer size is
// bytes / sizeof(wxChar) rounded upwards.
m_buffer = new wxChar[(bytes + sizeof(wxChar) - 1) / sizeof(wxChar)];
m_buffersize = bytes;
return m_buffer;
} // user-supplied buffer, fail