[ wxwindows-Patches-1886062 ] Correct handling of BSTR in wxConvertStringFromOle

SourceForge.net noreply at sourceforge.net
Mon Feb 4 00:10:10 PST 2008


Patches item #1886062, was opened at 2008-02-04 06:00
Message generated for change (Comment added) made by vadz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1886062&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: MSW specific
Group: bug fix
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Hartmut Seichter (retrakker)
Assigned to: Nobody/Anonymous (nobody)
Summary: Correct handling of BSTR in wxConvertStringFromOle

Initial Comment:
MSDN describes:

typedef OLECHAR * BSTR;

These strings are zero-terminated, and in most cases they can be treated just like OLECHAR* strings. However, you can query a BSTR for its length rather than scan it, so it can contain embedded null characters.


Due to these embedded null characters using wcstombs will fail. The recommended way is to use WideCharToMultiByte.


----------------------------------------------------------------------

>Comment By: Vadim Zeitlin (vadz)
Date: 2008-02-04 09:10

Message:
Logged In: YES 
user_id=71618
Originator: NO

I've applied this patch (in a slightly modified form to avoid unnecessary
copy) and also modified the Unicode branch to use BSTR length too. We don't
have any test code for this (unfortunately... a unit test for this class
would definitely be very appreciated) so I'd be grateful if you could
verify that the latest code (either 2.8 branch or the trunk) works for you.
TIA!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1886062&group_id=9863




More information about the wx-dev mailing list