diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-08 21:09:53 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-12-09 03:20:51 +0000 |
commit | 141469eb831c054d6f4b56fcaa50a03e52429f11 (patch) | |
tree | ce450b9ba8bfb5f601c439e7597882da4b6f95a3 /dbaccess | |
parent | 887cb59ac4bfca94f310baee3e9da58ccf9cb3e3 (diff) |
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I8931ff46394923d672e08b3a5c9ab75bb6ffb0a9
Reviewed-on: https://gerrit.libreoffice.org/13385
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/ConnectionHelper.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/queryfilter.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/tablespage.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCPage.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinTableView.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableController.cxx | 3 |
8 files changed, 10 insertions, 18 deletions
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 33863aa5c9a2..7649be117a50 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -534,7 +534,6 @@ namespace dbaui IS_PATH_EXIST OConnectionHelper::pathExists(const OUString& _rURL, bool bIsFile) const { ::ucbhelper::Content aCheckExistence; - bool bExists = false; IS_PATH_EXIST eExists = PATH_NOT_EXIST; Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler( task::InteractionHandler::createWithParent(m_xORB, 0), UNO_QUERY ); @@ -545,7 +544,7 @@ namespace dbaui try { aCheckExistence = ::ucbhelper::Content(_rURL, xCmdEnv, comphelper::getProcessComponentContext()); - bExists = bIsFile? aCheckExistence.isDocument(): aCheckExistence.isFolder(); + const bool bExists = bIsFile? aCheckExistence.isDocument(): aCheckExistence.isFolder(); eExists = bExists? PATH_EXIST: PATH_NOT_EXIST; } catch(const Exception&) diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 7c3ad2591b37..1274a03bf9b2 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -297,11 +297,11 @@ bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rComp,co try { OUString sTableName; - bool bFunction = false; _rFilter.Name = _rField.GetSelectEntry(); Reference< XPropertySet > xColumn = getQueryColumn(_rFilter.Name); if ( xColumn.is() ) { + bool bFunction = false; Reference< XPropertySetInfo > xInfo = xColumn->getPropertySetInfo(); if ( xInfo->hasPropertyByName(PROPERTY_REALNAME) ) { @@ -818,10 +818,9 @@ void DlgFilterCrit::fillLines(const Sequence<Sequence<PropertyValue > >& _aValue { const Sequence<PropertyValue >* pOrIter = _aValues.getConstArray(); const Sequence<PropertyValue >* pOrEnd = pOrIter + _aValues.getLength(); - bool bOr = true; for(sal_uInt16 i=0;pOrIter != pOrEnd; ++pOrIter) { - bOr = true; + bool bOr = true; const PropertyValue* pAndIter = pOrIter->getConstArray(); const PropertyValue* pAndEnd = pAndIter + pOrIter->getLength(); for(;pAndIter != pAndEnd; ++pAndIter) diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 9b8104c505ce..ce9da401bf1a 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -162,8 +162,6 @@ namespace dbaui OUString sCatalog, sSchema, sName; SvTreeListEntry* pRootEntry = m_pTablesList->getAllObjectsEntry(); - bool bAllTables = false; - bool bAllSchemas = false; const OUString* pIncludeTable = _rTables.getConstArray(); for (sal_Int32 i=0; i<_rTables.getLength(); ++i, ++pIncludeTable) @@ -173,8 +171,8 @@ namespace dbaui else sName = pIncludeTable->getStr(); - bAllTables = (1 == sName.getLength()) && ('%' == sName[0]); - bAllSchemas = (1 == sSchema.getLength()) && ('%' == sSchema[0]); + bool bAllTables = (1 == sName.getLength()) && ('%' == sName[0]); + bool bAllSchemas = (1 == sSchema.getLength()) && ('%' == sSchema[0]); // the catalog entry SvTreeListEntry* pCatalog = m_pTablesList->GetEntryPosByName(sCatalog, pRootEntry); diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index ae647cf79972..5d2b824df208 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -277,11 +277,10 @@ bool OCopyTable::checkAppendData() ODatabaseExport::TColumnVector::const_iterator aDestIter = rDestColumns.begin(); ODatabaseExport::TColumnVector::const_iterator aDestEnd = rDestColumns.end(); const sal_uInt32 nDestSize = rDestColumns.size(); - bool bNotConvert; sal_uInt32 i = 0; for(sal_Int32 nPos = 1;aDestIter != aDestEnd && i < nDestSize && i < nSrcSize;++aDestIter,++nPos,++i) { - bNotConvert = true; + bool bNotConvert = true; m_pParent->m_vColumnPos[i] = ODatabaseExport::TPositions::value_type(nPos,nPos); TOTypeInfoSP pTypeInfo = m_pParent->convertType((*aDestIter)->second->getSpecialTypeInfo(),bNotConvert); if ( !bNotConvert ) diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 8f6dc070876e..f622e3eac0b8 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -525,12 +525,11 @@ void OJoinTableView::SetDefaultTabWinPosSize( OTableWindow* pTabWin ) aRowRect.Bottom() = (nRow+1) * ( TABWIN_SPACING_Y + TABWIN_HEIGHT_STD ); // check occupied areas of this line - OTableWindow* pOtherTabWin; OTableWindowMap::iterator aIter = m_aTableMap.begin(); OTableWindowMap::iterator aEnd = m_aTableMap.end(); for(;aIter != aEnd;++aIter) { - pOtherTabWin = aIter->second; + OTableWindow* pOtherTabWin = aIter->second; Rectangle aOtherTabWinRect( pOtherTabWin->GetPosPixel(), pOtherTabWin->GetSizePixel() ); if( diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 1b66601dabbb..f3b025168a7d 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -1835,9 +1835,9 @@ void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings xProp->getPropertyValue( PROPERTY_COMMAND ) >>= sNewStatement; setStatement_fireEvent( sNewStatement ); - bool bNewEscapeProcessing( true ); if ( editingQuery() ) { + bool bNewEscapeProcessing( true ); xProp->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bNewEscapeProcessing; setEscapeProcessing_fireEvent( bNewEscapeProcessing ); } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index a9af7d9d0e6d..ce169f3837d2 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -488,11 +488,10 @@ sal_Int32 OTableEditorCtrl::HasFieldName( const OUString& rFieldName ) ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_pRowList->begin(); ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_pRowList->end(); - OFieldDescription* pFieldDescr; sal_Int32 nCount(0); for(;aIter != aEnd;++aIter) { - pFieldDescr = (*aIter)->GetActFieldDescr(); + OFieldDescription* pFieldDescr = (*aIter)->GetActFieldDescr(); if( pFieldDescr && bCase(rFieldName,pFieldDescr->GetName())) nCount++; } diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index ef36c4d13959..a8acd0408858 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -798,7 +798,6 @@ void OTableController::loadData() Reference<XColumnsSupplier> xColSup(m_xTable,UNO_QUERY); OSL_ENSURE(xColSup.is(),"No XColumnsSupplier!"); Reference<XNameAccess> xColumns = xColSup->getColumns(); - OFieldDescription* pActFieldDescr = NULL; // ReadOnly-Flag // For Drop no row may be editable // For Add only the empty rows may be editable @@ -855,7 +854,7 @@ void OTableController::loadData() pTypeInfo = m_pTypeInfo; pTabEdRow->SetFieldType( pTypeInfo, bForce ); - pActFieldDescr = pTabEdRow->GetActFieldDescr(); + OFieldDescription* pActFieldDescr = pTabEdRow->GetActFieldDescr(); OSL_ENSURE(pActFieldDescr, "OTableController::loadData: invalid field description generated by the table row!"); if ( pActFieldDescr ) { |