[Libreoffice-commits] .: sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Aug 9 02:09:13 PDT 2012


 sw/source/filter/ww1/fltshell.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 3a1c8eeb694e26835f6f9c010b5d305b57ddd0d5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Aug 9 10:06:44 2012 +0100

    rtl::OUStrings are supposed to be immutable
    
    The cast away of constness in d64ecf4e94a81d9c1fd4be74c098eb0e58345c60 makes me
    feel icky
    
    Change-Id: Ib977fd6bf34f11407a5957332789e1e48d98819e

diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 0464d67..b3e129a 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -1049,7 +1049,7 @@ void SwFltShell::ConvertUStr( String& rInOut )
 // QuoteString() wandelt CRs abhaengig von nFieldIniFlags in '\n' oder "\0x0d"
 OUString SwFltShell::QuoteStr( const OUString& rIn )
 {
-    OUString sOut( rIn );
+    OUStringBuffer sOut( rIn );
     sal_Bool bAllowCr = aStack.IsFlagSet( SwFltControlStack::ALLOW_FLD_CR );
 
     for( sal_Int32 n = 0; n < sOut.getLength(); ++n )
@@ -1057,21 +1057,18 @@ OUString SwFltShell::QuoteStr( const OUString& rIn )
         switch( sOut[ n ] )
         {
         case 0x0a:
-            sOut = sOut.replaceAt( n, 1, OUString() );             // 0xd 0xa wird zu \n
+            sOut.remove( n, 1 );             // 0xd 0xa wird zu \n
             break;
 
         case 0x0b:
         case 0x0c:
         case 0x0d:
             if( bAllowCr )
-            {
-                sal_Unicode* pStr = (sal_Unicode*)sOut.getStr();
-                pStr[n] = (sal_Unicode)'\n';
-            }
+                sOut[n] = '\n';
             break;
         }
     }
-    return sOut;
+    return sOut.makeStringAndClear();
 }
 
 SwFltShell& SwFltShell::operator << ( const sal_Unicode c )


More information about the Libreoffice-commits mailing list