summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-14 16:57:29 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-16 14:19:22 +0000
commit8b7198f68f956106827161d7b9abe07c47026f00 (patch)
tree7e58c15d4b0825a844951cc74eaeaa4a003312ac
parentclang-cl loplugin: desktop (diff)
downloadcore-8b7198f68f956106827161d7b9abe07c47026f00.tar.gz
core-8b7198f68f956106827161d7b9abe07c47026f00.zip
clang-cl loplugin: dbaccess
Change-Id: I96982e5298783384c2978056af7955d012289f25 Reviewed-on: https://gerrit.libreoffice.org/29872 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx8
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx14
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx8
-rw-r--r--dbaccess/source/ui/dlg/adodatalinks.cxx48
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx5
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.cxx6
-rw-r--r--dbaccess/win32/source/odbcconfig/odbcconfig.cxx34
7 files changed, 59 insertions, 64 deletions
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 7526a6a3e31d..a1f5ccf4ebe6 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -195,16 +195,16 @@ OGenericUnoController::OGenericUnoController(const Reference< XComponentContext
OGenericUnoController::OGenericUnoController()
:OGenericUnoController_Base( getMutex() )
- ,m_pView(NULL)
+ ,m_pView(nullptr)
#ifdef DBG_UTIL
,m_bDescribingSupportedFeatures( false )
#endif
,m_aAsyncInvalidateAll(LINK(this, OGenericUnoController, OnAsyncInvalidateAll))
,m_aAsyncCloseTask(LINK(this, OGenericUnoController, OnAsyncCloseTask))
,m_aCurrentFrame( *this )
- ,m_bPreview(sal_False)
- ,m_bReadOnly(sal_False)
- ,m_bCurrentlyModified(sal_False)
+ ,m_bPreview(false)
+ ,m_bReadOnly(false)
+ ,m_bCurrentlyModified(false)
{
SAL_WARN("dbaccess.ui", "OGenericUnoController::OGenericUnoController: illegal call!" );
// This ctor only exists because the MSVC compiler complained about an unresolved external
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 3a16604e8544..5911c6e0eb88 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -60,14 +60,10 @@
#include <tools/diagnose_ex.h>
#include <sfx2/docfilt.hxx>
-#if defined(_WIN32)
-#define _ADO_DATALINK_BROWSE_
-#endif
-
-#ifdef _ADO_DATALINK_BROWSE_
+#if defined _WIN32
#include <vcl/sysdata.hxx>
#include "adodatalinks.hxx"
-#endif //_ADO_DATALINK_BROWSE_
+#endif
#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
#include <comphelper/processfactory.hxx>
@@ -266,17 +262,17 @@ namespace dbaui
return;
}
break;
-#ifdef _ADO_DATALINK_BROWSE_
+#if defined _WIN32
case ::dbaccess::DST_ADO:
{
OUString sOldDataSource=getURLNoPrefix();
OUString sNewDataSource;
HWND hWnd = GetParent()->GetSystemData()->hWnd;
- sNewDataSource = getAdoDatalink((LONG_PTR)hWnd,sOldDataSource);
+ sNewDataSource = getAdoDatalink(reinterpret_cast<LONG_PTR>(hWnd),sOldDataSource);
if ( !sNewDataSource.isEmpty() )
{
setURLNoPrefix(sNewDataSource);
- SetRoadmapStateValue(sal_True);
+ SetRoadmapStateValue(true);
callModifiedHdl();
}
else
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 7bef896839f6..fa8d31fbfcd3 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -59,15 +59,11 @@
#include <connectivity/CommonTools.hxx>
#include <sfx2/docfilt.hxx>
#include "dsnItem.hxx"
-#if defined(_WIN32)
-#define _ADO_DATALINK_BROWSE_
-#endif
-#ifdef _ADO_DATALINK_BROWSE_
+#if defined _WIN32
#include <vcl/sysdata.hxx>
#include "adodatalinks.hxx"
-#endif //_ADO_DATALINK_BROWSE_
-
+#endif
namespace dbaui
{
diff --git a/dbaccess/source/ui/dlg/adodatalinks.cxx b/dbaccess/source/ui/dlg/adodatalinks.cxx
index 37a3bc30f108..b945c434d2aa 100644
--- a/dbaccess/source/ui/dlg/adodatalinks.cxx
+++ b/dbaccess/source/ui/dlg/adodatalinks.cxx
@@ -43,7 +43,7 @@ const CLSID CLSID_DataLinks = { 0x2206CDB2, 0x19C1, 0x11D1, { 0x89, 0xE0, 0x00,
#endif
-BSTR PromptEdit(long hWnd,BSTR connstr);
+OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr);
BSTR PromptNew(long hWnd);
OUString getAdoDatalink(long hWnd,OUString& oldLink)
@@ -51,7 +51,7 @@ OUString getAdoDatalink(long hWnd,OUString& oldLink)
OUString dataLink;
if (!oldLink.isEmpty())
{
- dataLink=reinterpret_cast<sal_Unicode *>(PromptEdit(hWnd,(BSTR)oldLink.getStr()));
+ dataLink=PromptEdit(hWnd,oldLink.getStr());
}
else
dataLink=reinterpret_cast<sal_Unicode *>(PromptNew(hWnd));
@@ -60,22 +60,22 @@ OUString getAdoDatalink(long hWnd,OUString& oldLink)
BSTR PromptNew(long hWnd)
{
- BSTR connstr=NULL;
+ BSTR connstr=nullptr;
HRESULT hr;
- IDataSourceLocator* dlPrompt = NULL;
- ADOConnection* piTmpConnection = NULL;
- BSTR _result=NULL;
+ IDataSourceLocator* dlPrompt = nullptr;
+ ADOConnection* piTmpConnection = nullptr;
+ BSTR _result=nullptr;
// Initialize COM
- ::CoInitialize( NULL );
+ ::CoInitialize( nullptr );
// Instantiate DataLinks object.
hr = CoCreateInstance(
CLSID_DataLinks, //clsid -- Data Links UI
- NULL, //pUnkOuter
+ nullptr, //pUnkOuter
CLSCTX_INPROC_SERVER, //dwClsContext
IID_IDataSourceLocator, //riid
- (void**)&dlPrompt //ppvObj
+ reinterpret_cast<void**>(&dlPrompt) //ppvObj
);
if( FAILED( hr ) )
{
@@ -90,7 +90,7 @@ BSTR PromptNew(long hWnd)
}
// Prompt for connection information.
- hr = dlPrompt->PromptNew((IDispatch **)&piTmpConnection);
+ hr = dlPrompt->PromptNew(reinterpret_cast<IDispatch **>(&piTmpConnection));
if( FAILED( hr ) || !piTmpConnection )
{
@@ -112,21 +112,21 @@ BSTR PromptNew(long hWnd)
return _result;
}
-BSTR PromptEdit(long hWnd,BSTR connstr)
+OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr)
{
HRESULT hr;
- IDataSourceLocator* dlPrompt = NULL;
- ADOConnection* piTmpConnection = NULL;
- BSTR _result=NULL;
+ IDataSourceLocator* dlPrompt = nullptr;
+ ADOConnection* piTmpConnection = nullptr;
+ BSTR _result=nullptr;
// Initialize COM
- ::CoInitialize( NULL );
+ ::CoInitialize( nullptr );
hr = CoCreateInstance(CLSID_CADOConnection,
- NULL,
+ nullptr,
CLSCTX_INPROC_SERVER,
IID_IADOConnection,
- (LPVOID *)&piTmpConnection);
+ reinterpret_cast<LPVOID *>(&piTmpConnection));
if( FAILED( hr ) )
{
piTmpConnection->Release( );
@@ -134,7 +134,7 @@ BSTR PromptEdit(long hWnd,BSTR connstr)
}
- hr = piTmpConnection->put_ConnectionString(connstr);
+ hr = piTmpConnection->put_ConnectionString(const_cast<BSTR>(connstr));
if( FAILED( hr ) )
{
piTmpConnection->Release( );
@@ -144,10 +144,10 @@ BSTR PromptEdit(long hWnd,BSTR connstr)
// Instantiate DataLinks object.
hr = CoCreateInstance(
CLSID_DataLinks, //clsid -- Data Links UI
- NULL, //pUnkOuter
+ nullptr, //pUnkOuter
CLSCTX_INPROC_SERVER, //dwClsContext
IID_IDataSourceLocator, //riid
- (void**)&dlPrompt //ppvObj
+ reinterpret_cast<void**>(&dlPrompt) //ppvObj
);
if( FAILED( hr ) )
{
@@ -167,8 +167,8 @@ BSTR PromptEdit(long hWnd,BSTR connstr)
VARIANT_BOOL pbSuccess;
// Prompt for connection information.
- hr = dlPrompt->PromptEdit((IDispatch **)&piTmpConnection,&pbSuccess);
- if( SUCCEEDED( hr ) && sal_False == pbSuccess ) //if user press cancel then sal_False == pbSuccess
+ hr = dlPrompt->PromptEdit(reinterpret_cast<IDispatch **>(&piTmpConnection),&pbSuccess);
+ if( SUCCEEDED( hr ) && !pbSuccess ) //if user press cancel then sal_False == pbSuccess
{
piTmpConnection->Release( );
dlPrompt->Release( );
@@ -179,8 +179,8 @@ BSTR PromptEdit(long hWnd,BSTR connstr)
{
// Prompt for new connection information.
piTmpConnection->Release( );
- piTmpConnection = NULL;
- hr = dlPrompt->PromptNew((IDispatch **)&piTmpConnection);
+ piTmpConnection = nullptr;
+ hr = dlPrompt->PromptNew(reinterpret_cast<IDispatch **>(&piTmpConnection));
if( FAILED( hr ) || !piTmpConnection )
{
dlPrompt->Release( );
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index 4042b4635f71..29c5a9314ef8 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -79,6 +79,9 @@ void ODatasourceSelectDialog::dispose()
m_pDatasource.clear();
m_pOk.clear();
m_pCancel.clear();
+#if defined HAVE_ODBC_ADMINISTRATION
+ m_pManageDatasources.clear();
+#endif
ModalDialog::dispose();
}
@@ -93,7 +96,7 @@ bool ODatasourceSelectDialog::Close()
{
#ifdef HAVE_ODBC_ADMINISTRATION
if ( m_pODBCManagement.get() && m_pODBCManagement->isRunning() )
- return sal_False;
+ return false;
#endif
return ModalDialog::Close();
diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index cd90b3a1b24c..cd1b583e1840 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -238,7 +238,7 @@ public:
}
protected:
- virtual void SAL_CALL run()
+ virtual void SAL_CALL run() override
{
osl_setThreadName("dbaui::ProcessTerminationWait");
@@ -271,8 +271,8 @@ bool OOdbcManagement::manageDataSources_async()
// (and note this whole functionality is supported on Windows only, ATM)
OUString sExecutableName( "$BRAND_BASE_DIR/" LIBO_LIBEXEC_FOLDER "/odbcconfig.exe" );
::rtl::Bootstrap::expandMacros( sExecutableName ); //TODO: detect failure
- oslProcess hProcessHandle(0);
- oslProcessError eError = osl_executeProcess( sExecutableName.pData, NULL, 0, 0, NULL, NULL, NULL, 0, &hProcessHandle );
+ oslProcess hProcessHandle(nullptr);
+ oslProcessError eError = osl_executeProcess( sExecutableName.pData, nullptr, 0, 0, nullptr, nullptr, nullptr, 0, &hProcessHandle );
if ( eError != osl_Process_E_None )
return false;
diff --git a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
index ef82f546e097..4805d16053c6 100644
--- a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
+++ b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
@@ -50,16 +50,16 @@ int displayLastError()
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
+ nullptr,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
+ reinterpret_cast<LPTSTR>(&lpMsgBuf),
0,
- NULL
+ nullptr
);
// Display the string.
- MessageBox( NULL, (LPCTSTR)lpMsgBuf, NULL, MB_OK | MB_ICONERROR );
+ MessageBox( nullptr, static_cast<LPCTSTR>(lpMsgBuf), nullptr, MB_OK | MB_ICONERROR );
// Free the buffer.
LocalFree( lpMsgBuf );
@@ -79,12 +79,12 @@ BOOL registerWindowClass( HINSTANCE _hAppInstance )
wcx.cbClsExtra = 0; // no extra class memory
wcx.cbWndExtra = 0; // no extra window memory
wcx.hInstance = _hAppInstance; // handle to instance
- wcx.hIcon = NULL; // predefined app. icon
- wcx.hCursor = NULL; // predefined arrow
- wcx.hbrBackground = NULL; // no background brush
- wcx.lpszMenuName = NULL; // name of menu resource
+ wcx.hIcon = nullptr; // predefined app. icon
+ wcx.hCursor = nullptr; // predefined arrow
+ wcx.hbrBackground = nullptr; // no background brush
+ wcx.lpszMenuName = nullptr; // name of menu resource
wcx.lpszClassName = L"ODBCConfigMainClass"; // name of window class
- wcx.hIconSm = NULL; // small class icon
+ wcx.hIconSm = nullptr; // small class icon
return ( !!RegisterClassEx( &wcx ) );
}
@@ -100,10 +100,10 @@ HWND initInstance( HINSTANCE _hAppInstance )
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
- (HWND) NULL, // no owner window
- (HMENU) NULL, // use class menu
+ nullptr, // no owner window
+ nullptr, // use class menu
_hAppInstance, // handle to application instance
- (LPVOID) NULL); // no window-creation data
+ nullptr); // no window-creation data
// don't show the window, we only need it as parent handle for the
// SQLManageDataSources function
@@ -125,16 +125,16 @@ extern "C" int APIENTRY _tWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPTSTR, i
return displayLastError();
HMODULE hModule = LoadLibraryW( ODBC_UI_LIB_NAME );
- if ( hModule == NULL )
- hModule = LoadLibraryExW( ODBC_UI_LIB_NAME, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
- if ( hModule == NULL )
+ if ( hModule == nullptr )
+ hModule = LoadLibraryExW( ODBC_UI_LIB_NAME, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
+ if ( hModule == nullptr )
return displayLastError();
FARPROC pManageDSProc = GetProcAddress( hModule, "SQLManageDataSources" );
- if ( pManageDSProc == NULL )
+ if ( pManageDSProc == nullptr )
return displayLastError();
- TSQLManageDataSource pManageDS = (TSQLManageDataSource)pManageDSProc;
+ TSQLManageDataSource pManageDS = reinterpret_cast<TSQLManageDataSource>(pManageDSProc);
if ( !( (*pManageDS)( hAppWindow ) ) )
return displayLastError();