summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-06 10:14:38 +0200
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2016-05-07 12:24:31 +0000
commit9613b493172fe9aa8efd9c9c090f82ca2e89cf21 (patch)
tree3cc0d212aea1de270160e295a70c9f08f2e84334 /sc/source/core
parent464348e82d8cbb0a6d3e5638da3f737f3e6f2d00 (diff)
clang-tidy modernize-loop-convert in sc
Change-Id: I620028d69b11ea0469efd7b02ac7bbc7edab1066 Reviewed-on: https://gerrit.libreoffice.org/24690 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/bcaslot.cxx6
-rw-r--r--sc/source/core/data/colorscale.cxx10
-rw-r--r--sc/source/core/data/documen3.cxx3
-rw-r--r--sc/source/core/data/documen5.cxx4
-rw-r--r--sc/source/core/data/documen8.cxx8
-rw-r--r--sc/source/core/data/document.cxx18
-rw-r--r--sc/source/core/data/document10.cxx3
-rw-r--r--sc/source/core/data/funcdesc.cxx8
-rw-r--r--sc/source/core/data/table2.cxx8
-rw-r--r--sc/source/core/data/table4.cxx4
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx20
-rw-r--r--sc/source/core/opencl/op_logical.cxx16
-rw-r--r--sc/source/core/opencl/op_math.cxx28
-rw-r--r--sc/source/core/opencl/op_statistical.cxx25
-rw-r--r--sc/source/core/tool/callform.cxx4
-rw-r--r--sc/source/core/tool/compiler.cxx7
-rw-r--r--sc/source/core/tool/interpr1.cxx4
-rw-r--r--sc/source/core/tool/interpr2.cxx9
-rw-r--r--sc/source/core/tool/interpr3.cxx16
-rw-r--r--sc/source/core/tool/parclass.cxx8
-rw-r--r--sc/source/core/tool/rangelst.cxx13
21 files changed, 106 insertions, 116 deletions
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 5a09764e5753..0e64aa50cd02 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -680,11 +680,11 @@ inline SCSIZE ScBroadcastAreaSlotMachine::ComputeSlotOffset(
OSL_FAIL( "Row/Col invalid, using first slot!" );
return 0;
}
- for (size_t i=0; i < aSlotDistribution.size(); ++i)
+ for (ScSlotData & i : aSlotDistribution)
{
- if (nRow < aSlotDistribution[i].nStopRow)
+ if (nRow < i.nStopRow)
{
- const ScSlotData& rSD = aSlotDistribution[i];
+ const ScSlotData& rSD = i;
return rSD.nCumulated +
(static_cast<SCSIZE>(nRow - rSD.nStartRow)) / rSD.nSlice +
static_cast<SCSIZE>(nCol) / BCA_SLOT_COLS * nBcaSlotsRow;
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 71ffe744759e..fd5c203701ef 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -1316,11 +1316,11 @@ BitmapEx& ScIconSetFormat::getBitmap(sc::IconSetBitmapMap & rIconSetBitmapMap,
{
sal_Int32 nBitmap = -1;
- for(size_t i = 0; i < SAL_N_ELEMENTS(aBitmapMap); ++i)
+ for(const ScIconSetBitmapMap & i : aBitmapMap)
{
- if(aBitmapMap[i].eType == eType)
+ if(i.eType == eType)
{
- nBitmap = *(aBitmapMap[i].nBitmaps + nIndex);
+ nBitmap = *(i.nBitmaps + nIndex);
break;
}
}
@@ -1341,9 +1341,9 @@ BitmapEx& ScIconSetFormat::getBitmap(sc::IconSetBitmapMap & rIconSetBitmapMap,
void ScIconSetFormat::EnsureSize()
{
ScIconSetType eType = mpFormatData->eIconSetType;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetMap); ++i)
+ for (ScIconSetMap & i : aIconSetMap)
{
- if (aIconSetMap[i].eType == eType)
+ if (i.eType == eType)
{
// size_t nElements = aIconSetMap[i].nElements;
// TODO: implement
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 9eac83d98fc8..2618eb151521 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1625,9 +1625,8 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& rStrings )
ScRangePairList* pLists[2];
pLists[0] = GetColNameRanges();
pLists[1] = GetRowNameRanges();
- for (sal_uInt16 nListNo=0; nListNo<2; nListNo++)
+ for (ScRangePairList* pList : pLists)
{
- ScRangePairList* pList = pLists[ nListNo ];
if (!pList)
continue;
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index c88a6193d73a..66d8dcd15b3f 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -261,10 +261,10 @@ void ScDocument::GetChartRanges( const OUString& rChartName, ::std::vector< ScRa
{
std::vector< OUString > aRangeStrings;
ScChartHelper::GetChartRanges( xChartDoc, aRangeStrings );
- for( size_t nN=0; nN<aRangeStrings.size(); nN++ )
+ for(const OUString & aRangeString : aRangeStrings)
{
ScRangeList aRanges;
- aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, ScRefFlags::VALID, pSheetNameDoc->GetAddressConvention() );
+ aRanges.Parse( aRangeString, pSheetNameDoc, ScRefFlags::VALID, pSheetNameDoc->GetAddressConvention() );
rRangesVector.push_back(aRanges);
}
}
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 6e049c1f0b06..40cac04e4cd8 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -887,9 +887,9 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
return;
const sfx2::SvBaseLinks& rLinks = pMgr->GetLinks();
- for (size_t i = 0, n = rLinks.size(); i < n; ++i)
+ for (const auto & rLink : rLinks)
{
- const sfx2::SvBaseLink* pBase = rLinks[i].get();
+ const sfx2::SvBaseLink* pBase = rLink.get();
if (const ScDdeLink* p = dynamic_cast<const ScDdeLink*>(pBase))
{
ScDdeLink* pNew = new ScDdeLink(pDestDoc, *p);
@@ -1055,9 +1055,9 @@ void ScDocument::UpdateAreaLinks()
return;
const ::sfx2::SvBaseLinks& rLinks = pMgr->GetLinks();
- for (size_t i=0; i<rLinks.size(); i++)
+ for (const auto & rLink : rLinks)
{
- ::sfx2::SvBaseLink* pBase = rLinks[i].get();
+ ::sfx2::SvBaseLink* pBase = rLink.get();
if (dynamic_cast<const ScAreaLink*>( pBase) != nullptr)
pBase->Update();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1483aea0e00e..75d2336c60ab 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -722,9 +722,9 @@ bool ScDocument::DeleteTab( SCTAB nTab )
if ( pUnoBroadcaster )
pUnoBroadcaster->Broadcast( ScUpdateRefHint( URM_INSDEL, aRange, 0,0,-1 ) );
- for (SCTAB i = 0, n = static_cast<SCTAB>(maTabs.size()); i < n; ++i)
- if (maTabs[i])
- maTabs[i]->UpdateDeleteTab(aCxt);
+ for (ScTable* pTab : maTabs)
+ if (pTab)
+ pTab->UpdateDeleteTab(aCxt);
TableContainer::iterator it = maTabs.begin() + nTab;
delete *it;
@@ -811,9 +811,9 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
if ( pUnoBroadcaster )
pUnoBroadcaster->Broadcast( ScUpdateRefHint( URM_INSDEL, aRange, 0,0,-1*nSheets ) );
- for (SCTAB i = 0, n = static_cast<SCTAB>(maTabs.size()); i < n; ++i)
- if (maTabs[i])
- maTabs[i]->UpdateDeleteTab(aCxt);
+ for (ScTable* pTab : maTabs)
+ if (pTab)
+ pTab->UpdateDeleteTab(aCxt);
TableContainer::iterator it = maTabs.begin() + nTab;
TableContainer::iterator itEnd = it + nSheets;
@@ -2876,9 +2876,8 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
if (bPreallocatePattern && (nR2+1) <= nRow2)
{
SCROW nR3 = nR2 + 1;
- for (size_t j = 0; j < vTables.size(); ++j)
+ for (SCTAB nTab : vTables)
{
- SCTAB nTab = vTables[j];
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
{
// Pattern count of the first chunk pasted.
@@ -6541,9 +6540,8 @@ SCROW ScDocument::GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const
void ScDocument::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const
{
- for (size_t nTab = 0; nTab < maTabs.size(); ++nTab)
+ for (ScTable* pTab : maTabs)
{
- const ScTable* pTab = maTabs[nTab];
if (!pTab)
continue;
diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index 4690f9ba855b..59aff1326336 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -162,9 +162,8 @@ std::set<Color> ScDocument::GetDocColors()
std::set<Color> aDocColors;
ScDocumentPool *pPool = GetPool();
const sal_uInt16 pAttribs[] = {ATTR_BACKGROUND, ATTR_FONT_COLOR};
- for (size_t i=0; i<SAL_N_ELEMENTS( pAttribs ); i++)
+ for (sal_uInt16 nAttrib : pAttribs)
{
- const sal_uInt16 nAttrib = pAttribs[i];
const sal_uInt32 nCount = pPool->GetItemCount2(nAttrib);
for (sal_uInt32 j=0; j<nCount; j++)
{
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index acb3c66b707a..8784ae372898 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -405,9 +405,9 @@ ScFunctionList::ScFunctionList() :
RID_SC_FUNCTION_DESCRIPTIONS2
};
- for (sal_uInt16 k = 0; k < SAL_N_ELEMENTS(nDescBlock); ++k)
+ for (sal_uInt16 k : nDescBlock)
{
- std::unique_ptr<ScResourcePublisher> pBlock( new ScResourcePublisher( ScResId( nDescBlock[k] ) ) );
+ std::unique_ptr<ScResourcePublisher> pBlock( new ScResourcePublisher( ScResId( k ) ) );
// Browse for all possible OpCodes. This is not the fastest method, but
// otherwise the sub resources within the resource blocks and the
// resource blocks themselves would had to be ordered according to
@@ -693,8 +693,8 @@ ScFunctionMgr::ScFunctionMgr() :
ScFunctionMgr::~ScFunctionMgr()
{
- for (sal_uInt16 i = 0; i < MAX_FUNCCAT; ++i)
- delete aCatLists[i];
+ for (std::vector<const ScFuncDesc*> * pCatList : aCatLists)
+ delete pCatList;
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index e76aaa39456a..c677ce19c2b2 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1909,9 +1909,9 @@ bool ScTable::HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) co
{
std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans();
- for (size_t i = 0; i < aSpans.size(); ++i)
+ for (sc::ColRowSpan & aSpan : aSpans)
{
- for (SCCOLROW j = aSpans[i].mnStart; j < aSpans[i].mnEnd; ++j)
+ for (SCCOLROW j = aSpan.mnStart; j < aSpan.mnEnd; ++j)
{
if (aCol[j].HasAttribSelection(rMark, nMask))
return true;
@@ -2187,9 +2187,9 @@ bool ScTable::HasSelectionMatrixFragment( const ScMarkData& rMark ) const
{
std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans();
- for ( size_t i=0; i<aSpans.size(); i++ )
+ for (sc::ColRowSpan & aSpan : aSpans)
{
- for ( SCCOLROW j=aSpans[i].mnStart; j<aSpans[i].mnEnd; j++ )
+ for ( SCCOLROW j=aSpan.mnStart; j<aSpan.mnEnd; j++ )
{
if ( aCol[j].HasSelectionMatrixFragment(rMark) )
return true;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index f576ff5a7537..79cf4b4d85d7 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1997,8 +1997,8 @@ void ScTable::AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW
} // if not equal Column
} // if not all equal
- for (sal_uInt8 j = 0; j < 16; ++j)
- delete pPatternAttrs[j];
+ for (ScPatternAttr* pPatternAttr : pPatternAttrs)
+ delete pPatternAttr;
} // if AutoFormatData != NULL
} // if ValidColRow
}
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 3b1bd762b7e8..55a714e09443 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2432,8 +2432,8 @@ public:
virtual void GenSlidingWindowFunction( std::stringstream& ss ) override
{
- for (size_t i = 0; i < mvSubArguments.size(); i++)
- mvSubArguments[i]->GenSlidingWindowFunction(ss);
+ for (DynamicKernelArgumentRef & rArg : mvSubArguments)
+ rArg->GenSlidingWindowFunction(ss);
mpCodeGen->GenSlidingWindowFunction(ss, mSymName, mvSubArguments);
}
virtual void GenDeclRef( std::stringstream& ss ) const override
@@ -2459,9 +2459,9 @@ public:
virtual size_t GetWindowSize() const override
{
size_t nCurWindowSize = 0;
- for (size_t i = 0; i < mvSubArguments.size(); i++)
+ for (const auto & rSubArgument : mvSubArguments)
{
- size_t nCurChildWindowSize = mvSubArguments[i]->GetWindowSize();
+ size_t nCurChildWindowSize = rSubArgument->GetWindowSize();
nCurWindowSize = (nCurWindowSize < nCurChildWindowSize) ?
nCurChildWindowSize : nCurWindowSize;
}
@@ -2518,16 +2518,16 @@ public:
virtual std::string DumpOpName() const override
{
std::string t = "_" + mpCodeGen->BinFuncName();
- for (size_t i = 0; i < mvSubArguments.size(); i++)
- t = t + mvSubArguments[i]->DumpOpName();
+ for (const auto & rSubArgument : mvSubArguments)
+ t = t + rSubArgument->DumpOpName();
return t;
}
virtual void DumpInlineFun( std::set<std::string>& decls,
std::set<std::string>& funs ) const override
{
mpCodeGen->BinInlineFun(decls, funs);
- for (size_t i = 0; i < mvSubArguments.size(); i++)
- mvSubArguments[i]->DumpInlineFun(decls, funs);
+ for (const auto & rSubArgument : mvSubArguments)
+ rSubArgument->DumpInlineFun(decls, funs);
}
virtual ~DynamicKernelSoPArguments()
{
@@ -3790,9 +3790,9 @@ std::string DynamicKernel::GetMD5()
mFullProgramSrc.c_str(),
mFullProgramSrc.length(), result,
RTL_DIGEST_LENGTH_MD5);
- for (int i = 0; i < RTL_DIGEST_LENGTH_MD5; i++)
+ for (sal_uInt8 i : result)
{
- md5s << std::hex << (int)result[i];
+ md5s << std::hex << (int)i;
}
mKernelHash = md5s.str();
}
diff --git a/sc/source/core/opencl/op_logical.cxx b/sc/source/core/opencl/op_logical.cxx
index 61a4bba9911b..698b04039d13 100644
--- a/sc/source/core/opencl/op_logical.cxx
+++ b/sc/source/core/opencl/op_logical.cxx
@@ -237,26 +237,26 @@ void OpXor::GenSlidingWindowFunction(std::stringstream &ss,
ss << " int gid0 = get_global_id(0);\n";
ss << " int t = 0,tmp0 = 0;\n";
ss << " double tmp = 0;\n";
- for(size_t j = 0; j< vSubArguments.size(); j++)
+ for(DynamicKernelArgumentRef & rArg : vSubArguments)
{
- FormulaToken *tmpCur0 = vSubArguments[j]->GetFormulaToken();
+ FormulaToken *tmpCur0 = rArg->GetFormulaToken();
if(tmpCur0->GetType() == formula::svSingleVectorRef)
{
const formula::SingleVectorRefToken*pCurDVR= static_cast<const
formula::SingleVectorRefToken *>(tmpCur0);
ss <<" if(gid0 >= "<<pCurDVR->GetArrayLength()<<" || isNan(";
- ss <<vSubArguments[j]->GenSlidingWindowDeclRef();
+ ss <<rArg->GenSlidingWindowDeclRef();
ss <<"))\n";
ss <<" tmp = 0;\n else\n";
ss <<" tmp = ";
- ss <<vSubArguments[j]->GenSlidingWindowDeclRef()<<";\n";
+ ss <<rArg->GenSlidingWindowDeclRef()<<";\n";
ss <<" tmp0 = (tmp != 0);\n";
ss <<" t = t ^tmp0;\n";
}
else if(tmpCur0->GetType() == formula::svDouble)
{
ss <<" tmp = ";
- ss <<vSubArguments[j]->GenSlidingWindowDeclRef()<<";\n";
+ ss <<rArg->GenSlidingWindowDeclRef()<<";\n";
ss <<" tmp0 = (tmp != 0);\n";
ss <<" t = t ^tmp0;\n";
}
@@ -279,20 +279,20 @@ void OpXor::GenSlidingWindowFunction(std::stringstream &ss,
}
if(!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed())
{
- ss <<" if(isNan("<<vSubArguments[j]->GenSlidingWindowDeclRef();
+ ss <<" if(isNan("<<rArg->GenSlidingWindowDeclRef();
ss <<")||i+gid0>="<<pCurDVR->GetArrayLength();
ss <<")\n";
ss <<" tmp = 0;\n else\n";
}
else
{
- ss <<" if(isNan("<<vSubArguments[j]->GenSlidingWindowDeclRef();
+ ss <<" if(isNan("<<rArg->GenSlidingWindowDeclRef();
ss <<")||i>="<<pCurDVR->GetArrayLength();
ss <<")\n";
ss <<" tmp = 0;\n else\n";
}
ss <<" tmp = ";
- ss <<vSubArguments[j]->GenSlidingWindowDeclRef()<<";\n";
+ ss <<rArg->GenSlidingWindowDeclRef()<<";\n";
ss <<" tmp0 = (tmp != 0);\n";
ss <<" t = t ^tmp0;\n";
ss <<" }\n";
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index b6525f25cd81..f37ec3017863 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -2369,11 +2369,11 @@ void OpSumSQ::GenSlidingWindowFunction(std::stringstream &ss,
ss << "{\n";
ss << " int gid0=get_global_id(0);\n";
ss << " double sum = 0.0f, arg;\n";
- for( size_t i=0; i < vSubArguments.size(); ++i)
+ for(DynamicKernelArgumentRef & rArg : vSubArguments)
{
- FormulaToken *tmpCur = vSubArguments[i]->GetFormulaToken();
+ FormulaToken *tmpCur = rArg->GetFormulaToken();
assert(tmpCur);
- if(ocPush == vSubArguments[i]->GetFormulaToken()->GetOpCode())
+ if(ocPush == rArg->GetFormulaToken()->GetOpCode())
{
if (tmpCur->GetType() == formula::svDoubleVectorRef)
{
@@ -2405,7 +2405,7 @@ void OpSumSQ::GenSlidingWindowFunction(std::stringstream &ss,
ss << " {\n";
}
ss << " arg = ";
- ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ ss << rArg->GenSlidingWindowDeclRef();
ss << ";\n";
ss << " if (isNan(arg))\n";
ss << " continue;\n";
@@ -2418,7 +2418,7 @@ void OpSumSQ::GenSlidingWindowFunction(std::stringstream &ss,
static_cast<
const formula::SingleVectorRefToken *>(tmpCur);
ss << " arg = ";
- ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ ss << rArg->GenSlidingWindowDeclRef();
ss << ";\n";
ss << " if(isNan(arg)||(gid0>=";
ss << tmpCurDVR->GetArrayLength();
@@ -2436,7 +2436,7 @@ void OpSumSQ::GenSlidingWindowFunction(std::stringstream &ss,
else
{
ss << " arg = ";
- ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ ss << rArg->GenSlidingWindowDeclRef();
ss << ";\n";
ss << " sum += pown(arg, 2);\n";
}
@@ -2720,9 +2720,9 @@ void OpProduct::GenSlidingWindowFunction(std::stringstream &ss,
ss << " int gid0 = get_global_id(0);\n";
ss << " int i = 0;\n";
ss << " double product=1.0;\n\n";
- for (size_t i = 0; i < vSubArguments.size(); i++)
+ for (DynamicKernelArgumentRef & rArg : vSubArguments)
{
- FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
+ FormulaToken *pCur = rArg->GetFormulaToken();
assert(pCur);
if (pCur->GetType() == formula::svDoubleVectorRef)
{
@@ -2755,23 +2755,23 @@ void OpProduct::GenSlidingWindowFunction(std::stringstream &ss,
ss << "0; i < " << pDVR->GetArrayLength() << "; i++)\n";
ss << " {\n";
}
- ss << "if(!isNan("<<vSubArguments[i]->GenSlidingWindowDeclRef()<<"))\n";
+ ss << "if(!isNan("<<rArg->GenSlidingWindowDeclRef()<<"))\n";
ss << "product = product*";
- ss << vSubArguments[i]->GenSlidingWindowDeclRef()<<";\n";
+ ss << rArg->GenSlidingWindowDeclRef()<<";\n";
ss << " }\n";
}
else if (pCur->GetType() == formula::svSingleVectorRef)
{
- ss << "if(!isNan("<<vSubArguments[i]->GenSlidingWindowDeclRef()<<"))\n";
+ ss << "if(!isNan("<<rArg->GenSlidingWindowDeclRef()<<"))\n";
ss << "product = product*";
- ss << vSubArguments[i]->GenSlidingWindowDeclRef()<<";\n";
+ ss << rArg->GenSlidingWindowDeclRef()<<";\n";
}
else
{
- ss << "if(!isNan("<<vSubArguments[i]->GenSlidingWindowDeclRef()<<"))\n";
+ ss << "if(!isNan("<<rArg->GenSlidingWindowDeclRef()<<"))\n";
ss << "product = product*";
- ss << vSubArguments[i]->GenSlidingWindowDeclRef()<<";\n";
+ ss << rArg->GenSlidingWindowDeclRef()<<";\n";
}
}
ss << " return product;\n";
diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index b54330046365..7a59167b7d6c 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -3440,14 +3440,14 @@ void OpGeoMean::GenSlidingWindowFunction(
ss << " int offset;\n";
ss << " barrier(CLK_LOCAL_MEM_FENCE);\n";
- for(size_t i=0;i<vSubArguments.size();i++)
+ for(DynamicKernelArgumentRef & rArg : vSubArguments)
{
- assert(vSubArguments[i]->GetFormulaToken());
+ assert(rArg->GetFormulaToken());
- if(vSubArguments[i]->GetFormulaToken()->GetType() ==
+ if(rArg->GetFormulaToken()->GetType() ==
formula::svDoubleVectorRef)
{
- FormulaToken *tmpCur = vSubArguments[i]->GetFormulaToken();
+ FormulaToken *tmpCur = rArg->GetFormulaToken();
const formula::DoubleVectorRefToken*pCurDVR= static_cast<const
formula::DoubleVectorRefToken *>(tmpCur);
size_t nCurWindowSize = pCurDVR->GetArrayLength() <
@@ -3478,7 +3478,7 @@ void OpGeoMean::GenSlidingWindowFunction(
std::string p2 = "p2";
ss << " tmp0 =";
- vSubArguments[i]->GenDeclRef(ss);
+ rArg->GenDeclRef(ss);
ss << "["<<p1.c_str()<<"];\n";
ss << " if(!isNan(tmp0))\n";
ss << " {\n";
@@ -3487,7 +3487,7 @@ void OpGeoMean::GenSlidingWindowFunction(
ss << " }\n";
ss << " tmp0 =";
- vSubArguments[i]->GenDeclRef(ss);
+ rArg->GenDeclRef(ss);
ss << "["<<p2.c_str()<<"];\n";
ss << " if(!isNan(tmp0))\n";
ss << " {\n";
@@ -3499,7 +3499,7 @@ void OpGeoMean::GenSlidingWindowFunction(
ss << " else if (p1 < min(arrayLength, offset + windowSize)) {\n";
ss << " tmp0 =";
- vSubArguments[i]->GenDeclRef(ss);
+ rArg->GenDeclRef(ss);
ss << "["<<p1.c_str()<<"];\n";
ss << " if(!isNan(tmp0))\n";
ss << " {\n";
@@ -3534,15 +3534,14 @@ void OpGeoMean::GenSlidingWindowFunction(
ss << " if (lidx == 0)\n";
ss << " {\n";
ss << " tmp0 =";
- if(vSubArguments[i]->GetFormulaToken()->GetType() ==
- formula::svSingleVectorRef)
+ if(rArg->GetFormulaToken()->GetType() == formula::svSingleVectorRef)
{
- vSubArguments[i]->GenDeclRef(ss);
+ rArg->GenDeclRef(ss);
ss << "[writePos];\n";
}
else
{
- vSubArguments[i]->GenDeclRef(ss);
+ rArg->GenDeclRef(ss);
ss <<";\n";
//ss <<"printf(\"\\n********************tmp0 is %f\",tmp0);\n";
}
@@ -4777,9 +4776,9 @@ void OpMedian::GenSlidingWindowFunction(
ss << " unsigned int startFlag = 0;\n";
ss << " unsigned int endFlag = 0;\n";
ss << " double dataIna;\n";
- for (size_t i = 0; i < vSubArguments.size(); i++)
+ for (DynamicKernelArgumentRef & rArg : vSubArguments)
{
- FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
+ FormulaToken *pCur = rArg->GetFormulaToken();
assert(pCur);
if (const formula::DoubleVectorRefToken* pCurDVR =
dynamic_cast<const formula::DoubleVectorRefToken *>(pCur))
diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index 075f3f3a5fdc..d79e98f2902e 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -213,9 +213,9 @@ bool InitExternalFunc(const OUString& rModuleName)
cFuncName[0] = 0;
cInternalName[0] = 0;
nParamCount = 0;
- for ( sal_uInt16 j=0; j<MAXFUNCPARAM; j++ )
+ for (ParamType & rParamType : eParamType)
{
- eParamType[j] = ParamType::NONE;
+ rParamType = ParamType::NONE;
}
(*reinterpret_cast<GetFuncDataPtr>(fpGetData))(i, cFuncName, nParamCount,
eParamType, cInternalName);
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c50174b62668..10ec0ca1355a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2669,12 +2669,11 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray )
// Renamed new names, prepare to read future names:
//{ "ORG.OPENOFFICE.XXX", ocXXX } // XXX -> ORG.OPENOFFICE.XXX
};
- static const size_t nOdffAliases = SAL_N_ELEMENTS(aOdffAliases);
- for (size_t i=0; i<nOdffAliases; ++i)
+ for (const FunctionName& rOdffAlias : aOdffAliases)
{
- if (rName.equalsIgnoreAsciiCaseAscii( aOdffAliases[i].pName))
+ if (rName.equalsIgnoreAsciiCaseAscii( rOdffAlias.pName))
{
- maRawToken.SetOpCode( aOdffAliases[i].eOp);
+ maRawToken.SetOpCode( rOdffAlias.eOp);
bFound = true;
break; // for
}
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 94eeda8c7337..b95c867f482b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7039,8 +7039,8 @@ void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount )
vMean = fSum / values.size();
- for (size_t i = 0; i < values.size(); i++)
- vSum += (values[i] - vMean) * (values[i] - vMean);
+ for (double v : values)
+ vSum += (v - vMean) * (v - vMean);
rVal = vSum;
}
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index c1a812a19a10..4a51f956be73 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -3002,12 +3002,11 @@ static bool lclConvertMoney( const OUString& aSearchUnit, double& rfRate, int& r
{ "LTL", 3.45280, 2 }
};
- static const size_t nConversionCount = SAL_N_ELEMENTS( aConvertTable );
- for ( size_t i = 0; i < nConversionCount; ++i )
- if ( aSearchUnit.equalsIgnoreAsciiCaseAscii( aConvertTable[i].pCurrText ) )
+ for (const auto & i : aConvertTable)
+ if ( aSearchUnit.equalsIgnoreAsciiCaseAscii( i.pCurrText ) )
{
- rfRate = aConvertTable[i].fRate;
- rnDec = aConvertTable[i].nDec;
+ rfRate = i.fRate;
+ rnDec = i.nDec;
return true;
}
return false;
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 4dc25305406a..5a98900d11c1 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2879,8 +2879,8 @@ void ScInterpreter::ScKurt()
double fMean = fSum / fCount;
- for (size_t i = 0; i < values.size(); i++)
- vSum += (values[i] - fMean) * (values[i] - fMean);
+ for (double v : values)
+ vSum += (v - fMean) * (v - fMean);
double fStdDev = sqrt(vSum / (fCount - 1.0));
double xpower4 = 0.0;
@@ -2891,9 +2891,9 @@ void ScInterpreter::ScKurt()
return;
}
- for (size_t i = 0; i < values.size(); i++)
+ for (double v : values)
{
- double dx = (values[i] - fMean) / fStdDev;
+ double dx = (v - fMean) / fStdDev;
xpower4 = xpower4 + (dx * dx * dx * dx);
}
@@ -3277,8 +3277,8 @@ void ScInterpreter::CalculateSkewOrSkewp( bool bSkewp )
double fMean = fSum / fCount;
- for (size_t i = 0; i < values.size(); ++i)
- vSum += (values[i] - fMean) * (values[i] - fMean);
+ for (double v : values)
+ vSum += (v - fMean) * (v - fMean);
double fStdDev = sqrt( vSum / (bSkewp ? fCount : (fCount - 1.0)));
double xcube = 0.0;
@@ -3289,9 +3289,9 @@ void ScInterpreter::CalculateSkewOrSkewp( bool bSkewp )
return;
}
- for (size_t i = 0; i < values.size(); ++i)
+ for (double v : values)
{
- double dx = (values[i] - fMean) / fStdDev;
+ double dx = (v - fMean) / fStdDev;
xcube = xcube + (dx * dx * dx);
}
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index d30c31196427..bd8ca5544a8d 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -242,9 +242,9 @@ void ScParameterClassification::Init()
memset( pData, 0, sizeof(RunData) * (SC_OPCODE_LAST_OPCODE_ID + 1));
// init from specified static data above
- for ( size_t i=0; i < SAL_N_ELEMENTS(pRawData); ++i )
+ for (const auto & i : pRawData)
{
- const RawData* pRaw = &pRawData[i];
+ const RawData* pRaw = &i;
if ( pRaw->eOp > SC_OPCODE_LAST_OPCODE_ID )
{
OSL_ENSURE( pRaw->eOp == ocNone, "RawData OpCode error");
@@ -289,9 +289,9 @@ void ScParameterClassification::Init()
pRun->aData.nParam[CommonData::nMaxParams-1] != Bounds)
pRun->nMinParams = CommonData::nMaxParams;
}
- for ( sal_Int32 j=0; j < CommonData::nMaxParams; ++j )
+ for (ScParameterClassification::Type & j : pRun->aData.nParam)
{
- if ( pRun->aData.nParam[j] == ForceArray || pRun->aData.nParam[j] == ReferenceOrForceArray )
+ if ( j == ForceArray || j == ReferenceOrForceArray )
{
pRun->bHasForceArray = true;
break; // for
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 924bd0b86ffa..daa2ffec1070 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -1270,9 +1270,8 @@ void ScRangePairList::UpdateReference( UpdateRefMode eUpdateRefMode,
SCROW nRow2;
SCTAB nTab2;
rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- for ( size_t i = 0, nPairs = maPairs.size(); i < nPairs; ++i )
+ for (ScRangePair* pR : maPairs)
{
- ScRangePair* pR = maPairs[ i ];
for ( sal_uInt16 j=0; j<2; j++ )
{
ScRange& rRange = pR->GetRange(j);
@@ -1319,9 +1318,8 @@ void ScRangePairList::DeleteOnTab( SCTAB nTab )
ScRangePair* ScRangePairList::Find( const ScAddress& rAdr ) const
{
- for ( size_t j = 0, nListCount = maPairs.size(); j < nListCount; j++ )
+ for (ScRangePair* pR : maPairs)
{
- ScRangePair* pR = maPairs[ j ];
if ( pR->GetRange(0).In( rAdr ) )
return pR;
}
@@ -1330,9 +1328,8 @@ ScRangePair* ScRangePairList::Find( const ScAddress& rAdr ) const
ScRangePair* ScRangePairList::Find( const ScRange& rRange ) const
{
- for ( size_t j = 0, nListCount = maPairs.size(); j < nListCount; j++ )
+ for (ScRangePair* pR : maPairs)
{
- ScRangePair* pR = maPairs[ j ];
if ( pR->GetRange(0) == rRange )
return pR;
}
@@ -1342,9 +1339,9 @@ ScRangePair* ScRangePairList::Find( const ScRange& rRange ) const
ScRangePairList* ScRangePairList::Clone() const
{
ScRangePairList* pNew = new ScRangePairList;
- for ( size_t j = 0, nListCount = maPairs.size(); j < nListCount; j++ )
+ for (const ScRangePair* pR : maPairs)
{
- pNew->Append( *maPairs[ j ] );
+ pNew->Append( *pR );
}
return pNew;
}