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

Caolán McNamara caolanm at redhat.com
Wed Oct 1 00:29:20 PDT 2014


 sw/source/core/bastyp/breakit.cxx |    2 +-
 sw/source/core/txtnode/txtedt.cxx |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 1e32a66897dea37c40bbad4d0e23987e54be5332
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 23 15:03:38 2014 +0100

    with show changes on we can have negative offsets
    
    for counting words in a range of text which has redline deleted
    text at the start
    
    Change-Id: I34149822d43f8ee3fbde58a166dad408fb588fce
    (cherry picked from commit 93e7ae6f5719c56c90679e46a6e817dedf5c54c6)
    Reviewed-on: https://gerrit.libreoffice.org/11610
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index b4caeb3..8a4c40e 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -175,7 +175,7 @@ sal_Int32 SwBreakIt::getGraphemeCount(const OUString& rText,
 {
     sal_Int32 nGraphemeCount = 0;
 
-    sal_Int32 nCurPos = nStart;
+    sal_Int32 nCurPos = std::max(0, nStart);
     while (nCurPos < nEnd)
     {
         // fdo#49208 cheat and assume that nothing can combine with a space
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index dd531b8..aa6f7d6 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -723,6 +723,8 @@ SwScanner::SwScanner( const SwTxtNode& rNd, const OUString& rTxt,
         OUStringBuffer aBuf(aPreDashReplacementText);
         for (sal_Int32 i = nStartPos; i < nEndPos; ++i)
         {
+            if (i < 0)
+                continue;
             sal_Unicode cChar = aBuf[i];
             if (sDashes.indexOf(cChar) != -1)
             {
@@ -798,9 +800,9 @@ bool SwScanner::NextWord()
     while ( true )
     {
         // skip non-letter characters:
-        while ( nBegin < aText.getLength() )
+        while (nBegin < aText.getLength())
         {
-            if ( !u_isspace( aText[nBegin] ) )
+            if (nBegin >= 0 && !u_isspace(aText[nBegin]))
             {
                 if ( !pLanguage )
                 {


More information about the Libreoffice-commits mailing list