[Libreoffice-commits] .: editeng/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Wed Jun 13 06:28:07 PDT 2012


 editeng/source/editeng/editdoc.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 5c47001d38af7b61db2089f5b3b8dc97e9f8d891
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 13 15:26:36 2012 +0200

    Better fix for those short strings
    
    ...that are not intended to be short after all; just the length
    calculation turned out to be wrong.
    
    Change-Id: Ic3a81c935161564f980ddd0241575fff2f76b467

diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 08722a5..0ef70bb 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2044,7 +2044,7 @@ XubString EditDoc::GetText( LineEnd eEnd ) const
     sal_Int32 nSepSize = aSep.getLength();
 
     if ( nSepSize )
-        nLen += nNodes * nSepSize;
+        nLen += (nNodes - 1) * nSepSize;
     if ( nLen > 0xFFFb / sizeof(xub_Unicode) )
     {
         OSL_FAIL( "Text too large for String" );
@@ -2065,8 +2065,7 @@ XubString EditDoc::GetText( LineEnd eEnd ) const
             pCur += nSepSize;
         }
     }
-    assert(pCur - newStr->buffer <= newStr->length);
-    newStr->length = pCur - newStr->buffer;
+    assert(pCur - newStr->buffer == newStr->length);
     return rtl::OUString(newStr, SAL_NO_ACQUIRE);
 }
 


More information about the Libreoffice-commits mailing list