From 8d54796bf152499ecbe61788be64c9035f725dfa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 19 May 2014 10:02:29 +0200 Subject: enhance pass-by-ref plugin to detect large arguments Detect arguments larger than 64 chars passed by value. Change-Id: I9b0ea9ccb99d115984a26eab67c9cf6afd5f6cae Signed-off-by: Stephan Bergmann --- sc/inc/column.hxx | 4 ++-- sc/source/core/data/column.cxx | 2 +- sc/source/core/data/column2.cxx | 10 +++++----- sc/source/core/data/column3.cxx | 6 +++--- sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx | 2 +- .../ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx | 2 +- sc/source/ui/inc/TableFillingAndNavigationTools.hxx | 2 +- sc/source/ui/inc/namedefdlg.hxx | 2 +- sc/source/ui/namedlg/namedefdlg.cxx | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sc') diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index fb49bf7e53a2..421205650886 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -499,7 +499,7 @@ public: * update script types on demand if they have not been determined. */ sal_uInt8 GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, - sc::CellStoreType::iterator itr); + const sc::CellStoreType::iterator& itr); void SetScriptType( SCROW nRow, sal_uInt8 nType ); void UpdateScriptTypes( SCROW nRow1, SCROW nRow2 ); @@ -611,7 +611,7 @@ private: void ActivateNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true ); void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength ); void BroadcastNewCell( SCROW nRow ); - bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ); + bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr ); const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index f4e00c6614c6..485f5e8d8634 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2874,7 +2874,7 @@ class FindEditCellsHandler public: FindEditCellsHandler(ScColumn& rColumn, sc::CellTextAttrStoreType& rAttrs, - sc::CellStoreType::iterator rCellItr) : + const sc::CellStoreType::iterator& rCellItr) : mrColumn(rColumn), miAttrPos(rAttrs.begin()), miCellPos(rCellItr) {} bool operator() (size_t, const EditTextObject*) diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index d6019bed5f30..7e5a4a67ca3e 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1830,7 +1830,7 @@ sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const } sal_uInt8 ScColumn::GetRangeScriptType( - sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, sc::CellStoreType::iterator itrCells ) + sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, const sc::CellStoreType::iterator& itrCells ) { if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2) return 0; @@ -2183,7 +2183,7 @@ namespace { template void getBlockIterators( - sc::CellStoreType::iterator it, size_t& rLenRemain, + const sc::CellStoreType::iterator& it, size_t& rLenRemain, typename _Blk::iterator& rData, typename _Blk::iterator& rDataEnd ) { rData = _Blk::begin(*it->data); @@ -2203,14 +2203,14 @@ void getBlockIterators( bool appendToBlock( ScDocument* pDoc, sc::FormulaGroupContext& rCxt, sc::FormulaGroupContext::ColArray& rColArray, - size_t nPos, size_t nArrayLen, sc::CellStoreType::iterator it, const sc::CellStoreType::iterator& itEnd ) + size_t nPos, size_t nArrayLen, const sc::CellStoreType::iterator& _it, const sc::CellStoreType::iterator& itEnd ) { svl::SharedStringPool& rPool = pDoc->GetSharedStringPool(); size_t nLenRemain = nArrayLen - nPos; double fNan; rtl::math::setNan(&fNan); - for (; it != itEnd; ++it) + for (sc::CellStoreType::iterator it = _it; it != itEnd; ++it) { switch (it->type) { @@ -2343,7 +2343,7 @@ void copyFirstStringBlock( sc::FormulaGroupContext::ColArray* copyFirstFormulaBlock( - sc::FormulaGroupContext& rCxt, sc::CellStoreType::iterator itBlk, size_t nArrayLen, + sc::FormulaGroupContext& rCxt, const sc::CellStoreType::iterator& itBlk, size_t nArrayLen, SCTAB nTab, SCCOL nCol ) { double fNan; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index e8769823ea40..3d447d121289 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -520,7 +520,7 @@ void ScColumn::BroadcastNewCell( SCROW nRow ) Broadcast(nRow); } -bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr ) +bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr ) { if (rAttr.mnScriptType != SC_SCRIPTTYPE_UNKNOWN) // Already updated. Nothing to do. @@ -533,9 +533,9 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellSt return false; sc::CellStoreType::position_type pos = maCells.position(itr, nRow); - itr = pos.first; + sc::CellStoreType::iterator itr2 = pos.first; size_t nOffset = pos.second; - ScRefCellValue aCell = GetCellValue( itr, nOffset ); + ScRefCellValue aCell = GetCellValue( itr2, nOffset ); ScAddress aPos(nCol, nRow, nTab); const SfxItemSet* pCondSet = NULL; diff --git a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx index d779f67fe422..ca9de2431425 100644 --- a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx +++ b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx @@ -30,7 +30,7 @@ namespace { void lclWriteCorrelationFormulas( AddressWalkerWriter& aOutput, FormulaTemplate& aTemplate, - ScRangeList aRangeList, const OUString& aTemplateString) + const ScRangeList& aRangeList, const OUString& aTemplateString) { for (size_t i = 0; i < aRangeList.size(); i++) { diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx index c39302bb38af..51b9541dabc7 100644 --- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx +++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx @@ -64,7 +64,7 @@ void FormulaTemplate::applyRange(const OUString& aVariable, ScRange aRange) mTemplate = mTemplate.replaceAll(aVariable, aString); } -void FormulaTemplate::applyRangeList(const OUString& aVariable, ScRangeList aRangeList) +void FormulaTemplate::applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList) { OUString aString; aRangeList.Format(aString, SCR_ABS, mDocument); diff --git a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx index 17f12234f785..853fa5ad3a50 100644 --- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx +++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx @@ -45,7 +45,7 @@ public: void autoReplaceAddress(const OUString& aVariable, ScAddress aAddress); void applyRange(const OUString& aVariable, ScRange aRange); - void applyRangeList(const OUString& aVariable, ScRangeList aRangeList); + void applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList); void applyAddress(const OUString& aVariable, ScAddress aAddress); void applyString(const OUString& aVariable, const OUString& aValue); void applyNumber(const OUString& aVariable, sal_Int32 aValue); diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx index 098b9101c733..2b262a642fe6 100644 --- a/sc/source/ui/inc/namedefdlg.hxx +++ b/sc/source/ui/inc/namedefdlg.hxx @@ -74,7 +74,7 @@ protected: public: ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, - ScViewData* pViewData, std::map aRangeMap, + ScViewData* pViewData, const std::map& aRangeMap, const ScAddress& aCursorPos, const bool bUndo); virtual ~ScNameDefDlg() {}; diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 83ed95ee9672..3ab5d2fa9b61 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -33,7 +33,7 @@ #define ABS_DREF3D ABS_DREF | SCA_TAB_3D ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, - ScViewData* pViewData, std::map aRangeMap, + ScViewData* pViewData, const std::map& aRangeMap, const ScAddress& aCursorPos, const bool bUndo ) : ScAnyRefDlg( pB, pCW, pParent, "DefineNameDialog", "modules/scalc/ui/definename.ui" ) , -- cgit