From: Ryan Norton Date: Thu, 28 Oct 2004 23:01:46 +0000 (+0000) Subject: increase worst case to *4 for UTF8, switch a memcpy for wxMemcpy X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/44d271da3e837a8176561807da7f78e9862a2356 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 --- diff --git a/src/common/string.cpp b/src/common/string.cpp index b03a8229e7..9c6c1b19fb 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -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(