increase worst case to *4 for UTF8, switch a memcpy for wxMemcpy

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2004-10-28 23:01:46 +00:00
parent 9266e0ecde
commit 44d271da3e

View File

@@ -273,7 +273,7 @@ bool wxStringBase::CopyBeforeWrite()
// allocation failures are handled by the caller
return false;
}
memcpy(m_pchData, pData->data(), nLen*sizeof(wxChar));
wxMemcpy(m_pchData, pData->data(), nLen);
}
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
@@ -1187,8 +1187,8 @@ wxString::wxString(const wchar_t *pwz, wxMBConv& conv, size_t nLength)
// anything to do?
if ( (nLen != 0) && (nLen != (size_t)-1) )
{
//*2 is the worst case - probably for UTF8
wxStringBufferLength internalBuffer(*this, (nLen << 1) + 1);
//*4 is the worst case - for UTF8
wxStringBufferLength internalBuffer(*this, (nLen << 2) + 1);
//Do the actual conversion & Set the length of the buffer
internalBuffer.SetLength(