[Libreoffice-commits] core.git: dbaccess/source

Michael Weghorn m.weghorn at posteo.de
Mon Dec 8 19:21:21 PST 2014


 dbaccess/source/ui/dlg/ConnectionHelper.cxx        |    3 +--
 dbaccess/source/ui/dlg/queryfilter.cxx             |    5 ++---
 dbaccess/source/ui/dlg/tablespage.cxx              |    6 ++----
 dbaccess/source/ui/misc/WCPage.cxx                 |    3 +--
 dbaccess/source/ui/querydesign/JoinTableView.cxx   |    3 +--
 dbaccess/source/ui/querydesign/querycontroller.cxx |    2 +-
 dbaccess/source/ui/tabledesign/TEditControl.cxx    |    3 +--
 dbaccess/source/ui/tabledesign/TableController.cxx |    3 +--
 8 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 141469eb831c054d6f4b56fcaa50a03e52429f11
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Mon Dec 8 21:09:53 2014 +0100

    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 at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 33863aa..7649be1 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 7c3ad25..1274a03 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 9b8104c..ce9da40 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 ae647cf..5d2b824 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 8f6dc07..f622e3e 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 1b66601da..f3b0251 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 a9af7d9..ce169f3 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 ef36c4d..a8acd04 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 )
             {


More information about the Libreoffice-commits mailing list