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:
@@ -273,7 +273,7 @@ bool wxStringBase::CopyBeforeWrite()
|
|||||||
// allocation failures are handled by the caller
|
// allocation failures are handled by the caller
|
||||||
return false;
|
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
|
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?
|
// anything to do?
|
||||||
if ( (nLen != 0) && (nLen != (size_t)-1) )
|
if ( (nLen != 0) && (nLen != (size_t)-1) )
|
||||||
{
|
{
|
||||||
//*2 is the worst case - probably for UTF8
|
//*4 is the worst case - for UTF8
|
||||||
wxStringBufferLength internalBuffer(*this, (nLen << 1) + 1);
|
wxStringBufferLength internalBuffer(*this, (nLen << 2) + 1);
|
||||||
|
|
||||||
//Do the actual conversion & Set the length of the buffer
|
//Do the actual conversion & Set the length of the buffer
|
||||||
internalBuffer.SetLength(
|
internalBuffer.SetLength(
|
||||||
|
Reference in New Issue
Block a user