Replace calls to deprecated wxBasicString::Get() with calls to wxBasicString::Detach() which is not deprecated but also more efficient in cases like these.

This commit is contained in:
PB
2017-06-23 17:32:03 +02:00
parent 60563ce0ce
commit 9030d9390a
4 changed files with 22 additions and 28 deletions

View File

@@ -1127,7 +1127,7 @@ bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy)
if(pPlay)
{
pPlay->put_UseHTTPProxy(VARIANT_TRUE);
pPlay->put_HTTPProxyHost(wxBasicString(proxy.GetServer()).Get());
pPlay->put_HTTPProxyHost(wxBasicString(proxy.GetServer()).Detach());
pPlay->put_HTTPProxyPort(wxAtoi(proxy.GetPort()));
pPlay->Release();
}
@@ -1150,9 +1150,9 @@ bool wxAMMediaBackend::DoLoad(const wxString& location)
// the docs say its async and put_FileName is not -
// but in practice they both seem to be async anyway
if(GetMP())
hr = GetMP()->Open( wxBasicString(location).Get() );
hr = GetMP()->Open( wxBasicString(location).Detach() );
else
hr = GetAM()->put_FileName( wxBasicString(location).Get() );
hr = GetAM()->put_FileName( wxBasicString(location).Detach() );
if(FAILED(hr))
{

View File

@@ -909,17 +909,17 @@ bool wxWMP10MediaBackend::Load(const wxURI& location,
) == 0 &&
pWMPNetwork->setProxySettings(
wxBasicString(location.GetScheme()).Get(), // protocol
wxBasicString(location.GetScheme()).Detach(), // protocol
2) == 0) // 2 == manually specify
{
BSTR bsOldName = NULL;
long lOldPort = 0;
pWMPNetwork->getProxyName(
wxBasicString(location.GetScheme()).Get(),
wxBasicString(location.GetScheme()).Detach(),
&bsOldName);
pWMPNetwork->getProxyPort(
wxBasicString(location.GetScheme()).Get(),
wxBasicString(location.GetScheme()).Detach(),
&lOldPort);
long lPort;
@@ -936,11 +936,11 @@ bool wxWMP10MediaBackend::Load(const wxURI& location,
}
if( pWMPNetwork->setProxyName(
wxBasicString(location.GetScheme()).Get(), // proto
wxBasicString(location.GetScheme()).Detach(), // proto
wxBasicString(server).Get() ) == 0 &&
pWMPNetwork->setProxyPort(
wxBasicString(location.GetScheme()).Get(), // proto
wxBasicString(location.GetScheme()).Detach(), // proto
lPort
) == 0
)
@@ -948,16 +948,16 @@ bool wxWMP10MediaBackend::Load(const wxURI& location,
bOK = DoLoad(location.BuildURI());
pWMPNetwork->setProxySettings(
wxBasicString(location.GetScheme()).Get(), // protocol
wxBasicString(location.GetScheme()).Detach(), // protocol
lOldSetting);
if(bsOldName)
pWMPNetwork->setProxyName(
wxBasicString(location.GetScheme()).Get(), // protocol
wxBasicString(location.GetScheme()).Detach(), // protocol
bsOldName);
if(lOldPort)
pWMPNetwork->setProxyPort(
wxBasicString(location.GetScheme()).Get(), // protocol
wxBasicString(location.GetScheme()).Detach(), // protocol
lOldPort);
pWMPNetwork->Release();
@@ -1012,7 +1012,7 @@ bool wxWMP10MediaBackend::DoLoad(const wxString& location)
#endif
{
// just load it the "normal" way
hr = m_pWMPPlayer->put_URL( wxBasicString(location).Get() );
hr = m_pWMPPlayer->put_URL( wxBasicString(location).Detach() );
}
if(FAILED(hr))
@@ -1061,12 +1061,12 @@ bool wxWMP10MediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
if(!flags)
{
m_pWMPPlayer->put_enabled(VARIANT_FALSE);
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("none")).Get());
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("none")).Detach());
}
else
{
// TODO: use "custom"? (note that CE only supports none/full)
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("full")).Get());
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("full")).Detach());
m_pWMPPlayer->put_enabled(VARIANT_TRUE);
}
@@ -1358,7 +1358,7 @@ wxLongLong wxWMP10MediaBackend::GetDownloadTotal()
if(m_pWMPPlayer->get_currentMedia(&pWMPMedia) == 0)
{
BSTR bsOut;
pWMPMedia->getItemInfo(wxBasicString(wxT("FileSize")).Get(),
pWMPMedia->getItemInfo(wxBasicString(wxT("FileSize")).Detach(),
&bsOut);
wxString sFileSize = wxConvertStringFromOle(bsOut);

View File

@@ -938,8 +938,7 @@ STDMETHODIMP wxIAccessible::get_accDefaultAction ( VARIANT varID, BSTR* pszDefau
}
else
{
wxBasicString basicString(defaultAction);
* pszDefaultAction = basicString.Get();
* pszDefaultAction = wxBasicString(defaultAction).Detach();
return S_OK;
}
}
@@ -999,8 +998,7 @@ STDMETHODIMP wxIAccessible::get_accDescription ( VARIANT varID, BSTR* pszDescrip
}
else
{
wxBasicString basicString(description);
* pszDescription = basicString.Get();
* pszDescription = wxBasicString(description).Detach();
return S_OK;
}
}
@@ -1060,8 +1058,7 @@ STDMETHODIMP wxIAccessible::get_accHelp ( VARIANT varID, BSTR* pszHelp)
}
else
{
wxBasicString basicString(helpString);
* pszHelp = basicString.Get();
* pszHelp = wxBasicString(helpString).Detach();
return S_OK;
}
}
@@ -1171,8 +1168,7 @@ STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKe
}
else
{
wxBasicString basicString(keyboardShortcut);
* pszKeyboardShortcut = basicString.Get();
* pszKeyboardShortcut = wxBasicString(keyboardShortcut).Detach();
return S_OK;
}
}
@@ -1235,8 +1231,7 @@ STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName)
}
else
{
wxBasicString basicString(name);
*pszName = basicString.Get();
*pszName = wxBasicString(name).Detach();
}
return S_OK;
}
@@ -1416,8 +1411,7 @@ STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue)
}
else
{
wxBasicString basicString(strValue);
* pszValue = basicString.Get();
* pszValue = wxBasicString(strValue).Detach();
return S_OK;
}
}

View File

@@ -38,7 +38,7 @@
WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str)
{
return wxBasicString(str).Get();
return wxBasicString(str).Detach();
}
WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)