fixed wxMBConv::cMB2WC and cWC2MB to check for conversion failure
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -177,9 +177,11 @@ const wxWCharBuffer wxMBConv::cMB2WC(const char *psz) const
|
|||||||
{
|
{
|
||||||
// now do the actual conversion
|
// now do the actual conversion
|
||||||
wxWCharBuffer buf(nLen);
|
wxWCharBuffer buf(nLen);
|
||||||
MB2WC(buf.data(), psz, nLen + 1); // with the trailing NUL
|
nLen = MB2WC(buf.data(), psz, nLen + 1); // with the trailing NULL
|
||||||
|
if ( nLen != (size_t)-1 )
|
||||||
return buf;
|
{
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,9 +198,11 @@ const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *pwz) const
|
|||||||
if ( nLen != (size_t)-1 )
|
if ( nLen != (size_t)-1 )
|
||||||
{
|
{
|
||||||
wxCharBuffer buf(nLen+3); // space for a wxUint32 trailing zero
|
wxCharBuffer buf(nLen+3); // space for a wxUint32 trailing zero
|
||||||
WC2MB(buf.data(), pwz, nLen + 4);
|
nLen = WC2MB(buf.data(), pwz, nLen + 4);
|
||||||
|
if ( nLen != (size_t)-1 )
|
||||||
return buf;
|
{
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user