Kaydet (Commit) b0caeafc authored tarafından Matteo Casalin's avatar Matteo Casalin

Bail out early and minor optimizations

Change-Id: Iec521a951e53386fc2bd780926d4a372e5fb05bc
üst d72c7903
...@@ -2124,7 +2124,6 @@ uno::Reference< XHyphenatedWord > SwDoc::Hyphenate( ...@@ -2124,7 +2124,6 @@ uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
static bool lcl_GetTokenToParaBreak( OUString& rStr, OUString& rRet, bool bRegExpRplc ) static bool lcl_GetTokenToParaBreak( OUString& rStr, OUString& rRet, bool bRegExpRplc )
{ {
bool bRet = false;
if( bRegExpRplc ) if( bRegExpRplc )
{ {
sal_Int32 nPos = 0; sal_Int32 nPos = 0;
...@@ -2139,24 +2138,23 @@ static bool lcl_GetTokenToParaBreak( OUString& rStr, OUString& rRet, bool bRegEx ...@@ -2139,24 +2138,23 @@ static bool lcl_GetTokenToParaBreak( OUString& rStr, OUString& rRet, bool bRegEx
// Has this been escaped? // Has this been escaped?
if( nPos && '\\' == rStr[nPos-1]) if( nPos && '\\' == rStr[nPos-1])
{ {
if( ++nPos >= rStr.getLength() ) nPos += sPara.getLength();
if( nPos >= rStr.getLength() )
{
break; break;
}
} }
else else
{ {
rRet = rStr.copy( 0, nPos ); rRet = rStr.copy( 0, nPos );
rStr = rStr.copy( nPos + sPara.getLength() ); rStr = rStr.copy( nPos + sPara.getLength() );
bRet = true; return true;
break;
} }
} }
} }
if( !bRet ) rRet = rStr;
{ rStr = OUString();
rRet = rStr; return false;
rStr = OUString();
}
return bRet;
} }
bool SwDoc::ReplaceRange( SwPaM& rPam, const OUString& rStr, bool SwDoc::ReplaceRange( SwPaM& rPam, const OUString& rStr,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment