From 4ef697e670aaa7cac547846ac961e6d26aac816d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 14 Sep 2020 11:04:05 +0100 Subject: ScRefUpdate::DoTranspose always dereferences its ScDocument* argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If61bdc93954177792ec750836a87d7f9a1ba1730 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102665 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/source/core/data/formulacell.cxx | 2 +- sc/source/core/inc/refupdat.hxx | 2 +- sc/source/core/tool/refupdat.cxx | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 50fd18bf4293..5d3502c2dfcf 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3813,7 +3813,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD SCCOL nRelPosX = aOldPos.Col(); SCROW nRelPosY = aOldPos.Row(); SCTAB nRelPosZ = aOldPos.Tab(); - ScRefUpdate::DoTranspose( nRelPosX, nRelPosY, nRelPosZ, pDocument, aDestRange, rSource.aStart ); + ScRefUpdate::DoTranspose( nRelPosX, nRelPosY, nRelPosZ, *pDocument, aDestRange, rSource.aStart ); aOldPos.Set( nRelPosX, nRelPosY, nRelPosZ ); bPosChanged = true; } diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx index 52c1402e6283..1601c66bfe6c 100644 --- a/sc/source/core/inc/refupdat.hxx +++ b/sc/source/core/inc/refupdat.hxx @@ -62,7 +62,7 @@ public: static ScRefUpdateRes UpdateTranspose( const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest, ScRange& rRef ); - static void DoTranspose( SCCOL& rCol, SCROW& rRow, SCTAB& rTab, const ScDocument* pDoc, + static void DoTranspose( SCCOL& rCol, SCROW& rRow, SCTAB& rTab, const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest ); static ScRefUpdateRes UpdateGrow( diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index 68cc9d173414..3a1693edebfc 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -507,13 +507,13 @@ void ScRefUpdate::MoveRelWrap( const ScDocument& rDoc, const ScAddress& rPos, } void ScRefUpdate::DoTranspose( SCCOL& rCol, SCROW& rRow, SCTAB& rTab, - const ScDocument* pDoc, const ScRange& rSource, const ScAddress& rDest ) + const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest ) { SCTAB nDz = rDest.Tab() - rSource.aStart.Tab(); if (nDz) { SCTAB nNewTab = rTab+nDz; - SCTAB nCount = pDoc->GetTableCount(); + SCTAB nCount = rDoc.GetTableCount(); while (nNewTab<0) nNewTab = sal::static_int_cast( nNewTab + nCount ); while (nNewTab>=nCount) nNewTab = sal::static_int_cast( nNewTab - nCount ); rTab = nNewTab; @@ -542,8 +542,8 @@ ScRefUpdateRes ScRefUpdate::UpdateTranspose( SCCOL nCol1 = rRef.aStart.Col(), nCol2 = rRef.aEnd.Col(); SCROW nRow1 = rRef.aStart.Row(), nRow2 = rRef.aEnd.Row(); SCTAB nTab1 = rRef.aStart.Tab(), nTab2 = rRef.aEnd.Tab(); - DoTranspose(nCol1, nRow1, nTab1, &rDoc, rSource, rDest); - DoTranspose(nCol2, nRow2, nTab2, &rDoc, rSource, rDest); + DoTranspose(nCol1, nRow1, nTab1, rDoc, rSource, rDest); + DoTranspose(nCol2, nRow2, nTab2, rDoc, rSource, rDest); rRef.aStart = ScAddress(nCol1, nRow1, nTab1); rRef.aEnd = ScAddress(nCol2, nRow2, nTab2); eRet = UR_UPDATED; -- cgit