[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Sat Jan 3 06:26:04 PST 2015


 sw/inc/shellio.hxx                 |    2 +-
 sw/source/core/unocore/unocoll.cxx |    2 +-
 sw/source/filter/html/htmlforw.cxx |   22 ++++++++++------------
 sw/source/filter/html/htmlplug.cxx |    2 +-
 sw/source/filter/html/parcss1.cxx  |    6 +++---
 sw/source/filter/writer/writer.cxx |    4 ++--
 6 files changed, 18 insertions(+), 20 deletions(-)

New commits:
commit b739e6aeef8329e7e4a7ec525a650a4c74cf4699
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jan 3 15:23:59 2015 +0100

    Writer::GetBookmarks can return bool
    
    Change-Id: I4210fd4bc086c5cfdfe7dc01cd9387993b4916ca

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index a1d024f..6b97b2f 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -438,7 +438,7 @@ public:
     // OtherPos of the bookmarks also inserted.
     void CreateBookmarkTbl();
     // Search alle Bookmarks in the range and return it in the Array.
-    sal_uInt16 GetBookmarks( const SwCntntNode& rNd,
+    bool GetBookmarks( const SwCntntNode& rNd,
                         sal_Int32 nStt, sal_Int32 nEnd,
                         std::vector< const ::sw::mark::IMark* >& rArr );
 
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 0f4788f..c928b9a 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -398,7 +398,7 @@ void Writer::CreateBookmarkTbl()
 }
 
 // search alle Bookmarks in the range and return it in the Array
-sal_uInt16 Writer::GetBookmarks(const SwCntntNode& rNd, sal_Int32 nStt,
+bool Writer::GetBookmarks(const SwCntntNode& rNd, sal_Int32 nStt,
     sal_Int32 nEnd, std::vector< const ::sw::mark::IMark* >& rArr)
 {
     OSL_ENSURE( rArr.empty(), "there are still entries available" );
@@ -435,7 +435,7 @@ sal_uInt16 Writer::GetBookmarks(const SwCntntNode& rNd, sal_Int32 nStt,
             }
         }
     }
-    return rArr.size();
+    return !rArr.empty();
 }
 
 // Storage-specific
commit 63cb016bc31a2d51d445b335454b9de99c77e413
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Dec 31 00:41:54 2014 +0100

    sal_uInt16 to more proper types
    
    Change-Id: I0e226787206e0429149fccc99677529d52d7825a

diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 8e73371..f6890bf 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1183,7 +1183,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
 
         rHTMLWrt.IncIndentLevel(); // Inhalt von Applet einruecken
 
-        sal_uInt16 ii = aParams.size();
+        size_t ii = aParams.size();
         while( ii > 0  )
         {
             const SvCommand& rCommand = aCommands[ aParams[--ii] ];
diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx
index b901b5f..637362d 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -177,7 +177,7 @@ CSS1Token CSS1Parser::GetNextToken()
                     if( CSS1_NULL==nRet )
                     {
                         aToken.clear();
-                        sal_uInt16 nBlockLvl = 0;
+                        int nBlockLvl = 0;
                         sal_Unicode cQuoteCh = 0;
                         bool bDone = false, bEscape = false;
                         while( !bDone && !IsEOF() )
@@ -620,7 +620,7 @@ CSS1Token CSS1Parser::GetNextToken()
                       (('r'==aToken[0] || 'R'==aToken[0]) &&
                        aToken.equalsIgnoreAsciiCase( "rgb" )) ) )
                 {
-                    sal_uInt16 nNestCnt = 0;
+                    int nNestCnt = 0;
                     OUStringBuffer sTmpBuffer2( 64L );
                     do {
                         sTmpBuffer2.append( cNextCh );
@@ -1279,7 +1279,7 @@ bool CSS1Expression::GetColor( Color &rColor ) const
             OUString aColorStr(aValue.copy(4, aValue.getLength() - 5));
 
             sal_Int32 nPos = 0;
-            sal_uInt16 nCol = 0;
+            int nCol = 0;
 
             while( nCol < 3 && nPos < aColorStr.getLength() )
             {
commit 351dee6b5343a910ee6fb6372bd0b2d9435517bd
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Dec 26 10:48:27 2014 +0100

    sal_uInt16 to more proper types, use while instead of for in simple cases
    
    Change-Id: I5f3cc2771ccde44e1ea45b1ff3e7f8a3fedfb94a

diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 2ada383..ea90350 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -153,7 +153,7 @@ static void lcl_html_outEvents( SvStream& rStrm,
         OUString sMethod( pDescs[i].EventMethod );
 
         const sal_Char *pOpt = 0;
-        for( sal_uInt16 j=0; aEventListenerTable[j]; j++ )
+        for( int j=0; aEventListenerTable[j]; j++ )
         {
             if( sListener.equalsAscii( aEventListenerTable[j] ) &&
                 sMethod.equalsAscii( aEventMethodTable[j] ) )
@@ -215,12 +215,11 @@ static bool lcl_html_isHTMLControl( sal_Int16 nClassId )
 bool SwHTMLWriter::HasControls() const
 {
     sal_uInt32 nStartIdx = pCurPam->GetPoint()->nNode.GetIndex();
-    sal_uInt16 i;
+    size_t i = 0;
 
     // Skip all controls in front of the current paragraph
-    for( i = 0; i < aHTMLControls.size() &&
-        aHTMLControls[i]->nNdIdx < nStartIdx; i++ )
-        ;
+    while ( i < aHTMLControls.size() && aHTMLControls[i]->nNdIdx < nStartIdx )
+        ++i;
 
     return i < aHTMLControls.size() && aHTMLControls[i]->nNdIdx == nStartIdx;
 }
@@ -247,10 +246,9 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd )
                                     : pCurPam->GetPoint()->nNode.GetIndex();
 
     // Ueberspringen von Controls vor dem interesanten Bereich
-    sal_uInt16 i;
-    for( i = 0; i < aHTMLControls.size() &&
-        aHTMLControls[i]->nNdIdx < nStartIdx; i++ )
-        ;
+    size_t i = 0;
+    while ( i < aHTMLControls.size() && aHTMLControls[i]->nNdIdx < nStartIdx )
+        ++i;
 
     if( !pStartNd )
     {
@@ -1332,11 +1330,11 @@ void SwHTMLWriter::GetControls()
     // und VCForm in einem Array gemerkt.
     // Ueber dieses Array laesst sich dann feststellen, wo form::Forms geoeffnet
     // und geschlossen werden muessen.
-    sal_uInt16 i;
+
     if( pHTMLPosFlyFrms )
     {
         // die absatz-gebundenen Controls einsammeln
-        for( i=0; i<pHTMLPosFlyFrms->size(); i++ )
+        for( size_t i=0; i<pHTMLPosFlyFrms->size(); i++ )
         {
             const SwHTMLPosFlyFrm* pPosFlyFrm = (*pHTMLPosFlyFrms)[ i ];
             if( HTML_OUT_CONTROL != pPosFlyFrm->GetOutFn() )
@@ -1354,7 +1352,7 @@ void SwHTMLWriter::GetControls()
 
     // und jetzt die in einem zeichengebundenen Rahmen
     const SwFrmFmts* pSpzFrmFmts = pDoc->GetSpzFrmFmts();
-    for( i=0; i<pSpzFrmFmts->size(); i++ )
+    for( size_t i=0; i<pSpzFrmFmts->size(); i++ )
     {
         const SwFrmFmt *pFrmFmt = (*pSpzFrmFmts)[i];
         if( RES_DRAWFRMFMT != pFrmFmt->Which() )
commit fa9f3c7bb2c8c1df5d5b1dcb0d92f537753c72db
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Dec 26 10:32:12 2014 +0100

    Avoid unnecessary downcast
    
    Change-Id: Ib2de94071ce0f80932fe31e40f7e3d434c0a274f

diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index c200afe..72b9337 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1440,7 +1440,7 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
         }
         if(nIndex >= 0 && static_cast<size_t>(nIndex) < rFmts.size())
         {
-            SwSectionFmt* pFmt = rFmts[(sal_uInt16)nIndex];
+            SwSectionFmt* pFmt = rFmts[nIndex];
             xRet = GetObject(*pFmt);
         }
         else


More information about the Libreoffice-commits mailing list