summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-08 09:39:25 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-08 15:11:42 +0200
commita551290fc46d5f91b89615700c88b863a403bc7a (patch)
treee970b942c3fdcdc0033f0b29b9ef633b3e0b9d56 /dbaccess
parent4fc4e24fb0ac549b7684aac8e020253c0cc76603 (diff)
WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: Ia64d863baa72a2d32a8bee40968af4f6aacd88bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167332 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/column.cxx2
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx2
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx6
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx20
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnectionData.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowTitle.cxx2
10 files changed, 23 insertions, 23 deletions
diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx
index 58a8c1649cea..15378e22fd82 100644
--- a/dbaccess/source/core/api/column.cxx
+++ b/dbaccess/source/core/api/column.cxx
@@ -186,7 +186,7 @@ void OColumns::append( const OUString& _rName, OColumn* _pColumn )
{
MutexGuard aGuard(m_rMutex);
- OSL_ENSURE( _pColumn, "OColumns::append: invalid column!" );
+ assert(_pColumn && "OColumns::append: invalid column!");
OSL_ENSURE( !m_pElements->exists( _rName ),"OColumns::append: Column already exists");
_pColumn->m_sName = _rName;
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 2162c07240cb..0a25d603d4f1 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -509,7 +509,7 @@ ODsnTypeCollection::TypeIterator::TypeIterator(const ODsnTypeCollection* _pConta
:m_pContainer(_pContainer)
,m_nPosition(_nInitialPos)
{
- OSL_ENSURE(m_pContainer, "ODsnTypeCollection::TypeIterator::TypeIterator : invalid container!");
+ assert(m_pContainer && "ODsnTypeCollection::TypeIterator::TypeIterator : invalid container!");
#if OSL_DEBUG_LEVEL > 0
++const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators;
#endif
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index bb226afc669f..e8c6f007719e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1055,7 +1055,7 @@ OUString SbaTableQueryBrowser::getDataSourceAccessor(const weld::TreeIter& rData
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry));
- OSL_ENSURE( pData, "SbaTableQueryBrowser::getDataSourceAccessor: invalid entry data!" );
+ assert(pData && "SbaTableQueryBrowser::getDataSourceAccessor: invalid entry data!");
OSL_ENSURE( pData->eType == etDatasource, "SbaTableQueryBrowser::getDataSourceAccessor: entry does not denote a data source!" );
return !pData->sAccessor.isEmpty() ? pData->sAccessor : GetEntryText(rDataSourceEntry);
}
@@ -2253,7 +2253,7 @@ bool SbaTableQueryBrowser::ensureEntryObject(const weld::TreeIter& rEntry)
// the user data of the entry
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
- OSL_ENSURE(pEntryData,"ensureEntryObject: user data should already be set!");
+ assert(pEntryData && "ensureEntryObject: user data should already be set!");
std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(&rEntry);
@@ -2759,7 +2759,7 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted(const ContainerEvent& rEvent
// insert the new entry into the tree
DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xEntry));
- OSL_ENSURE(pContainerData, "elementInserted: There must be user data for this type!");
+ assert(pContainerData && "elementInserted: There must be user data for this type!");
DBTreeListUserData* pNewData = new DBTreeListUserData;
bool bIsTable = etTableContainer == pContainerData->eType;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 90ca68f2d3d5..d1cbaa964c0a 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -431,9 +431,9 @@ Reference< XPropertySet > const & ODbDataSourceAdministrationHelper::getCurrentD
OUString ODbDataSourceAdministrationHelper::getDatasourceType( const SfxItemSet& _rSet )
{
const SfxStringItem* pConnectURL = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
- OSL_ENSURE( pConnectURL , "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
+ assert(pConnectURL && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
const DbuTypeCollectionItem* pTypeCollection = _rSet.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
- OSL_ENSURE(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
+ assert(pTypeCollection && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
return pCollection->getType(pConnectURL->GetValue());
}
@@ -452,10 +452,10 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
const SfxStringItem* pUrlItem = m_pItemSetHelper->getOutputSet()->GetItem<SfxStringItem>(DSID_CONNECTURL);
const DbuTypeCollectionItem* pTypeCollection = m_pItemSetHelper->getOutputSet()->GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
- OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
- OSL_ENSURE(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
+ assert(pUrlItem && "Connection URL is NULL. -> GPF!");
+ assert(pTypeCollection && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
- OSL_ENSURE(pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
+ assert(pCollection && "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
switch( pCollection->determineType(eType) )
{
@@ -961,7 +961,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
TypeDescription aTD(_rValue.getValueType());
typelib_IndirectTypeDescription* pSequenceTD =
reinterpret_cast< typelib_IndirectTypeDescription* >(aTD.get());
- OSL_ENSURE(pSequenceTD && pSequenceTD->pType, "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence type!");
+ assert(pSequenceTD && pSequenceTD->pType && "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence type!");
Type aElementType(pSequenceTD->pType);
switch (aElementType.getTypeClass())
@@ -996,7 +996,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet
OUString ODbDataSourceAdministrationHelper::getDocumentUrl(SfxItemSet const & _rDest)
{
const SfxStringItem* pUrlItem = _rDest.GetItem<SfxStringItem>(DSID_DOCUMENT_URL);
- OSL_ENSURE(pUrlItem,"Document URL is NULL. -> GPF!");
+ assert(pUrlItem && "Document URL is NULL. -> GPF!");
return pUrlItem->GetValue();
}
@@ -1007,10 +1007,10 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
const SfxStringItem* pUrlItem = _rDest.GetItem<SfxStringItem>(DSID_CONNECTURL);
const DbuTypeCollectionItem* pTypeCollection = _rDest.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
- OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
- OSL_ENSURE(pTypeCollection, "ODbAdminDialog::getDatasourceType: invalid items in the source set!");
+ assert(pUrlItem && "Connection URL is NULL. -> GPF!");
+ assert(pTypeCollection && "ODbAdminDialog::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
- OSL_ENSURE(pCollection, "ODbAdminDialog::getDatasourceType: invalid type collection!");
+ assert(pCollection && "ODbAdminDialog::getDatasourceType: invalid type collection!");
TypedWhichId<SfxInt32Item> nPortNumberId(0);
sal_Int32 nPortNumber = -1;
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index fe6eb7fd62de..07891f773cfd 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -207,7 +207,7 @@ namespace
iter.next( aCurrentElement );
const SQLException* pCurrentError = aCurrentElement;
- OSL_ENSURE( pCurrentError, "lcl_buildExceptionChain: iterator failure!" );
+ assert(pCurrentError && "lcl_buildExceptionChain: iterator failure!");
// hasMoreElements should not have returned <TRUE/> in this case
ExceptionDisplayInfo aDisplayInfo( aCurrentElement.getType() );
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
index ce66828facb5..a42d65508008 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
@@ -87,8 +87,8 @@ void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft
// convert Information in rDrag into parameters for the base class init
OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow());
OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow());
- OSL_ENSURE(pSourceWin,"NO Source window found!");
- OSL_ENSURE(pDestWin,"NO Dest window found!");
+ assert(pSourceWin && "NO Source window found!");
+ assert(pDestWin && "NO Dest window found!");
m_pReferencingTable = pSourceWin->GetData();
m_pReferencedTable = pDestWin->GetData();
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 93cbf6026d4c..ed490860c3ea 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -110,7 +110,7 @@ void OQueryTableWindow::OnEntryDoubleClicked(weld::TreeIter& rEntry)
weld::TreeView& rTreeView = m_xListBox->get_widget();
OTableFieldInfo* pInf = weld::fromId<OTableFieldInfo*>(rTreeView.get_id(rEntry));
- OSL_ENSURE(pInf != nullptr, "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
+ assert(pInf && "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
// build up DragInfo
OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), rTreeView.get_text(rEntry));
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 108d36fd5729..47c7a996be94 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -309,7 +309,7 @@ namespace
const OQueryTableWindow* _pEntryTabTo,
OUString& _rJoin )
{
- OSL_ENSURE(_pEntryConn,"TableConnection can not be null!");
+ assert(_pEntryConn && "TableConnection can not be null!");
OQueryTableConnectionData* pData = static_cast< OQueryTableConnectionData*>(_pEntryConn->GetData().get());
if ( !(pData->GetJoinType() != INNER_JOIN && _pEntryTabTo->ExistsAVisitedConn()) )
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 663d3a9e65a6..f48dc17c7a3a 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -496,7 +496,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
if ( pTabWinTmp->GetData()->isQuery() )
continue;
- OSL_ENSURE(pTabWinTmp,"TableWindow is null!");
+ assert(pTabWinTmp && "TableWindow is null!");
Reference< XPropertySet > xFKKey = getKeyReferencedTo( pTabWinTmp->GetData()->getKeys(), pNewTabWin->GetComposedName() );
if ( !xFKKey.is() )
continue;
@@ -751,7 +751,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
{
VclPtr<OTableConnection> xTmpEntry = *aIter2;
OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(xTmpEntry.get());
- OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
+ assert(pTmpEntry && "OQueryTableConnection is null!");
if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() ||
pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() )
{
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 0e3ad0573c7f..2990a010298b 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -64,7 +64,7 @@ IMPL_LINK(OTableWindowTitle, MousePressHdl, const MouseEvent&, rEvt, bool)
m_pTabWin->SetSizePixel(aSize);
OJoinTableView* pView = m_pTabWin->getTableView();
- OSL_ENSURE(pView,"No OJoinTableView!");
+ assert(pView && "No OJoinTableView!");
for (auto& conn : pView->getTableConnections())
conn->RecalcLines();