fix the output length returned from cWC2MB/MB2WC() to be consistent with From/ToWChar(); fix off by NUL-length bug in wxMBConv implementation of From/ToWChar() in terms of legacy WC2MB/MB2WC() (which are still used in wxMBConv_wxwin) that this uncovered; added a simple test for the bugs the old code resulted in which could be easily seen with wxConvISO8859_1 (see #9739)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -95,15 +95,18 @@ public:
|
||||
// Convenience functions for converting strings which may contain embedded
|
||||
// NULs and don't have to be NUL-terminated.
|
||||
//
|
||||
// inLen is the length of the buffer including trailing NUL if any: if the
|
||||
// last 4 bytes of the buffer are all NULs, these functions are more
|
||||
// efficient as they avoid copying the string, but otherwise a copy is made
|
||||
// internally which could be quite bad for (very) long strings.
|
||||
// inLen is the length of the buffer including trailing NUL if any or
|
||||
// wxNO_LEN if the input is NUL-terminated.
|
||||
//
|
||||
// outLen receives, if not NULL, the length of the converted string or 0 if
|
||||
// the conversion failed (returning 0 and not -1 in this case makes it
|
||||
// difficult to distinguish between failed conversion and empty input but
|
||||
// this is done for backwards compatibility)
|
||||
// this is done for backwards compatibility). Notice that the rules for
|
||||
// whether outLen accounts or not for the last NUL are the same as for
|
||||
// To/FromWChar() above: if inLen is specified, outLen is exactly the
|
||||
// number of characters converted, whether the last one of them was NUL or
|
||||
// not. But if inLen == wxNO_LEN then outLen doesn't account for the last
|
||||
// NUL even though it is present.
|
||||
const wxWCharBuffer
|
||||
cMB2WC(const char *in, size_t inLen, size_t *outLen) const;
|
||||
const wxCharBuffer
|
||||
|
Reference in New Issue
Block a user