diff options
author | Tor Lillqvist <tml@collabora.com> | 2017-06-16 16:57:40 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2017-06-19 12:22:51 +0300 |
commit | a056978ace7e355fa9a6fc0e1488013e5836d262 (patch) | |
tree | eb2f074555f30e12a67e6f2fbc925228aa7cd06a /formula | |
parent | c2ce3a2dbebd17146aa5c073794eebcf411e8bed (diff) |
Drop one friend declaration and instead add some useful member functions
Change-Id: I9a947078d9f2c1c06cb8524be137ba5e36e97a0b
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 14 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 310ddb2346f3..1ba70a90f81d 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1264,7 +1264,7 @@ bool FormulaCompiler::GetToken() { FormulaTokenRef pSpacesToken; short nWasColRowName; - if ( maArrIterator.mnIndex > 0 && pArr->pCode[ maArrIterator.mnIndex-1 ]->GetOpCode() == ocColRowName ) + if ( pArr->OpCodeBefore( maArrIterator.GetIndex() ) == ocColRowName ) nWasColRowName = 1; else nWasColRowName = 0; @@ -1526,9 +1526,9 @@ void FormulaCompiler::Factor() // nSepPos+4 if expression continues after the call because // we just called NextToken() to move away from it. if (pc >= 2 && (maArrIterator.mnIndex == nSepPos + 3 || maArrIterator.mnIndex == nSepPos + 4) && - pArr->pCode[nSepPos+1]->GetType() == svDouble && - pArr->pCode[nSepPos+1]->GetDouble() != 1.0 && - pArr->pCode[nSepPos+2]->GetOpCode() == ocClose && + pArr->TokenAt(nSepPos+1)->GetType() == svDouble && + pArr->TokenAt(nSepPos+1)->GetDouble() != 1.0 && + pArr->TokenAt(nSepPos+2)->GetOpCode() == ocClose && pArr->RemoveToken( nSepPos, 2) == 2) { maArrIterator.AfterRemoveToken( nSepPos, 2); @@ -2014,11 +2014,7 @@ bool FormulaCompiler::CompileTokenArray() while( pStack ) PopTokenArray(); if( pc ) - { - pArr->pRPN = new FormulaToken*[ pc ]; - pArr->nRPN = pc; - memcpy( pArr->pRPN, pData, pc * sizeof( FormulaToken* ) ); - } + pArr->CreateNewRPNArrayFromData( pData, pc ); // once an error, always an error if( pArr->GetCodeError() == FormulaError::NONE && nErrorBeforePop != FormulaError::NONE ) diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 78c69ea7360a..51f3e0fa928d 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -479,7 +479,7 @@ FormulaToken* FormulaTokenArray::FirstToken() const return pCode[0]; } -FormulaToken* FormulaTokenArray::PeekPrev( sal_uInt16 & nIdx ) +FormulaToken* FormulaTokenArray::PeekPrev( sal_uInt16 & nIdx ) const { if (0 < nIdx && nIdx <= nLen) return pCode[--nIdx]; |