diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index 5bce2f3062..21bf29fb17 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -70,38 +70,38 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr) // ---------------------------------------------------------------------------- // wxBasicString // ---------------------------------------------------------------------------- -void wxBasicString::AssignFromString(const wxString& str) -{ - SysFreeString(m_bstrBuf); - m_bstrBuf = SysAllocString(str.wc_str(*wxConvCurrent)); -} - -BSTR wxBasicString::Detach() -{ - BSTR bstr = m_bstrBuf; - - m_bstrBuf = NULL; - - return bstr; +void wxBasicString::AssignFromString(const wxString& str) +{ + SysFreeString(m_bstrBuf); + m_bstrBuf = SysAllocString(str.wc_str(*wxConvCurrent)); } -BSTR* wxBasicString::ByRef() -{ +BSTR wxBasicString::Detach() +{ + BSTR bstr = m_bstrBuf; + + m_bstrBuf = NULL; + + return bstr; +} + +BSTR* wxBasicString::ByRef() +{ wxASSERT_MSG(!m_bstrBuf, - wxS("Can't get direct access to initialized BSTR")); - return &m_bstrBuf; + wxS("Can't get direct access to initialized BSTR")); + return &m_bstrBuf; } wxBasicString& wxBasicString::operator=(const wxBasicString& src) { - if ( this != &src ) - { - wxCHECK_MSG(m_bstrBuf == NULL || m_bstrBuf != src.m_bstrBuf, - *this, wxS("Attempting to assign already owned BSTR")); - SysFreeString(m_bstrBuf); - m_bstrBuf = src.Copy(); - } - + if ( this != &src ) + { + wxCHECK_MSG(m_bstrBuf == NULL || m_bstrBuf != src.m_bstrBuf, + *this, wxS("Attempting to assign already owned BSTR")); + SysFreeString(m_bstrBuf); + m_bstrBuf = src.Copy(); + } + return *this; }