X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bba85010a3d174d43c82c1450b72d744baefafd6..3316192f0d8a79103271a48cf293a338ba817975:/src/msw/ole/oleutils.cpp diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index c596c2bc1c..cd7dd75edc 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -80,19 +80,22 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr) if ( !bStr ) return wxString(); + const int len = SysStringLen(bStr); + #if wxUSE_UNICODE - wxString str(bStr); + wxString str(bStr, len); #else wxString str; - const int len = SysStringLen(bStr) + 1; - if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */, - bStr, len, - wxStringBuffer(str, len), len, - NULL, NULL /* no default char */) ) + if (len) { - str.clear(); + wxStringBufferLength buf(str, len); // asserts if len == 0 + buf.SetLength(WideCharToMultiByte(CP_ACP, 0 /* no flags */, + bStr, len /* not necessarily NUL-terminated */, + buf, len, + NULL, NULL /* no default char */)); } #endif + return str; } @@ -127,7 +130,7 @@ wxBasicString::~wxBasicString() // Debug support // ---------------------------------------------------------------------------- -#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ > 1000) ) || defined(__MWERKS__) ) +#if wxDEBUG_LEVEL && ( ( defined(__VISUALC__) && (__VISUALC__ > 1000) ) || defined(__MWERKS__) ) static wxString GetIidName(REFIID riid) { // an association between symbolic name and numeric value of an IID @@ -137,7 +140,7 @@ static wxString GetIidName(REFIID riid) }; // construct the table containing all known interfaces - #define ADD_KNOWN_IID(name) { &IID_I##name, _T(#name) } + #define ADD_KNOWN_IID(name) { &IID_I##name, wxT(#name) } static const KNOWN_IID aKnownIids[] = { ADD_KNOWN_IID(AdviseSink), @@ -255,31 +258,10 @@ void wxLogRelease(const wxChar *szInterface, ULONG cRef) wxLogTrace(wxTRACE_OleCalls, wxT("After %s::Release: m_cRef = %d"), szInterface, cRef - 1); } -#elif defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ <= 1000) +#endif // wxDEBUG_LEVEL -// For VC++ 4 -void wxLogQueryInterface(const char *szInterface, REFIID riid) -{ - wxLogTrace("%s::QueryInterface", szInterface); -} +#endif // wxUSE_DRAG_AND_DROP -void wxLogAddRef(const char *szInterface, ULONG cRef) -{ - wxLogTrace("After %s::AddRef: m_cRef = %d", szInterface, cRef + 1); -} +#endif // __CYGWIN10__ -void wxLogRelease(const char *szInterface, ULONG cRef) -{ - wxLogTrace("After %s::Release: m_cRef = %d", szInterface, cRef - 1); -} - -#endif // __WXDEBUG__ - -#endif - // wxUSE_DRAG_AND_DROP - -#endif - // __CYGWIN10__ - -#endif - // wxUSE_OLE +#endif // wxUSE_OLE