[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/source

Michael Stahl mstahl at redhat.com
Fri Feb 7 12:13:11 PST 2014


 sw/source/core/bastyp/calc.cxx |    3 +--
 sw/source/ui/app/appenv.cxx    |    9 +++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit e44e7942929ba063715861abe53412c6d867cd50
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 6 23:49:20 2014 +0100

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index b550bfb..8463ac8 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 63b614a6..acf8684 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;


More information about the Libreoffice-commits mailing list