diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-14 11:29:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-15 11:13:11 +0200 |
commit | 129ae164844c2d635fe7f152ad0c47c02e08b9d4 (patch) | |
tree | 636c0567dac582dccfc36166bdb4ef2cff0f4c6c /sc/source | |
parent | 2943c7b1d7b8e6c087f1ad5f1be9ed8f5bbc027c (diff) |
ScRangeList::ParseAny ScDocument* argument dereferenced on all used paths
Change-Id: Ie41a1b58f8bec0e8197aa49aa92522f11de40a28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102667
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/documen5.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/address.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/rangelst.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xicontent.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xilink.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheetbuffer.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/dbnamdlg.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/arealink.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/anyrefdg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/crnrdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/optsolver.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/areasdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/addruno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 6 |
19 files changed, 28 insertions, 28 deletions
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index 71a4b97f1e73..2ae03f5f299b 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -381,7 +381,7 @@ void ScDocument::RestoreChartListener( const OUString& rName ) { ScRange aRange; ScAddress::Details aDetails(GetAddressConvention(), 0, 0); - if ( aRange.ParseAny( rRepresentation, this, aDetails ) & ScRefFlags::VALID ) + if ( aRange.ParseAny( rRepresentation, *this, aDetails ) & ScRefFlags::VALID ) aRanges->push_back( aRange ); } diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index eaccf67a1149..ffa9fa0ab705 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1768,16 +1768,16 @@ ScRefFlags ScRange::Parse( const OUString& rString, const ScDocument* pDoc, } // Accept a full range, or an address -ScRefFlags ScRange::ParseAny( const OUString& rString, const ScDocument* pDoc, +ScRefFlags ScRange::ParseAny( const OUString& rString, const ScDocument& rDoc, const ScAddress::Details& rDetails ) { - ScRefFlags nRet = Parse( rString, pDoc, rDetails ); + ScRefFlags nRet = Parse( rString, &rDoc, rDetails ); const ScRefFlags nValid = ScRefFlags::VALID | ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID; if ( (nRet & nValid) != nValid ) { ScAddress aAdr(aStart);//initialize with currentPos as fallback for table number - nRet = aAdr.Parse( rString, pDoc, rDetails ); + nRet = aAdr.Parse( rString, &rDoc, rDetails ); if ( nRet & ScRefFlags::VALID ) aStart = aEnd = aAdr; } diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 4121f2c5baea..12d4e64678f4 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -121,7 +121,7 @@ ScRefFlags ScRangeList::Parse( const OUString& rStr, const ScDocument& rDoc, { const OUString aOne = rStr.getToken( 0, cDelimiter, nPos ); aRange.aStart.SetTab( nTab ); // default tab if not specified - ScRefFlags nRes = aRange.ParseAny( aOne, &rDoc, eConv ); + ScRefFlags nRes = aRange.ParseAny( aOne, rDoc, eConv ); ScRefFlags nEndRangeBits = ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID; ScRefFlags nTmp1 = nRes & ScRefFlags::BITS; ScRefFlags nTmp2 = nRes & nEndRangeBits; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 8a0c65516933..814b284cba22 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -339,7 +339,7 @@ OUString XclImpHyperlink::ReadEmbeddedData( XclImpStream& rStrm ) { ScDocument& rDoc = rRoot.GetDoc(); ScRange aRange; - if ((aRange.ParseAny( xTextMark->copy( nSepPos + 1 ), &rDoc, formula::FormulaGrammar::CONV_XL_R1C1) + if ((aRange.ParseAny( xTextMark->copy( nSepPos + 1 ), rDoc, formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO) xTextMark.reset( new OUString( xTextMark->replaceAt( nSepPos, 1, OUString( '.' )))); } diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 9d4e1c8342a3..eaa42ea0de0b 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -479,7 +479,7 @@ bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl, return false; ScRange aRange; - ScRefFlags nRes = aRange.ParseAny(aRangeStr, &rDoc, formula::FormulaGrammar::CONV_XL_R1C1); + ScRefFlags nRes = aRange.ParseAny(aRangeStr, rDoc, formula::FormulaGrammar::CONV_XL_R1C1); if ((nRes & ScRefFlags::VALID) == ScRefFlags::ZERO) return false; diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index 31040f4f6984..94e93dbfd1a1 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -128,7 +128,7 @@ void WorksheetBuffer::convertSheetNameRef( OUString& sSheetNameRef ) const if (nSepPos < sSheetNameRef.getLength() - 1) { ScRange aRange; - if ((aRange.ParseAny( sSheetNameRef.copy( nSepPos + 1 ), &getScDocument(), + if ((aRange.ParseAny( sSheetNameRef.copy( nSepPos + 1 ), getScDocument(), formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO) sSheetNameRef = sSheetNameRef.replaceAt( nSepPos, 1, OUString( '.' ) ); } diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index a04ee80646fb..c41e6e7709e8 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -995,7 +995,7 @@ OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) c { ScRange aRange; const ScDocumentImport& rDoc = getDocImport(); - if ((aRange.ParseAny( aUrl.copy( nSepPos + 1 ), &rDoc.getDoc(), + if ((aRange.ParseAny( aUrl.copy( nSepPos + 1 ), rDoc.getDoc(), formula::FormulaGrammar::CONV_XL_R1C1) & ScRefFlags::VALID) == ScRefFlags::ZERO) aUrl = aUrl.replaceAt( nSepPos, 1, OUString( '.' ) ); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 525b09723332..d3ad4244d7de 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -381,7 +381,7 @@ handle_r1c1: { OUString aTest = rFormula.copy( nStart, nPos-nStart ); const ScAddress::Details aAddrDetails( rDoc, aCursorPos ); - ScRefFlags nFlags = aRange.ParseAny( aTest, &rDoc, aAddrDetails ); + ScRefFlags nFlags = aRange.ParseAny( aTest, rDoc, aAddrDetails ); if ( nFlags & ScRefFlags::VALID ) { // Set tables if not specified diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 5397b09f6733..7db170669a97 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2490,7 +2490,7 @@ void ScPosWnd::DoEnter() // Note that SID_CURRENTCELL always expects address to // be in Calc A1 format. Convert the text. ScRange aRange(0,0, rViewData.GetTabNo()); - aRange.ParseAny(aText, &rDoc, rDoc.GetAddressConvention()); + aRange.ParseAny(aText, rDoc, rDoc.GetAddressConvention()); aText = aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, ::formula::FormulaGrammar::CONV_OOO); } diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 915dbe1adda0..45c0b5c71dd4 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -412,7 +412,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void) // because editing can be done now, parsing is needed first ScRange aTmpRange; OUString aText = m_xEdAssign->GetText(); - if ( aTmpRange.ParseAny( aText, &rDoc, aAddrDetails ) & ScRefFlags::VALID ) + if ( aTmpRange.ParseAny( aText, rDoc, aAddrDetails ) & ScRefFlags::VALID ) { theCurArea = aTmpRange; ScAddress aStart = theCurArea.aStart; @@ -614,7 +614,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AssModifyHdl, formula::RefEdit&, void) ScRange aTmpRange; OUString aText = m_xEdAssign->GetText(); - if ( aTmpRange.ParseAny( aText, &rDoc, aAddrDetails ) & ScRefFlags::VALID ) + if ( aTmpRange.ParseAny( aText, rDoc, aAddrDetails ) & ScRefFlags::VALID ) theCurArea = aTmpRange; if (!aText.isEmpty() && !m_xEdName->get_active_text().isEmpty()) diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index d34d1c7ea8d8..ac742334ef57 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -211,7 +211,7 @@ bool ScAreaLink::FindExtRange( ScRange& rRange, const ScDocument& rSrcDoc, const if (!bFound) // direct reference (range or cell) { ScAddress::Details aDetails(rSrcDoc.GetAddressConvention(), 0, 0); - if ( rRange.ParseAny( rAreaName, &rSrcDoc, aDetails ) & ScRefFlags::VALID ) + if ( rRange.ParseAny( rAreaName, rSrcDoc, aDetails ) & ScRefFlags::VALID ) bFound = true; } return bFound; diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index f04c57b6ab98..6f25468f716b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -356,7 +356,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) } ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0); - bool bValid = (aSingleRange.ParseAny(aRangeName, &rDoc, aDetails) & ScRefFlags::VALID) == ScRefFlags::ZERO; + bool bValid = (aSingleRange.ParseAny(aRangeName, rDoc, aDetails) & ScRefFlags::VALID) == ScRefFlags::ZERO; if (!bValid) { aRangeListRef = new ScRangeList; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 92c3727ded49..d8d7777a5efb 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -152,7 +152,7 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUStr ScRange aRange; OUString aRangeStr( rStr.getToken( 0, ';', nIdx ) ); - ScRefFlags nFlags = aRange.ParseAny( aRangeStr, &rDoc, aDetails ); + ScRefFlags nFlags = aRange.ParseAny( aRangeStr, rDoc, aDetails ); if ( nFlags & ScRefFlags::VALID ) { if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO ) diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 0b0e6be31079..4c3e1749e6fc 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -519,8 +519,8 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, weld::Button&, void) const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); ScRange aRange1, aRange2; - bool bOk1 = (aRange1.ParseAny( aNewArea, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID; - if ( bOk1 && (aRange2.ParseAny( aNewData, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID) + bool bOk1 = (aRange1.ParseAny( aNewArea, *pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID; + if ( bOk1 && (aRange2.ParseAny( aNewData, *pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID) { theCurArea = aRange1; AdjustColRowData( aRange2 ); @@ -693,7 +693,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1DataModifyHdl, formula::RefEdit&, v if (!aNewArea.isEmpty() && pDoc) { ScRange aRange; - if ( (aRange.ParseAny(aNewArea, pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) + if ( (aRange.ParseAny(aNewArea, *pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) { SetColRowData( aRange ); bValid = true; @@ -725,7 +725,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, formula::RefEdit&, v if ( !aNewData.isEmpty() ) { ScRange aRange; - if ( (aRange.ParseAny(aNewData, pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) + if ( (aRange.ParseAny(aNewData, *pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) { AdjustColRowData( aRange ); m_xBtnAdd->set_sensitive(true); diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 8f0378724828..763ca762bee6 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -753,7 +753,7 @@ void ScOptSolverDlg::ShowError( bool bCondition, formula::RefEdit* pFocus ) bool ScOptSolverDlg::ParseRef( ScRange& rRange, const OUString& rInput, bool bAllowRange ) { ScAddress::Details aDetails(mrDoc.GetAddressConvention(), 0, 0); - ScRefFlags nFlags = rRange.ParseAny( rInput, &mrDoc, aDetails ); + ScRefFlags nFlags = rRange.ParseAny( rInput, mrDoc, aDetails ); if ( nFlags & ScRefFlags::VALID ) { if ( (nFlags & ScRefFlags::TAB_3D) == ScRefFlags::ZERO) diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index ef0a300b20aa..9ac58fb569d6 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -419,7 +419,7 @@ void ScPrintAreasDlg::Impl_FillLists() OUString aName = rEntry.second->GetName(); OUString aSymbol; rEntry.second->GetSymbol(aSymbol); - if (aRange.ParseAny(aSymbol, pDoc, eConv) & ScRefFlags::VALID) + if (aRange.ParseAny(aSymbol, *pDoc, eConv) & ScRefFlags::VALID) { if (rEntry.second->HasType(ScRangeData::Type::PrintArea)) { diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index ff7d9328d891..4a7410b89281 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -65,7 +65,7 @@ bool ScAddressConversionObj::ParseUIString( const OUString& rUIString, ::formula bool bSuccess = false; if ( bIsRange ) { - ScRefFlags nResult = aRange.ParseAny( rUIString, &rDoc, eConv ); + ScRefFlags nResult = aRange.ParseAny( rUIString, rDoc, eConv ); if ( nResult & ScRefFlags::VALID ) { if ( ( nResult & ScRefFlags::TAB_3D ) == ScRefFlags::ZERO ) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 74455762d6db..a641502d6975 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -4322,7 +4322,7 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries, // range contained in selection? (sheet must be specified) ScRange aCellRange; - ScRefFlags nParse = aCellRange.ParseAny( rName, &pDocSh->GetDocument() ); + ScRefFlags nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() ); if ( (nParse & ( ScRefFlags::VALID | ScRefFlags::TAB_3D )) == ( ScRefFlags::VALID | ScRefFlags::TAB_3D )) { @@ -4750,7 +4750,7 @@ uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName( ScRange aCellRange; bool bFound = false; - ScRefFlags nParse = aCellRange.ParseAny( aName, &rDoc, rDetails ); + ScRefFlags nParse = aCellRange.ParseAny( aName, rDoc, rDetails ); if ( nParse & ScRefFlags::VALID ) { if ( !(nParse & ScRefFlags::TAB_3D) ) // no sheet specified -> this sheet diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index b21b3dbe1d43..a731910e94c5 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1048,7 +1048,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, do { const OUString aToken = pPrint->getToken(0, sep, nPos); - if ( aRange.ParseAny( aToken, &rDoc, aDetails ) & ScRefFlags::VALID ) + if ( aRange.ParseAny( aToken, rDoc, aDetails ) & ScRefFlags::VALID ) rDoc.AddPrintRange( nTab, aRange ); } while (nPos >= 0); @@ -1080,7 +1080,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, if ( pRepCol->isEmpty() ) rDoc.SetRepeatColRange( nTab, nullptr ); else - if ( aRange.ParseAny( *pRepCol, &rDoc, aDetails ) & ScRefFlags::VALID ) + if ( aRange.ParseAny( *pRepCol, rDoc, aDetails ) & ScRefFlags::VALID ) rDoc.SetRepeatColRange( nTab, std::unique_ptr<ScRange>(new ScRange(aRange)) ); } @@ -1091,7 +1091,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, if ( pRepRow->isEmpty() ) rDoc.SetRepeatRowRange( nTab, nullptr ); else - if ( aRange.ParseAny( *pRepRow, &rDoc, aDetails ) & ScRefFlags::VALID ) + if ( aRange.ParseAny( *pRepRow, rDoc, aDetails ) & ScRefFlags::VALID ) rDoc.SetRepeatRowRange( nTab, std::unique_ptr<ScRange>(new ScRange(aRange)) ); } } |