[Libreoffice-commits] core.git: editeng/source include/svtools svtools/source
Caolán McNamara
caolanm at redhat.com
Tue Mar 27 13:49:57 UTC 2018
editeng/source/rtf/svxrtf.cxx | 6 +-----
include/svtools/svparser.hxx | 1 -
svtools/source/svrtf/parrtf.cxx | 8 +-------
svtools/source/svrtf/svparser.cxx | 5 -----
4 files changed, 2 insertions(+), 18 deletions(-)
New commits:
commit 19ca4e8a5eb40f3c776a8089a4a043e7fe4a9247
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Mar 27 12:08:15 2018 +0100
Resolves: tdf#116540 Revert "ofz infinite loop"
This reverts commit e4551b905e12aa92b7509d9b994bfae5dec3d8e0.
Change-Id: I95634dd166c51586b5da47b996993a098823ca32
Reviewed-on: https://gerrit.libreoffice.org/51941
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 6c4ff8b887df..1b0efa0617b0 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -288,11 +288,8 @@ void SvxRTFParser::ReadStyleTable()
bIsInReadStyleTab = true;
bChkStyleAttr = false; // Do not check Attribute against the Styles
- bool bLooping = false;
-
- while (_nOpenBrakets && IsParserWorking() && !bLooping)
+ while( _nOpenBrakets && IsParserWorking() )
{
- auto nCurrentTokenIndex = m_nTokenIndex;
int nToken = GetNextToken();
switch( nToken )
{
@@ -375,7 +372,6 @@ void SvxRTFParser::ReadStyleTable()
}
break;
}
- bLooping = nCurrentTokenIndex == m_nTokenIndex;
}
pStyle.reset(); // Delete the Last Style
SkipToken(); // the closing brace is evaluated "above"
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
index bb046d8083f4..53564c727cdd 100644
--- a/include/svtools/svparser.hxx
+++ b/include/svtools/svparser.hxx
@@ -54,7 +54,6 @@ protected:
sal_uLong nlLinePos; // current column number
std::unique_ptr<SvParser_Impl<T>> pImplData; // internal data
- long m_nTokenIndex; // current token index to detect loops for seeking backwards
long nTokenValue; // additional value (RTF)
bool bTokenHasValue; // indicates whether nTokenValue is valid
SvParserState eState; // status also in derived classes
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index 1ac63c32c342..b6b4ffca6ddf 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -602,12 +602,8 @@ void SvRTFParser::Continue( int nToken )
if( !nToken )
nToken = GetNextToken();
- bool bLooping = false;
-
- while (IsParserWorking() && !bLooping)
+ while( IsParserWorking() )
{
- auto nCurrentTokenIndex = m_nTokenIndex;
-
SaveState( nToken );
switch( nToken )
{
@@ -664,8 +660,6 @@ NEXTTOKEN:
SaveState( 0 ); // processed till here,
// continue with new token!
nToken = GetNextToken();
-
- bLooping = nCurrentTokenIndex == m_nTokenIndex;
}
if( SvParserState::Accepted == eState && 0 < nOpenBrakets )
eState = SvParserState::Error;
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 4ba540ce96d9..27e6c1eede3d 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -76,7 +76,6 @@ SvParser<T>::SvParser( SvStream& rIn, sal_uInt8 nStackSize )
, nlLineNr( 1 )
, nlLinePos( 1 )
, pImplData( nullptr )
- , m_nTokenIndex(0)
, nTokenValue( 0 )
, bTokenHasValue( false )
, eState( SvParserState::NotStarted )
@@ -476,7 +475,6 @@ T SvParser<T>::GetNextToken()
bTokenHasValue = pTokenStackPos->bTokenHasValue;
aToken = pTokenStackPos->sToken;
nRet = pTokenStackPos->nTokenId;
- ++m_nTokenIndex;
}
// no, now push actual value on stack
else if( SvParserState::Working == eState )
@@ -485,7 +483,6 @@ T SvParser<T>::GetNextToken()
pTokenStackPos->nTokenValue = nTokenValue;
pTokenStackPos->bTokenHasValue = bTokenHasValue;
pTokenStackPos->nTokenId = nRet;
- ++m_nTokenIndex;
}
else if( SvParserState::Accepted != eState && SvParserState::Pending != eState )
eState = SvParserState::Error; // an error occurred
@@ -504,8 +501,6 @@ T SvParser<T>::SkipToken( short nCnt ) // "skip" n Tokens backward
nTmp = nTokenStackSize;
nTokenStackPos = sal_uInt8(nTmp);
- m_nTokenIndex -= nTmp;
-
// restore values
aToken = pTokenStackPos->sToken;
nTokenValue = pTokenStackPos->nTokenValue;
More information about the Libreoffice-commits
mailing list