diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-02-06 23:49:20 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-07 20:12:44 +0000 |
commit | e44e7942929ba063715861abe53412c6d867cd50 (patch) | |
tree | e1a4a648af95243ef7b6ad14d3eaacea3e861eb7 | |
parent | 1f7c6c54eda9bfcd1e4ef9136ccdfec434efcd69 (diff) |
fdo#74474: sw: fix Label wizard document creation (2 in 1)
Infinite loop in InsertLabEnvText() due to wrong handling of starting '<'.
(regression from fa469b2e00d83459faebe4c1fcb3ea1aac5fb20d)
(cherry picked from commit 7e61bfe813347949307cdf2876ead3cc42e4cd7b)
The function ReplacePoint() was changed to return a value but not all
call sites were adapted.
(regression from 263153842741d7ce21cc0bf1c5296a55a1138024)
(cherry picked from commit 9dbe5a576330b7fadd8838249d07aafe548a4ee2)
Change-Id: I33efd9ce61611e025dfc76047187826aa0f8dd84
Reviewed-on: https://gerrit.libreoffice.org/7931
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/app/appenv.cxx | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index b550bfbfb0b3..8463ac85911c 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -512,8 +512,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, sal_uInt16 ins ) } // At this point the "real" case variable has to be used - OUString sTmpName( rStr ); - ::ReplacePoint( sTmpName ); + OUString const sTmpName( ::ReplacePoint(rStr) ); if( !ins ) { diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index 63b614a6637a..acf868499f9c 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -88,10 +88,11 @@ OUString InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const OUString& r bool bField = false; sal_Int32 nPos = aLine.indexOf( '<' ); - if ( nPos != -1) + if (0 != nPos) { - sTmpText = aLine.copy( 0, nPos ); - aLine = aLine.copy( nPos ); + sal_Int32 const nCopy((nPos != -1) ? nPos : aLine.getLength()); + sTmpText = aLine.copy(0, nCopy); + aLine = aLine.copy(nCopy); } else { @@ -111,7 +112,7 @@ OUString InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const OUString& r sal_uInt16 nCnt = comphelper::string::getTokenCount(sDBName, '.'); if (nCnt >= 3) { - ::ReplacePoint(sDBName, true); + sDBName = ::ReplacePoint(sDBName, true); SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyOUStr, 0, &rSh ); rFldMgr.InsertFld( aData ); sRet = sDBName; |