[PATCH] Fixes fdo#64237 by modifying the underlyning string

Arnaud Versini (via Code Review) gerrit at gerrit.libreoffice.org
Sun May 12 08:01:57 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3870

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/70/3870/1

Fixes fdo#64237 by modifying the underlyning string

Change-Id: I7d387e40464b53a55524bf950b8d413cf8468376
---
M sw/source/core/text/guess.cxx
1 file changed, 4 insertions(+), 4 deletions(-)



diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 637372f..03628da 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -275,7 +275,7 @@
                 aDebugString = rInf.GetTxt();
 #endif
 
-                OUString rOldTxt = rInf.GetTxt();
+                OUString& rOldTxt = const_cast<OUString&> (rInf.GetTxt());
                 rOldTxt = rOldTxt.replaceAt( rInf.GetIdx() - 1, 1, aTxt );
                 rInf.SetIdx( rInf.GetIdx() + nFieldDiff );
             }
@@ -487,9 +487,9 @@
                     "I've got field trouble, part2!" );
             nCutPos = nCutPos - nFieldDiff;
 
-            XubString& rOldTxt = (XubString&)rInf.GetTxt();
-            rOldTxt.Erase( nOldIdx - 1, nFieldDiff + 1 );
-            rOldTxt.Insert( cFldChr, nOldIdx - 1 );
+            OUString& rOldTxt = const_cast<OUString&> (rInf.GetTxt());
+            OUString aReplacement( cFldChr );
+            rOldTxt = rOldTxt.replaceAt( nOldIdx - 1, nFieldDiff + 1, aReplacement);
             rInf.SetIdx( nOldIdx );
 
 #if OSL_DEBUG_LEVEL > 0

-- 
To view, visit https://gerrit.libreoffice.org/3870
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d387e40464b53a55524bf950b8d413cf8468376
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Arnaud Versini <arnaud.versini at gmail.com>



More information about the LibreOffice mailing list