[Libreoffice-commits] core.git: oox/source opencl/source package/source reportdesign/source sal/osl sal/rtl sax/source

Noel Grandin noel at peralex.com
Thu May 5 12:44:50 UTC 2016


 oox/source/drawingml/customshapegeometry.cxx              |    4 -
 oox/source/drawingml/fillpropertiesgroupcontext.cxx       |    8 +-
 oox/source/drawingml/shape.cxx                            |    6 +-
 oox/source/export/shapes.cxx                              |   12 ++--
 oox/source/vml/vmlshape.cxx                               |    6 +-
 opencl/source/openclwrapper.cxx                           |   11 +--
 package/source/manifest/ManifestImport.cxx                |    4 -
 package/source/zipapi/ZipOutputStream.cxx                 |    6 +-
 reportdesign/source/filter/xml/xmlExport.cxx              |    4 -
 reportdesign/source/ui/dlg/DateTime.cxx                   |    4 -
 reportdesign/source/ui/dlg/GroupsSorting.cxx              |   20 +++----
 reportdesign/source/ui/inspection/DataProviderHandler.cxx |    4 -
 reportdesign/source/ui/inspection/DefaultInspection.cxx   |    4 -
 reportdesign/source/ui/inspection/GeometryHandler.cxx     |    6 +-
 reportdesign/source/ui/misc/UITools.cxx                   |   10 +--
 reportdesign/source/ui/report/ReportController.cxx        |   40 +++++++-------
 reportdesign/source/ui/report/propbrw.cxx                 |    4 -
 sal/osl/unx/signal.cxx                                    |   28 ++++-----
 sal/rtl/hash.cxx                                          |    6 +-
 sax/source/tools/fastattribs.cxx                          |    4 -
 sax/source/tools/fastserializer.cxx                       |    6 +-
 21 files changed, 98 insertions(+), 99 deletions(-)

New commits:
commit f07ff7ed8a23b4982ed9cd7d9e2083c9d0928384
Author: Noel Grandin <noel at peralex.com>
Date:   Thu May 5 10:10:54 2016 +0200

    clang-tidy modernize-loop-convert in oox to sax
    
    Change-Id: If0d87b6679765fc6d1f9300c6972845cf3742b9c
    Reviewed-on: https://gerrit.libreoffice.org/24674
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx
index a29ea07..d019c9f 100644
--- a/oox/source/drawingml/customshapegeometry.cxx
+++ b/oox/source/drawingml/customshapegeometry.cxx
@@ -423,8 +423,8 @@ static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperti
     if ( !pCommandHashMap )
     {
         FormulaCommandHMap* pHM = new FormulaCommandHMap();
-        for( sal_Int32 i = 0; i < FC_LAST; i++ )
-            (*pHM)[ OUString::createFromAscii( pFormularCommandNameTable[ i ].pS ) ] =  pFormularCommandNameTable[ i ].pE;
+        for(const FormularCommandNameTable& i : pFormularCommandNameTable)
+            (*pHM)[ OUString::createFromAscii( i.pS ) ] =  i.pE;
         pCommandHashMap = pHM;
     }
 
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index 78d4b16..69175f4 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -360,13 +360,13 @@ ContextHandlerRef ArtisticEffectContext::onCreateContext(
             XML_size, XML_brushSize, XML_scaling, XML_detail, XML_bright, XML_contrast,
             XML_colorTemp, XML_sat, XML_amount
     };
-    for( sal_Int32 i=0; i<19; ++i )
+    for(sal_Int32 nAttrib : aAttribs)
     {
-        if( rAttribs.hasAttribute( aAttribs[i] ) )
+        if( rAttribs.hasAttribute( nAttrib ) )
         {
-            OUString sName = ArtisticEffectProperties::getEffectString( aAttribs[i] );
+            OUString sName = ArtisticEffectProperties::getEffectString( nAttrib );
             if( !sName.isEmpty() )
-                maEffect.maAttribs[sName] = uno::makeAny( rAttribs.getInteger( aAttribs[i], 0 ) );
+                maEffect.maAttribs[sName] = uno::makeAny( rAttribs.getInteger( nAttrib, 0 ) );
         }
     }
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fb5a30a..eb7a539 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -833,13 +833,13 @@ Reference< XShape > Shape::createAndInsert(
                     {
                         PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
                     };
-                    for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
+                    for (sal_Int32 nBorder : aBorders)
                     {
-                        css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<css::table::BorderLine2>();
+                        css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<css::table::BorderLine2>();
                         aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get<sal_Int32>();
                         if (aLineProperties.moLineWidth.has())
                             aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get());
-                        aShapeProps.setProperty(aBorders[i], uno::makeAny(aBorderLine));
+                        aShapeProps.setProperty(nBorder, uno::makeAny(aBorderLine));
                     }
                     aShapeProps.erase(PROP_LineColor);
                 }
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index b14ad33..e389fc6 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -237,18 +237,18 @@ static uno::Reference<io::XInputStream> lcl_StoreOwnAsOOXML(
 
     const char * pFilterName(nullptr);
     SvGlobalName const classId(xObj->getClassID());
-    for (size_t i = 0; i < SAL_N_ELEMENTS(s_Mapping); ++i)
+    for (auto & i : s_Mapping)
     {
-        auto const& rId(s_Mapping[i].ClassId);
+        auto const& rId(i.ClassId);
         SvGlobalName const temp(rId.n1, rId.n2, rId.n3, rId.b8, rId.b9, rId.b10, rId.b11, rId.b12, rId.b13, rId.b14, rId.b15);
         if (temp == classId)
         {
             assert(SvGlobalName(SO3_SCH_CLASSID_60) != classId); // chart should be written elsewhere!
             assert(SvGlobalName(SO3_SM_CLASSID_60) != classId); // formula should be written elsewhere!
-            pFilterName = s_Mapping[i].pFilterName;
-            o_rMediaType = OUString::createFromAscii(s_Mapping[i].pMediaType);
-            o_rpProgID = s_Mapping[i].pProgID;
-            o_rSuffix = OUString::createFromAscii(s_Mapping[i].pSuffix);
+            pFilterName = i.pFilterName;
+            o_rMediaType = OUString::createFromAscii(i.pMediaType);
+            o_rpProgID = i.pProgID;
+            o_rSuffix = OUString::createFromAscii(i.pSuffix);
             o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
             break;
         }
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 34527f0..b58248f 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -504,13 +504,13 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
             static const sal_Int32 aBorders[] = {
                 PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
             };
-            for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
+            for (sal_Int32 nBorder : aBorders)
             {
-                table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<table::BorderLine2>();
+                table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get<table::BorderLine2>();
                 aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get<sal_Int32>();
                 if (oLineWidth)
                     aBorderLine.LineWidth = *oLineWidth;
-                aPropMap.setProperty(aBorders[i], uno::makeAny(aBorderLine));
+                aPropMap.setProperty(nBorder, uno::makeAny(aBorderLine));
             }
             aPropMap.erase(PROP_LineColor);
         }
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 7013178..1655cb6 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -71,9 +71,8 @@ OString generateMD5(const void* pData, size_t length)
 
     OStringBuffer aBuffer;
     const char* pString = "0123456789ABCDEF";
-    for(size_t i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i)
+    for(sal_uInt8 val : pBuffer)
     {
-        sal_uInt8 val = pBuffer[i];
         aBuffer.append(pString[val/16]);
         aBuffer.append(pString[val%16]);
     }
@@ -272,12 +271,12 @@ void releaseOpenCLEnv( GPUEnv *gpuInfo )
         return;
     }
 
-    for (int i = 0; i < OPENCL_CMDQUEUE_SIZE; ++i)
+    for (_cl_command_queue* & i : gpuEnv.mpCmdQueue)
     {
-        if (gpuEnv.mpCmdQueue[i])
+        if (i)
         {
-            clReleaseCommandQueue(gpuEnv.mpCmdQueue[i]);
-            gpuEnv.mpCmdQueue[i] = nullptr;
+            clReleaseCommandQueue(i);
+            i = nullptr;
         }
     }
     gpuEnv.mnCmdQueuePos = 0;
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 7cc2866..69d5a33 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -374,9 +374,9 @@ OUString ManifestImport::PushNameAndNamespaces( const OUString& aName, const uno
 
     aStack.push_back( ManifestScopeEntry( aConvertedName, aNamespaces ) );
 
-    for ( size_t nInd = 0; nInd < aAttribsStrs.size(); nInd++ ) {
+    for (const std::pair<OUString,OUString> & rAttribsStr : aAttribsStrs) {
         // convert the attribute names on filling
-        o_aConvertedAttribs[ConvertName( aAttribsStrs[nInd].first )] = aAttribsStrs[nInd].second;
+        o_aConvertedAttribs[ConvertName( rAttribsStr.first )] = rAttribsStr.second;
     }
 
     return aConvertedName;
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index c5307ce..9213ed7 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -179,10 +179,10 @@ void ZipOutputStream::finish()
     consumeAllScheduledThreadEntries();
 
     sal_Int32 nOffset= static_cast < sal_Int32 > (m_aChucker.GetPosition());
-    for (size_t i = 0; i < m_aZipList.size(); i++)
+    for (ZipEntry* p : m_aZipList)
     {
-        writeCEN( *m_aZipList[i] );
-        delete m_aZipList[i];
+        writeCEN( *p );
+        delete p;
     }
     writeEND( nOffset, static_cast < sal_Int32 > (m_aChucker.GetPosition()) - nOffset);
     m_xStream->flush();
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 7d01e8e..26a5b21 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -1569,8 +1569,8 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
                 if ( !sFunction.isEmpty() )
                 {
                     const sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'};
-                    for(sal_uInt32 j= 0; j < SAL_N_ELEMENTS(pReplaceChars);++j)
-                        sFunctionName = sFunctionName.replace(pReplaceChars[j],'_');
+                    for(sal_Unicode ch : pReplaceChars)
+                        sFunctionName = sFunctionName.replace(ch,'_');
 
                     xFunction->setName(sFunctionName);
                     if ( !sInitialFormula.isEmpty() )
diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx
index 3e2e1b7..86e0482 100644
--- a/reportdesign/source/ui/dlg/DateTime.cxx
+++ b/reportdesign/source/ui/dlg/DateTime.cxx
@@ -87,8 +87,8 @@ ODateTimeDialog::ODateTimeDialog( vcl::Window* _pParent
     m_aTimeControlling.enableOnCheckMark( *m_pTime, *m_pFTTimeFormat, *m_pTimeListBox);
 
     CheckBox* aCheckBoxes[] = { m_pDate,m_pTime};
-    for ( size_t i = 0 ; i < SAL_N_ELEMENTS(aCheckBoxes); ++i)
-        aCheckBoxes[i]->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl));
+    for (CheckBox* pCheckBox : aCheckBoxes)
+        pCheckBox->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl));
 
 }
 
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index a659c3d..62857d7 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -961,11 +961,11 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl
     m_pFieldExpression->set_vexpand(true);
 
     Control* pControlsLst[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst, m_pGroupIntervalEd};
-    for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst); ++i)
+    for (Control* i : pControlsLst)
     {
-        pControlsLst[i]->SetGetFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusGot));
-        pControlsLst[i]->SetLoseFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusLost));
-        pControlsLst[i]->Show();
+        i->SetGetFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusGot));
+        i->SetLoseFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusLost));
+        i->Show();
     }
 
     for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst) - 1; ++i)
@@ -1072,8 +1072,8 @@ void OGroupsSortingDialog::SaveData( sal_Int32 _nRow)
         xGroup->setSortAscending( m_pOrderLst->GetSelectEntryPos() == 0 );
 
     ListBox* pControls[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst};
-    for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i)
-        pControls[i]->SaveValue();
+    for (ListBox* pControl : pControls)
+        pControl->SaveValue();
 }
 
 
@@ -1305,13 +1305,13 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _x
     m_pOrderLst->SelectEntryPos(_xGroup->getSortAscending() ? 0 : 1);
 
     ListBox* pControls[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst};
-    for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i)
-        pControls[i]->SaveValue();
+    for (ListBox* pControl : pControls)
+        pControl->SaveValue();
 
     ListBox* pControlsLst2[] = { m_pHeaderLst, m_pFooterLst, m_pGroupOnLst, m_pKeepTogetherLst, m_pOrderLst};
     bool bReadOnly = !m_pController->isEditable();
-    for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst2); ++i)
-        pControlsLst2[i]->SetReadOnly(bReadOnly);
+    for (ListBox* i : pControlsLst2)
+        i->SetReadOnly(bReadOnly);
     m_pGroupIntervalEd->SetReadOnly(bReadOnly);
 }
 
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
index 054f249..bdcca01 100644
--- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -374,9 +374,9 @@ uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedPrope
             ,OUString(PROPERTY_PREVIEW_COUNT)
         };
 
-        for (size_t nPos = 0; nPos < SAL_N_ELEMENTS(s_pProperties); ++nPos )
+        for (const OUString & rName : s_pProperties)
         {
-            aValue.Name = s_pProperties[nPos];
+            aValue.Name = rName;
             aNewProps.push_back(aValue);
         }
     }
diff --git a/reportdesign/source/ui/inspection/DefaultInspection.cxx b/reportdesign/source/ui/inspection/DefaultInspection.cxx
index cd68746..fe0e6c1 100644
--- a/reportdesign/source/ui/inspection/DefaultInspection.cxx
+++ b/reportdesign/source/ui/inspection/DefaultInspection.cxx
@@ -119,9 +119,9 @@ namespace rptui
         const size_t nFactories = SAL_N_ELEMENTS( aFactories );
         Sequence< Any > aReturn( nFactories );
         Any* pReturn = aReturn.getArray();
-        for ( size_t i = 0; i < nFactories; ++i )
+        for (const auto& rFactory : aFactories)
         {
-            *pReturn++ <<= OUString::createFromAscii( aFactories[i].serviceName );
+            *pReturn++ <<= OUString::createFromAscii( rFactory.serviceName );
         }
 
         return aReturn;
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 4bf753a..535fa58 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -1309,15 +1309,15 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie
     };
     const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo();
     const uno::Sequence< beans::Property> aSeq = xInfo->getProperties();
-    for (size_t i = 0; i < SAL_N_ELEMENTS(pIncludeProperties); ++i )
+    for (const auto & rIncludeProp : pIncludeProperties)
     {
         const beans::Property* pIter = aSeq.getConstArray();
         const beans::Property* pEnd  = pIter + aSeq.getLength();
-        const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(pIncludeProperties[i])));
+        const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(rIncludeProp)));
         if ( pFind != pEnd )
         {
             // special case for controls which contain a data field
-            if ( PROPERTY_DATAFIELD == pIncludeProperties[i] )
+            if ( PROPERTY_DATAFIELD == rIncludeProp )
             {
                 beans::Property aValue;
                 aValue.Name = PROPERTY_FORMULALIST;
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 4ab8226..e7c3fc0 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -540,13 +540,13 @@ namespace
                                 ,{ITEMID_LANGUAGE_ASIAN,OUString(PROPERTY_CHARLOCALEASIAN)}
                                 ,{ITEMID_LANGUAGE_COMPLEX,OUString(PROPERTY_CHARLOCALECOMPLEX)}
         };
-        for(size_t k = 0; k < SAL_N_ELEMENTS(pItems); ++k)
+        for(const auto & k : pItems)
         {
-            if ( SfxItemState::SET == _rItemSet.GetItemState( pItems[k].nWhich,true,&pItem) && dynamic_cast< const SvxLanguageItem *>( pItem ) !=  nullptr)
+            if ( SfxItemState::SET == _rItemSet.GetItemState( k.nWhich,true,&pItem) && dynamic_cast< const SvxLanguageItem *>( pItem ) !=  nullptr)
             {
                 const SvxLanguageItem* pFontItem = static_cast<const SvxLanguageItem*>(pItem);
                 lang::Locale aCharLocale( LanguageTag( pFontItem->GetLanguage()).getLocale());
-                lcl_pushBack( _out_rProperties, pItems[k].sPropertyName, uno::makeAny( aCharLocale ) );
+                lcl_pushBack( _out_rProperties, k.sPropertyName, uno::makeAny( aCharLocale ) );
             }
         }
         if ( SfxItemState::SET == _rItemSet.GetItemState( ITEMID_ESCAPEMENT,true,&pItem) && dynamic_cast< const SvxEscapementItem *>( pItem ) !=  nullptr)
@@ -730,8 +730,8 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
     }
 
     SfxItemPool::Free(pPool);
-    for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i)
-        delete pDefaults[i];
+    for (SfxPoolItem* pDefault : pDefaults)
+        delete pDefault;
 
     return bSuccess;
 }
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 8ed293d..0125f60 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2093,10 +2093,10 @@ void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _
             ,OUString("private:resource/toolbar/resizebar")
             ,OUString("private:resource/toolbar/sectionshrinkbar")
         };
-        for (size_t i = 0; i< SAL_N_ELEMENTS(s_sMenu); ++i)
+        for (const auto & i : s_sMenu)
         {
-            _xLayoutManager->createElement( s_sMenu[i] );
-            _xLayoutManager->requestElement( s_sMenu[i] );
+            _xLayoutManager->createElement( i );
+            _xLayoutManager->requestElement( i );
         }
     }
 }
@@ -2536,8 +2536,8 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
     }
     SfxItemPool::Free(pPool);
 
-    for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i)
-        delete pDefaults[i];
+    for (SfxPoolItem* pDefault : pDefaults)
+        delete pDefault;
 
 }
 
@@ -2735,11 +2735,11 @@ uno::Any SAL_CALL OReportController::getViewData() throw( uno::RuntimeException,
     };
 
     ::comphelper::NamedValueCollection aCommandProperties;
-    for ( size_t i=0; i < SAL_N_ELEMENTS(nCommandIDs); ++i )
+    for (sal_Int32 nCommandID : nCommandIDs)
     {
-        const FeatureState aFeatureState = GetState( nCommandIDs[i] );
+        const FeatureState aFeatureState = GetState( nCommandID );
 
-        OUString sCommandURL( getURLForId( nCommandIDs[i] ).Main );
+        OUString sCommandURL( getURLForId( nCommandID ).Main );
         OSL_ENSURE( sCommandURL.startsWith( ".uno:" ), "OReportController::getViewData: illegal command URL!" );
         sCommandURL = sCommandURL.copy( 5 );
 
@@ -3208,10 +3208,10 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
                                           ,OUString(PROPERTY_FORMATSSUPPLIER)
                                           ,OUString(PROPERTY_BACKGROUNDCOLOR)
             };
-            for(size_t i = 0; i < SAL_N_ELEMENTS(sProps); ++i)
+            for(const auto & sProp : sProps)
             {
-                if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) )
-                    xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i]));
+                if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
+                    xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
             }
 
             if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
@@ -3507,10 +3507,10 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
                                                             ,OUString(PROPERTY_BORDER)
                                                             ,OUString(PROPERTY_BACKGROUNDCOLOR)
                         };
-                        for(size_t k = 0; k < SAL_N_ELEMENTS(sProps); ++k)
+                        for(const auto & sProp : sProps)
                         {
-                            if ( xInfo->hasPropertyByName(sProps[k]) && xShapeInfo->hasPropertyByName(sProps[k]) )
-                                xUnoProp->setPropertyValue(sProps[k],xShapeProp->getPropertyValue(sProps[k]));
+                            if ( xInfo->hasPropertyByName(sProp) && xShapeInfo->hasPropertyByName(sProp) )
+                                xUnoProp->setPropertyValue(sProp,xShapeProp->getPropertyValue(sProp));
                         }
                         if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) )
                         {
@@ -3618,8 +3618,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
             }
             else
             {
-                for(size_t i = 0; i < SAL_N_ELEMENTS(pControl); ++i)
-                    delete pControl[i];
+                for(SdrUnoObj* i : pControl)
+                    delete i;
             }
         }
     }
@@ -3679,8 +3679,8 @@ void OReportController::listen(const bool _bAdd)
     void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const OUString&, const uno::Reference< XPropertyChangeListener >& ) =
         _bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener;
 
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aProps); ++i)
-        (m_xReportDefinition.get()->*pPropertyListenerAction)( aProps[i], static_cast< XPropertyChangeListener* >( this ) );
+    for (const auto & aProp : aProps)
+        (m_xReportDefinition.get()->*pPropertyListenerAction)( aProp, static_cast< XPropertyChangeListener* >( this ) );
 
     OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv();
     uno::Reference< XPropertyChangeListener > xUndo = &rUndoEnv;
@@ -4259,8 +4259,8 @@ void OReportController::openZoomDialog()
         }
         SfxItemPool::Free(pPool);
 
-        for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i)
-            delete pDefaults[i];
+        for (SfxPoolItem* pDefault : pDefaults)
+            delete pDefault;
     }
 }
 
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index acb161f..594a27c 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -194,8 +194,8 @@ void PropBrw::dispose()
             const OUString pProps[] = { OUString( "ContextDocument" )
                                             ,  OUString( "DialogParentWindow" )
                                             , OUString( "ActiveConnection" )};
-            for (size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i)
-                xName->removeByName(pProps[i]);
+            for (const auto & i : pProps)
+                xName->removeByName(i);
         }
     }
     catch(Exception&)
diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx
index 1c857b6..78b42eb 100644
--- a/sal/osl/unx/signal.cxx
+++ b/sal/osl/unx/signal.cxx
@@ -208,21 +208,21 @@ bool onInitSignal()
     sigfillset(&(act.sa_mask));
 
     /* Initialize the rest of the signals */
-    for (int i = 0; i < NoSignals; ++i)
+    for (SignalAction & rSignal : Signals)
     {
 #if defined HAVE_VALGRIND_HEADERS
-        if (Signals[i].Signal == SIGUSR2 && RUNNING_ON_VALGRIND)
-            Signals[i].Action = ACT_IGNORE;
+        if (rSignal.Signal == SIGUSR2 && RUNNING_ON_VALGRIND)
+            rSignal.Action = ACT_IGNORE;
 #endif
 
         /* hack: stomcatd is attaching JavaVM which does not work with an sigaction(SEGV) */
-        if ((bSetSEGVHandler || Signals[i].Signal != SIGSEGV)
-        && (bSetWINCHHandler || Signals[i].Signal != SIGWINCH)
-        && (bSetILLHandler   || Signals[i].Signal != SIGILL))
+        if ((bSetSEGVHandler || rSignal.Signal != SIGSEGV)
+        && (bSetWINCHHandler || rSignal.Signal != SIGWINCH)
+        && (bSetILLHandler   || rSignal.Signal != SIGILL))
         {
-            if (Signals[i].Action != ACT_SYSTEM)
+            if (rSignal.Action != ACT_SYSTEM)
             {
-                if (Signals[i].Action == ACT_HIDE)
+                if (rSignal.Action == ACT_HIDE)
                 {
                     struct sigaction ign;
 
@@ -231,18 +231,18 @@ bool onInitSignal()
                     sigemptyset(&ign.sa_mask);
 
                     struct sigaction oact;
-                    if (sigaction(Signals[i].Signal, &ign, &oact) == 0)
-                        Signals[i].Handler = oact.sa_handler;
+                    if (sigaction(rSignal.Signal, &ign, &oact) == 0)
+                        rSignal.Handler = oact.sa_handler;
                     else
-                        Signals[i].Handler = SIG_DFL;
+                        rSignal.Handler = SIG_DFL;
                 }
                 else
                 {
                     struct sigaction oact;
-                    if (sigaction(Signals[i].Signal, &act, &oact) == 0)
-                        Signals[i].Handler = oact.sa_handler;
+                    if (sigaction(rSignal.Signal, &act, &oact) == 0)
+                        rSignal.Handler = oact.sa_handler;
                     else
-                        Signals[i].Handler = SIG_DFL;
+                        rSignal.Handler = SIG_DFL;
                 }
             }
         }
diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx
index 9df367f..110283c 100644
--- a/sal/rtl/hash.cxx
+++ b/sal/rtl/hash.cxx
@@ -58,10 +58,10 @@ getNextSize (sal_uInt32 nSize)
                                           2097143, 4194301, 8388593, 16777213,
                                           33554393, 67108859, 134217689 };
 
-    for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(nPrimes); i++)
+    for (sal_uInt32 nPrime : nPrimes)
     {
-        if (nPrimes[i] > nSize)
-            return nPrimes[i];
+        if (nPrime > nSize)
+            return nPrime;
     }
     return nSize * 2;
 }
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index b94b705..e9ae452 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -120,8 +120,8 @@ void FastAttributeList::addUnknown( const OString& rName, const OString& value )
 // XFastAttributeList
 sal_Bool FastAttributeList::hasAttribute( ::sal_Int32 Token ) throw (RuntimeException, std::exception)
 {
-    for (size_t i = 0; i < maAttributeTokens.size(); ++i)
-        if (maAttributeTokens[i] == Token)
+    for (sal_Int32 i : maAttributeTokens)
+        if (i == Token)
             return true;
 
     return false;
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 70f7397..49ed24b 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -255,11 +255,11 @@ namespace sax_fastparser {
 #ifdef DBG_UTIL
         ::std::set<OString> DebugAttributes;
 #endif
-        for (size_t j = 0; j < maTokenValues.size(); j++)
+        for (const TokenValue & rTokenValue : maTokenValues)
         {
             writeBytes(sSpace, N_CHARS(sSpace));
 
-            sal_Int32 nToken = maTokenValues[j].nToken;
+            sal_Int32 nToken = rTokenValue.nToken;
             writeId(nToken);
 
 #ifdef DBG_UTIL
@@ -271,7 +271,7 @@ namespace sax_fastparser {
 
             writeBytes(sEqualSignAndQuote, N_CHARS(sEqualSignAndQuote));
 
-            write(maTokenValues[j].pValue, -1, true);
+            write(rTokenValue.pValue, -1, true);
 
             writeBytes(sQuote, N_CHARS(sQuote));
         }


More information about the Libreoffice-commits mailing list