fixed FromAscii() changes to correctly handle embedded NULs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
75ce4cb180
commit
602a857b25
@ -980,19 +980,18 @@ wxString wxString::FromAscii(const char *ascii, size_t len)
|
|||||||
|
|
||||||
wxString res;
|
wxString res;
|
||||||
|
|
||||||
wxImplStringBuffer buf(res, len);
|
|
||||||
wxStringCharType *dest = buf;
|
|
||||||
|
|
||||||
for ( ;; )
|
|
||||||
{
|
{
|
||||||
unsigned char c = (unsigned char)*ascii++;
|
wxImplStringBuffer buf(res, len);
|
||||||
wxASSERT_MSG( c < 0x80,
|
wxStringCharType *dest = buf;
|
||||||
_T("Non-ASCII value passed to FromAscii().") );
|
|
||||||
|
|
||||||
*dest++ = (wchar_t)c;
|
for ( ; len > 0; --len )
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char)*ascii++;
|
||||||
|
wxASSERT_MSG( c < 0x80,
|
||||||
|
_T("Non-ASCII value passed to FromAscii().") );
|
||||||
|
|
||||||
if ( c == '\0' )
|
*dest++ = (wchar_t)c;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user