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

Caolán McNamara caolanm at redhat.com
Thu Nov 27 11:07:42 PST 2014


 sw/source/core/crsr/swcrsr.cxx     |   14 +++++++-------
 sw/source/core/doc/docruby.cxx     |    2 +-
 sw/source/filter/html/htmlfldw.cxx |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 383535196f9924202fc997c388e34a7865a2250e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 15 10:45:41 2014 +0000

    Related: #i17171# identify places where -1 was cast to 0xFFFF in the past
    
    try and do so anyway. Could be picking that sort of lint out of writer
    for a while to come :-(
    
    (cherry picked from commit 16c565461b40c6876e69dc7bcc18f7c4db7fb94d)
    
    Note: this fixes fdo#80571
    
    Note: for backport, removed any changes where the variables are still
    xub_StrLen; only sal_Int32 variables may have values < 0.
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	sw/source/core/crsr/swcrsr.cxx
    	sw/source/core/text/porfld.cxx
    	sw/source/core/text/txthyph.cxx
    	sw/source/core/txtnode/fntcap.cxx
    	sw/source/core/txtnode/txtedt.cxx
    
    Change-Id: I4efb94e5ed33025f7f416c096af25ba358ef45af

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index d27ebca..971c1b7 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1233,7 +1233,7 @@ sal_Bool SwCursor::GoStartWordWT( sal_Int16 nWordType )
                             nWordType,
                             sal_False ).startPos;
 
-        if (nPtPos < pTxtNd->GetTxt().getLength())
+        if (nPtPos < pTxtNd->GetTxt().getLength() && nPtPos >= 0)
         {
             GetPoint()->nContent = nPtPos;
             if( !IsSelOvr() )
@@ -1257,7 +1257,7 @@ sal_Bool SwCursor::GoEndWordWT( sal_Int16 nWordType )
                             nWordType,
                             sal_True ).endPos;
 
-        if (nPtPos <= pTxtNd->GetTxt().getLength() &&
+        if (nPtPos <= pTxtNd->GetTxt().getLength() && nPtPos >= 0 &&
             GetPoint()->nContent.GetIndex() != nPtPos )
         {
             GetPoint()->nContent = nPtPos;
@@ -1282,7 +1282,7 @@ sal_Bool SwCursor::GoNextWordWT( sal_Int16 nWordType )
             g_pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ),
                     nWordType ).startPos;
 
-        if (nPtPos < pTxtNd->GetTxt().getLength())
+        if (nPtPos < pTxtNd->GetTxt().getLength() && nPtPos >= 0)
         {
             GetPoint()->nContent = nPtPos;
             if( !IsSelOvr() )
@@ -1309,7 +1309,7 @@ sal_Bool SwCursor::GoPrevWordWT( sal_Int16 nWordType )
             g_pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos, 1 ) ),
                     nWordType ).startPos;
 
-        if (nPtPos < pTxtNd->GetTxt().getLength())
+        if (nPtPos < pTxtNd->GetTxt().getLength() && nPtPos >= 0)
         {
             GetPoint()->nContent = nPtPos;
             if( !IsSelOvr() )
@@ -1474,7 +1474,7 @@ sal_Bool SwCursor::GoSentence( SentenceMoveType eMoveType )
 
         // it is allowed to place the PaM just behind the last
         // character in the text thus <= ...Len
-        if (nPtPos <= pTxtNd->GetTxt().getLength())
+        if (nPtPos <= pTxtNd->GetTxt().getLength() && nPtPos >= 0)
         {
             GetPoint()->nContent = nPtPos;
             if( !IsSelOvr() )
@@ -1511,12 +1511,12 @@ sal_Bool SwCursor::ExpandToSentenceBorders()
         // it is allowed to place the PaM just behind the last
         // character in the text thus <= ...Len
         bool bChanged = false;
-        if (nStartPos <= pStartNd->GetTxt().getLength())
+        if (nStartPos <= pStartNd->GetTxt().getLength() && nStartPos >= 0)
         {
             GetMark()->nContent = nStartPos;
             bChanged = true;
         }
-        if (nEndPos <= pEndNd->GetTxt().getLength())
+        if (nEndPos <= pEndNd->GetTxt().getLength() && nEndPos >= 0)
         {
             GetPoint()->nContent = nEndPos;
             bChanged = true;
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index acc91a0..44d7915 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -235,7 +235,7 @@ sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_
                             g_pBreakIt->GetLocale( pTNd->GetLang( nStart )),
                             WordType::ANYWORD_IGNOREWHITESPACES,
                             sal_True ).startPos;
-        if( nWordStt < nStart && -1 != nWordStt )
+        if (nWordStt < nStart && nWordStt >= 0)
         {
             nStart = nWordStt;
             pPos->nContent = nStart;
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index 29c9c76..a77c95d 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -315,7 +315,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld,
 
         sal_uInt16 nScript =
             SwHTMLWriter::GetCSS1ScriptForScriptType( nScriptType );
-        if( nPos < sExpand.getLength() || nScript != rHTMLWrt.nCSS1Script )
+        if( (nPos < sExpand.getLength() && nPos >= 0) || nScript != rHTMLWrt.nCSS1Script )
         {
             bNeedsCJKProcessing = sal_True;
         }


More information about the Libreoffice-commits mailing list