[Libreoffice-commits] core.git: 3 commits - editeng/source

Caolán McNamara caolanm at redhat.com
Tue Sep 17 06:55:34 PDT 2013


 editeng/source/editeng/editdoc.cxx |    1 -
 editeng/source/misc/svxacorr.cxx   |   31 +++++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 7f76c90a982eb06396a96c32088bfd5de941516a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 17 14:47:43 2013 +0100

    silence annoying warning
    
    Change-Id: I90c77df2ef8424ece5b8b37097d62bd5e8955616

diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 32e0da2..16bfe8f 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1750,7 +1750,6 @@ const WrongList* ContentNode::GetWrongList() const
 
 void ContentNode::SetWrongList( WrongList* p )
 {
-    DBG_ASSERT(!mpWrongList, "WrongList already exist!");
     mpWrongList.reset(p);
 }
 
commit 98214397cd5fc10cdefd6ba9c36746532942709b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 17 14:46:05 2013 +0100

    don't access string out of bounds
    
    Change-Id: I304b74270f73b9f94568edf2613e2581459cc4f9

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index dd2a6ec..bb24fe0 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -845,8 +845,15 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
                 sal::static_int_cast< xub_StrLen >( pWordStt - pStart ) ) ) )
         return sal_False; // already ok
 
-    if (INetURLObject::CompareProtocolScheme(rTxt.copy(pWordStt - pStart, pDelim - pWordStt + 1)) != INET_PROT_NOT_VALID)
-        return sal_False; // already ok
+    //See if the text is the start of a protocol string, e.g. have text of
+    //"http" see if it is the start of "http:" and if so leave it alone
+    sal_Int32 nIndex = pWordStt - pStart;
+    sal_Int32 nProtocolLen = pDelim - pWordStt + 1;
+    if (nIndex + nProtocolLen <= rTxt.getLength())
+    {
+        if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INET_PROT_NOT_VALID)
+            return sal_False; // already ok
+    }
 
     if (0x1 == *pWordStt || 0x2 == *pWordStt)
         return sal_False; // already ok
commit 7fff7c6aab15b3a7de3bf6056669ec217d41bb60
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 17 14:38:42 2013 +0100

    unfold this god-awful mess, logic unchanged
    
    Change-Id: Ib76617e3c500268dfe423b9947100f6ce7f0eaec

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index f95d921..dd2a6ec 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -832,16 +832,24 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
         }
     } while( 0 == ( bAtStart = (pStart == pStr)) );
 
-    if( !pWordStt ||
-        rCC.isDigit(
-            aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ) ||
-        IsUpperLetter(
+    if (!pWordStt)
+        return sal_False;    // no character to be replaced
+
+
+    if (rCC.isDigit( aText, sal::static_int_cast< xub_StrLen >( pStr - pStart ) ))
+        return sal_False; // already ok
+
+    if (IsUpperLetter(
             rCC.getCharacterType(
                 aText,
-                sal::static_int_cast< xub_StrLen >( pWordStt - pStart ) ) ) ||
-        INetURLObject::CompareProtocolScheme(rTxt.copy(pWordStt - pStart, pDelim - pWordStt + 1)) != INET_PROT_NOT_VALID ||
-        0x1 == *pWordStt || 0x2 == *pWordStt )
-        return sal_False;       // no character to be replaced, or already ok
+                sal::static_int_cast< xub_StrLen >( pWordStt - pStart ) ) ) )
+        return sal_False; // already ok
+
+    if (INetURLObject::CompareProtocolScheme(rTxt.copy(pWordStt - pStart, pDelim - pWordStt + 1)) != INET_PROT_NOT_VALID)
+        return sal_False; // already ok
+
+    if (0x1 == *pWordStt || 0x2 == *pWordStt)
+        return sal_False; // already ok
 
     if( *pDelim && 2 >= pDelim - pWordStt &&
         lcl_IsInAsciiArr( ".-)>", *pDelim ) )


More information about the Libreoffice-commits mailing list