diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-10 10:14:55 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-10 10:14:55 +0200 |
commit | d3f7146db6854ea844856c0f93a7fc6fb62b71a1 (patch) | |
tree | c6d87d0ccf9590168eab20841be21d28c4e5b037 /dbaccess | |
parent | 248966215d5b6bcdf893bc603ede1d69e00ca17a (diff) |
Clean up uses of SAL_U/SAL_W: dbaccess
Change-Id: I08816442e63ccd33148d233f21f3d761bcdde13c
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/adodatalinks.cxx | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx index 1039923a2478..2613364bc8ef 100644 --- a/dbaccess/source/ui/dlg/adodatalinks.cxx +++ b/dbaccess/source/ui/dlg/adodatalinks.cxx @@ -37,24 +37,10 @@ #include "adodatalinks.hxx" -OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr); -BSTR PromptNew(long hWnd); +namespace { -OUString getAdoDatalink(long hWnd,OUString& oldLink) +OUString PromptNew(long hWnd) { - OUString dataLink; - if (!oldLink.isEmpty()) - { - dataLink=SAL_U(PromptEdit(hWnd,SAL_W(oldLink.getStr()))); - } - else - dataLink=reinterpret_cast<sal_Unicode *>(PromptNew(hWnd)); - return dataLink; -} - -BSTR PromptNew(long hWnd) -{ - BSTR connstr=nullptr; HRESULT hr; IDataSourceLocator* dlPrompt = nullptr; ADOConnection* piTmpConnection = nullptr; @@ -73,14 +59,14 @@ BSTR PromptNew(long hWnd) ); if( FAILED( hr ) ) { - return connstr; + return OUString(); } dlPrompt->put_hWnd(hWnd); if( FAILED( hr ) ) { dlPrompt->Release( ); - return connstr; + return OUString(); } // Prompt for connection information. @@ -89,7 +75,7 @@ BSTR PromptNew(long hWnd) if( FAILED( hr ) || !piTmpConnection ) { dlPrompt->Release( ); - return connstr; + return OUString(); } hr = piTmpConnection->get_ConnectionString(&_result); @@ -97,16 +83,16 @@ BSTR PromptNew(long hWnd) { piTmpConnection->Release( ); dlPrompt->Release( ); - return connstr; + return OUString(); } piTmpConnection->Release( ); dlPrompt->Release( ); CoUninitialize(); - return _result; + return OUString(reinterpret_cast<sal_Unicode const *>(_result)); } -OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr) +OUString PromptEdit(long hWnd, OUString const & connstr) { HRESULT hr; IDataSourceLocator* dlPrompt = nullptr; @@ -128,7 +114,8 @@ OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr) } - hr = piTmpConnection->put_ConnectionString(const_cast<BSTR>(connstr)); + hr = piTmpConnection->put_ConnectionString( + const_cast<BSTR>(reinterpret_cast<wchar_t const *>(connstr.getStr()))); if( FAILED( hr ) ) { piTmpConnection->Release( ); @@ -193,7 +180,21 @@ OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr) piTmpConnection->Release( ); dlPrompt->Release( ); CoUninitialize(); - return _result; + return OUString(reinterpret_cast<sal_Unicode const *>(_result)); +} + +} + +OUString getAdoDatalink(long hWnd,OUString& oldLink) +{ + OUString dataLink; + if (!oldLink.isEmpty()) + { + dataLink=PromptEdit(hWnd,oldLink); + } + else + dataLink=PromptNew(hWnd); + return dataLink; } #endif |