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

Matteo Casalin matteo.casalin at yahoo.com
Thu Dec 25 09:22:05 PST 2014


 sw/inc/doc.hxx                      |    8 ++++----
 sw/inc/editsh.hxx                   |    4 ++--
 sw/inc/fesh.hxx                     |    4 ++--
 sw/source/core/doc/docchart.cxx     |    4 ++--
 sw/source/core/doc/docfly.cxx       |   16 ++++++++--------
 sw/source/core/doc/docfmt.cxx       |   12 ++++++------
 sw/source/core/doc/notxtfrm.cxx     |    5 -----
 sw/source/core/doc/sortopt.cxx      |    2 +-
 sw/source/core/doc/swserv.cxx       |    2 +-
 sw/source/core/docnode/ndcopy.cxx   |    2 +-
 sw/source/core/edit/edfmt.cxx       |    4 ++--
 sw/source/core/fields/ddetbl.cxx    |   10 ++++++----
 sw/source/core/frmedt/fefly1.cxx    |    4 ++--
 sw/source/core/frmedt/feshview.cxx  |    4 ++--
 sw/source/core/graphic/ndgrf.cxx    |    2 +-
 sw/source/core/inc/notxtfrm.hxx     |    5 -----
 sw/source/core/layout/laycache.cxx  |    4 ++--
 sw/source/core/layout/layhelp.hxx   |    6 +++---
 sw/source/core/unocore/unochart.cxx |    4 ++--
 sw/source/core/unocore/unocoll.cxx  |   24 ++++++++++++------------
 sw/source/core/unocore/unoframe.cxx |    4 ++--
 sw/source/uibase/shells/frmsh.cxx   |    4 ++--
 sw/source/uibase/utlui/content.cxx  |    8 ++++----
 sw/source/uibase/wrtsh/wrtsh1.cxx   |    2 +-
 24 files changed, 68 insertions(+), 76 deletions(-)

New commits:
commit 93e97e83d8db7641d32391af7203806d2d26370b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Dec 25 17:38:13 2014 +0100

    sal_uInt16 to size_t
    
    Change-Id: Ide8913930f9f951039cefecf71609c5a2bcc5e82

diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index 1b48a92..02fdf91 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -91,7 +91,7 @@ void SwDoc::DoUpdateAllCharts()
     if( pVSh )
     {
         const SwFrmFmts& rTblFmts = *GetTblFrmFmts();
-        for( sal_uInt16 n = 0; n < rTblFmts.size(); ++n )
+        for( size_t n = 0; n < rTblFmts.size(); ++n )
         {
             SwTable* pTmpTbl;
             const SwTableNode* pTblNd;
@@ -151,7 +151,7 @@ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const OUString &rNewName )
     {
         const SwFrmFmt* pFmt;
         const SwFrmFmts& rTbl = *GetTblFrmFmts();
-        for( sal_uInt16 i = rTbl.size(); i; )
+        for( size_t i = rTbl.size(); i; )
             if( !( pFmt = rTbl[ --i ] )->IsDefault() &&
                 pFmt->GetName() == rNewName && IsUsed( *pFmt ) )
             {
diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx
index 9aba7fe..555e444 100644
--- a/sw/source/core/doc/sortopt.cxx
+++ b/sw/source/core/doc/sortopt.cxx
@@ -60,7 +60,7 @@ SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
     bTable( rOpt.bTable ),
     bIgnoreCase( rOpt.bIgnoreCase )
 {
-    for( sal_uInt16 i=0; i < rOpt.aKeys.size(); ++i )
+    for( size_t i=0; i < rOpt.aKeys.size(); ++i )
     {
         SwSortKey* pNew = new SwSortKey(*rOpt.aKeys[i]);
         aKeys.push_back( pNew );
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index ce473a6..4487b25 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -234,7 +234,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const
         SwServerObject::ServerModes eSave = eType;
         if( !pChkLnk )
             const_cast<SwServerObject*>(this)->eType = NONE_SERVER;
-        for( sal_uInt16 n = rLnks.size(); n; )
+        for( size_t n = rLnks.size(); n; )
         {
             const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
             if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() &&
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 47d5f62..b26299c 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -244,7 +244,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
     if( !pDoc->IsCopyIsMove() )
     {
         const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
-        for( sal_uInt16 n = rTblFmts.size(); n; )
+        for( size_t n = rTblFmts.size(); n; )
             if( rTblFmts[ --n ]->GetName() == sTblName )
             {
                 sTblName = pDoc->GetUniqueTblName();
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index a135603..be1212d 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -111,12 +111,12 @@ void SwDDETable::ChangeContent()
     OUString aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r');
     sal_Int32 nExpandTokenPos = 0;
 
-    for( sal_uInt16 n = 0; n < aLines.size(); ++n )
+    for( size_t n = 0; n < aLines.size(); ++n )
     {
         OUString aLine = aExpand.getToken( 0, '\n', nExpandTokenPos );
         sal_Int32 nLineTokenPos = 0;
         SwTableLine* pLine = aLines[ n ];
-        for( sal_uInt16 i = 0; i < pLine->GetTabBoxes().size(); ++i )
+        for( size_t i = 0; i < pLine->GetTabBoxes().size(); ++i )
         {
             SwTableBox* pBox = pLine->GetTabBoxes()[ i ];
             OSL_ENSURE( pBox->GetSttIdx(), "no content box" );
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 80b0504..1ae848c 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -999,7 +999,7 @@ void DelAllGrfCacheEntries( SwDoc* pDoc )
         const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
         SwGrfNode* pGrfNd;
         OUString sFileNm;
-        for( sal_uInt16 n = rLnks.size(); n; )
+        for( size_t n = rLnks.size(); n; )
         {
             ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
             if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
commit 1577d93102ab87952309eafefa497aa88e97de21
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Dec 25 17:35:22 2014 +0100

    Optimize consecutive token accesses in OUStrings
    
    Change-Id: I988d80665bc61d1a0a96614790735d83bd9e5dde

diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index 1f963fe..a135603 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -109,10 +109,12 @@ void SwDDETable::ChangeContent()
     SwDDEFieldType* pDDEType = static_cast<SwDDEFieldType*>(aDepend.GetRegisteredIn());
 
     OUString aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r');
+    sal_Int32 nExpandTokenPos = 0;
 
     for( sal_uInt16 n = 0; n < aLines.size(); ++n )
     {
-        OUString aLine = aExpand.getToken( n, '\n' );
+        OUString aLine = aExpand.getToken( 0, '\n', nExpandTokenPos );
+        sal_Int32 nLineTokenPos = 0;
         SwTableLine* pLine = aLines[ n ];
         for( sal_uInt16 i = 0; i < pLine->GetTabBoxes().size(); ++i )
         {
@@ -123,7 +125,7 @@ void SwDDETable::ChangeContent()
             OSL_ENSURE( pTxtNode, "No Node" );
             SwIndex aCntIdx( pTxtNode, 0 );
             pTxtNode->EraseText( aCntIdx );
-            pTxtNode->InsertText( aLine.getToken( i, '\t' ), aCntIdx );
+            pTxtNode->InsertText( aLine.getToken( 0, '\t', nLineTokenPos ), aCntIdx );
 
             SwTableBoxFmt* pBoxFmt = static_cast<SwTableBoxFmt*>(pBox->GetFrmFmt());
             pBoxFmt->LockModify();
commit 257ff5bea3a40646e7dae88f708c136be93ed1b2
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Dec 25 17:06:46 2014 +0100

    sal_uInt16 to size_t
    
    Change-Id: I66239d89049f1386e5725e540c4dcc2b09c3ebf0

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a7c8926..c991185 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -888,8 +888,8 @@ public:
 
     /** Access to frames.
     Iterate over Flys - forr Basic-Collections. */
-    sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
-    SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false );
+    size_t GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
+    SwFrmFmt* GetFlyNum(size_t nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false );
 
     // Copy formats in own arrays and return them.
     SwFrmFmt  *CopyFrmFmt ( const SwFrmFmt& );
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 4896406..079ef71 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -376,8 +376,8 @@ public:
                                 { return GotoObj( false, eType); }
 
    /// Iterate over flys  - for Basic-collections.
-    sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
-    const SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false) const;
+    size_t GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
+    const SwFrmFmt* GetFlyNum(size_t nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false) const;
 
     /// If a fly is selected, it draws cursor into the first CntntFrm.
     const SwFrmFmt* SelFlyGrabCrsr();
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 67cddea..5548ccd 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -72,18 +72,18 @@
 
 using namespace ::com::sun::star;
 
-sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
+size_t SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
 {
     const SwFrmFmts& rFmts = *GetSpzFrmFmts();
-    sal_uInt16 nSize = rFmts.size();
-    sal_uInt16 nCount = 0;
+    const size_t nSize = rFmts.size();
+    size_t nCount = 0;
     const SwNodeIndex* pIdx;
 
     std::set<const SwFrmFmt*> aTextBoxes;
     if (bIgnoreTextBoxes)
         aTextBoxes = SwTextBoxHelper::findTextBoxes(this);
 
-    for ( sal_uInt16 i = 0; i < nSize; i++)
+    for ( size_t i = 0; i < nSize; ++i)
     {
         const SwFrmFmt* pFlyFmt = rFmts[ i ];
 
@@ -123,19 +123,19 @@ sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
 }
 
 /// @attention If you change this, also update SwXFrameEnumeration in unocoll.
-SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType eType, bool bIgnoreTextBoxes )
+SwFrmFmt* SwDoc::GetFlyNum( size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes )
 {
     SwFrmFmts& rFmts = *GetSpzFrmFmts();
     SwFrmFmt* pRetFmt = 0;
-    sal_uInt16 nSize = rFmts.size();
+    const size_t nSize = rFmts.size();
     const SwNodeIndex* pIdx;
-    sal_uInt16 nCount = 0;
+    size_t nCount = 0;
 
     std::set<const SwFrmFmt*> aTextBoxes;
     if (bIgnoreTextBoxes)
         aTextBoxes = SwTextBoxHelper::findTextBoxes(this);
 
-    for( sal_uInt16 i = 0; !pRetFmt && i < nSize; ++i )
+    for( size_t i = 0; !pRetFmt && i < nSize; ++i )
     {
         SwFrmFmt* pFlyFmt = rFmts[ i ];
 
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index e2c7f9a..957ddace 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1837,14 +1837,14 @@ void SwFEShell::GetConnectableFrmFmts(SwFrmFmt & rFmt,
     if (pOldChainPrev)
         mpDoc->Unchain(*pOldChainPrev);
 
-    sal_uInt16 nCnt = mpDoc->GetFlyCount(FLYCNTTYPE_FRM);
+    const size_t nCnt = mpDoc->GetFlyCount(FLYCNTTYPE_FRM);
 
     /* potential successors resp. predecessors */
     ::std::vector< const SwFrmFmt * > aTmpSpzArray;
 
     mpDoc->FindFlyByName(rReference);
 
-    for (sal_uInt16 n = 0; n < nCnt; n++)
+    for (size_t n = 0; n < nCnt; ++n)
     {
         const SwFrmFmt & rFmt1 = *(mpDoc->GetFlyNum(n, FLYCNTTYPE_FRM));
 
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index fafe863..b1be489 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2234,12 +2234,12 @@ bool SwFEShell::GotoFly( const OUString& rName, FlyCntType eType, bool bSelFrm )
     return bRet;
 }
 
-sal_uInt16 SwFEShell::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
+size_t SwFEShell::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const
 {
     return GetDoc()->GetFlyCount(eType, bIgnoreTextBoxes);
 }
 
-const SwFrmFmt*  SwFEShell::GetFlyNum(sal_uInt16 nIdx, FlyCntType eType, bool bIgnoreTextBoxes ) const
+const SwFrmFmt*  SwFEShell::GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes ) const
 {
     return GetDoc()->GetFlyNum(nIdx, eType, bIgnoreTextBoxes);
 }
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index c9374ba..c91f22c 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -912,7 +912,7 @@ void SwLayHelper::_CheckFlyCache( SwPageFrm* pPage )
 {
     if( !pImpl || !pPage )
         return;
-    sal_uInt16 nFlyCount = pImpl->GetFlyCount();
+    const size_t nFlyCount = pImpl->GetFlyCount();
     // Any text frames at the page, fly cache available?
     if( pPage->GetSortedObjs() && nFlyIdx < nFlyCount )
     {
@@ -929,7 +929,7 @@ void SwLayHelper::_CheckFlyCache( SwPageFrm* pPage )
 
         // sort cached objects on this page by ordnum
         std::set< const SwFlyCache*, FlyCacheCompare > aFlyCacheSet;
-        sal_uInt16 nIdx = nFlyIdx;
+        size_t nIdx = nFlyIdx;
 
         SwFlyCache* pFlyC;
         while( nIdx < nFlyCount &&
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index 47412c0..148c1c9 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -69,8 +69,8 @@ public:
     sal_Int32 GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
     sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; }
 
-    sal_uInt16 GetFlyCount() const { return aFlyCache.size(); }
-    SwFlyCache& GetFlyCache( sal_uInt16 nIdx ) { return aFlyCache[ nIdx ]; }
+    size_t GetFlyCount() const { return aFlyCache.size(); }
+    SwFlyCache& GetFlyCache( size_t nIdx ) { return aFlyCache[ nIdx ]; }
 
     bool IsUseFlyCache() const { return bUseFlyCache; }
 };
@@ -109,7 +109,7 @@ class SwLayHelper
     sal_uLong nParagraphCnt;
     sal_uLong nStartOfContent;
     sal_uInt16 nIndex;                      // the index in the page break array
-    sal_uInt16 nFlyIdx;                     // the index in the fly cache array
+    size_t nFlyIdx;                         // the index in the fly cache array
     bool bFirst : 1;
     void _CheckFlyCache( SwPageFrm* pPage );
 public:
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 589d3f2..c200afe 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1195,7 +1195,7 @@ sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException, std::exception)
     if(!IsValid())
         throw uno::RuntimeException();
     // Ignore TextBoxes for TextFrames.
-    return GetDoc()->GetFlyCount(eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM);
+    return static_cast<sal_Int32>(GetDoc()->GetFlyCount(eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM));
 }
 
 uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
@@ -1204,10 +1204,10 @@ uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    if(nIndex < 0 || nIndex >= USHRT_MAX)
+    if(nIndex < 0)
         throw IndexOutOfBoundsException();
     // Ignore TextBoxes for TextFrames.
-    SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM);
+    SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<size_t>(nIndex), eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM);
     if(!pFmt)
         throw IndexOutOfBoundsException();
     return lcl_UnoWrapFrame(pFmt, eType);
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index db74773..1db4715 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1686,10 +1686,10 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
             }
             else
             {
-                sal_uInt16 nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
+                const size_t nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
 
                 SwFrmFmt* pChain = 0;
-                for( sal_uInt16 i = 0; i < nCount; i++)
+                for( size_t i = 0; i < nCount; ++i )
                 {
                     SwFrmFmt* pFmt2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
                     if(sChainName == pFmt2->GetName() )
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 9bae915..72c4765 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -94,8 +94,8 @@ using namespace ::com::sun::star::uno;
 static void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
 static const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const OUString& rName)
 {
-    sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
-    for( sal_uInt16 i = 0; i < nCount; i++)
+    const size_t nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
+    for( size_t i = 0; i < nCount; ++i )
     {
         const SwFrmFmt* pFmt = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
         if(pFmt->GetName() == rName)
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 3b4ebde..cdd36f1 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -554,7 +554,7 @@ void    SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
                     "MemberCount differs");
             Point aNullPt;
             nMemberCount = pWrtShell->GetFlyCount(eType, /*bIgnoreTextBoxes=*/true);
-            for(sal_uInt16 i = 0; i < nMemberCount; i++)
+            for(size_t i = 0; i < nMemberCount; ++i)
             {
                 const SwFrmFmt* pFrmFmt = pWrtShell->GetFlyNum(i,eType,/*bIgnoreTextBoxes=*/true);
                 const OUString sFrmName = pFrmFmt->GetName();
commit d07f0997c54e9cef31d996ebeb2aabfb4b4e0265
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Dec 21 11:56:37 2014 +0100

    sal_uInt16 to size_t
    
    Change-Id: I5b63396fba55b717f35aee5718dd348a9d795786

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8ca9f64..a7c8926 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -880,8 +880,8 @@ public:
     // Table formatting
     const SwFrmFmts* GetTblFrmFmts() const  { return mpTblFrmFmtTbl; }
           SwFrmFmts* GetTblFrmFmts()        { return mpTblFrmFmtTbl; }
-    sal_uInt16 GetTblFrmFmtCount( bool bUsed ) const;
-    SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed ) const;
+    size_t GetTblFrmFmtCount( bool bUsed ) const;
+    SwFrmFmt& GetTblFrmFmt(size_t nFmt, bool bUsed ) const;
     SwTableFmt* MakeTblFrmFmt(const OUString &rFmtName, SwFrmFmt *pDerivedFrom);
     void        DelTblFrmFmt( SwTableFmt* pFmt );
     SwTableFmt* FindTblFmtByName( const OUString& rName, bool bAll = false ) const;
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index a8b4d70..815dfa1 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -285,8 +285,8 @@ public:
     sal_uInt16 GetCurLang() const;
 
     /// TABLE
-    sal_uInt16 GetTblFrmFmtCount( bool bUsed = false ) const;
-    SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed = false ) const;
+    size_t GetTblFrmFmtCount( bool bUsed = false ) const;
+    SwFrmFmt& GetTblFrmFmt(size_t nFmt, bool bUsed = false ) const;
     OUString GetUniqueTblName() const;
 
     /// CHAR
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 0c7966e..54beda7 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -754,13 +754,13 @@ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const OUString &rFmtName,
     return pFmt;
 }
 
-sal_uInt16 SwDoc::GetTblFrmFmtCount(bool bUsed) const
+size_t SwDoc::GetTblFrmFmtCount(bool bUsed) const
 {
-    sal_uInt16 nCount = mpTblFrmFmtTbl->size();
+    size_t nCount = mpTblFrmFmtTbl->size();
     if(bUsed)
     {
         SwAutoFmtGetDocNode aGetHt( &GetNodes() );
-        for ( sal_uInt16 i = nCount; i; )
+        for ( size_t i = nCount; i; )
         {
             if((*mpTblFrmFmtTbl)[--i]->GetInfo( aGetHt ))
                 --nCount;
@@ -769,13 +769,13 @@ sal_uInt16 SwDoc::GetTblFrmFmtCount(bool bUsed) const
     return nCount;
 }
 
-SwFrmFmt& SwDoc::GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed ) const
+SwFrmFmt& SwDoc::GetTblFrmFmt(size_t nFmt, bool bUsed ) const
 {
-    sal_uInt16 nRemoved = 0;
+    size_t nRemoved = 0;
     if(bUsed)
     {
         SwAutoFmtGetDocNode aGetHt( &GetNodes() );
-        for ( sal_uInt16 i = 0; i <= nFmt; i++ )
+        for ( size_t i = 0; i <= nFmt; ++i )
         {
             while ( (*mpTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt ))
             {
diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx
index ad9748e..1c94fb7 100644
--- a/sw/source/core/edit/edfmt.cxx
+++ b/sw/source/core/edit/edfmt.cxx
@@ -105,12 +105,12 @@ void SwEditShell::FillByEx(SwCharFmt* pCharFmt, bool bReset)
         pCharFmt->SetFmtAttr( *pCNd->GetpSwAttrSet() );
 }
 
-sal_uInt16 SwEditShell::GetTblFrmFmtCount(bool bUsed) const
+size_t SwEditShell::GetTblFrmFmtCount(bool bUsed) const
 {
     return GetDoc()->GetTblFrmFmtCount(bUsed);
 }
 
-SwFrmFmt& SwEditShell::GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed ) const
+SwFrmFmt& SwEditShell::GetTblFrmFmt(size_t nFmt, bool bUsed ) const
 {
     return GetDoc()->GetTblFrmFmt(nFmt, bUsed );
 }
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index cec7d22..0fbd89f 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -349,8 +349,8 @@ static void GetTableByName( const SwDoc &rDoc, const OUString &rTableName,
 
     // find frame format of table
     //! see SwXTextTables::getByName
-    const sal_uInt16 nCount = rDoc.GetTblFrmFmtCount(true);
-    for (sal_uInt16 i = 0; i < nCount && !pTblFmt; ++i)
+    const size_t nCount = rDoc.GetTblFrmFmtCount(true);
+    for (size_t i = 0; i < nCount && !pTblFmt; ++i)
     {
         SwFrmFmt& rTblFmt = rDoc.GetTblFrmFmt(i, true);
         if(rTableName == rTblFmt.GetName())
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 3cc26eb..589d3f2 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -851,7 +851,7 @@ sal_Int32 SwXTextTables::getCount(void) throw( uno::RuntimeException, std::excep
     SolarMutexGuard aGuard;
     sal_Int32 nRet = 0;
     if(IsValid())
-        nRet = GetDoc()->GetTblFrmFmtCount(true);
+        nRet = static_cast<sal_Int32>(GetDoc()->GetTblFrmFmtCount(true));
     return nRet;
 }
 
@@ -862,7 +862,7 @@ uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nIndex)
     uno::Any aRet;
     if(IsValid())
     {
-        if(0 <= nIndex && GetDoc()->GetTblFrmFmtCount(true) > nIndex)
+        if(0 <= nIndex && GetDoc()->GetTblFrmFmtCount(true) > static_cast<size_t>(nIndex))
         {
             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(nIndex, true);
             uno::Reference< XTextTable >  xTbl = SwXTextTables::GetObject(rFmt);
@@ -884,9 +884,9 @@ uno::Any SwXTextTables::getByName(const OUString& rItemName)
     uno::Any aRet;
     if(IsValid())
     {
-        const sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
+        const size_t nCount = GetDoc()->GetTblFrmFmtCount(true);
         uno::Reference< XTextTable >  xTbl;
-        for( sal_uInt16 i = 0; i < nCount; i++)
+        for( size_t i = 0; i < nCount; ++i)
         {
             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);
             if (rItemName == rFmt.GetName())
@@ -911,12 +911,12 @@ uno::Sequence< OUString > SwXTextTables::getElementNames(void)
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    const sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
-    uno::Sequence<OUString> aSeq(nCount);
+    const size_t nCount = GetDoc()->GetTblFrmFmtCount(true);
+    uno::Sequence<OUString> aSeq(static_cast<sal_Int32>(nCount));
     if(nCount)
     {
         OUString* pArray = aSeq.getArray();
-        for( sal_uInt16 i = 0; i < nCount; i++)
+        for( size_t i = 0; i < nCount; ++i)
         {
             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);
 
@@ -933,8 +933,8 @@ sal_Bool SwXTextTables::hasByName(const OUString& rName)
     bool bRet= false;
     if(IsValid())
     {
-        const sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
-        for( sal_uInt16 i = 0; i < nCount; i++)
+        const size_t nCount = GetDoc()->GetTblFrmFmtCount(true);
+        for( size_t i = 0; i < nCount; ++i)
         {
             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);
             if (rName == rFmt.GetName())
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index d05e2a3..3b4ebde 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -233,7 +233,7 @@ void SwContentType::Init(bool* pbInvalidateWindow)
 
         case CONTENT_TYPE_TABLE     :
             sTypeToken = "table";
-            nMemberCount = pWrtShell->GetTblFrmFmtCount(true);
+            nMemberCount = static_cast<sal_uInt16>(pWrtShell->GetTblFrmFmtCount(true));
             bEdit = true;
         break;
 
@@ -518,10 +518,10 @@ void    SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
 
         case CONTENT_TYPE_TABLE     :
         {
-            OSL_ENSURE(nMemberCount == pWrtShell->GetTblFrmFmtCount(true),
+            OSL_ENSURE(nMemberCount == static_cast<sal_uInt16>(pWrtShell->GetTblFrmFmtCount(true)),
                        "MemberCount differs");
             Point aNullPt;
-            nMemberCount =  pWrtShell->GetTblFrmFmtCount(true);
+            nMemberCount = static_cast<sal_uInt16>(pWrtShell->GetTblFrmFmtCount(true));
             for(sal_uInt16 i = 0; i < nMemberCount; i++)
             {
                 const SwFrmFmt& rTblFmt = pWrtShell->GetTblFrmFmt(i, true);
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index e697217..3865697 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1475,7 +1475,7 @@ SwCharFmt *SwWrtShell::GetCharStyle(const OUString &rFmtName, GetStyle eCreate )
 SwFrmFmt *SwWrtShell::GetTblStyle(const OUString &rFmtName)
 {
     SwFrmFmt *pFmt = 0;
-    for( sal_uInt16 i = GetTblFrmFmtCount(); i; )
+    for( size_t i = GetTblFrmFmtCount(); i; )
         if( !( pFmt = &GetTblFrmFmt( --i ) )->IsDefault() &&
             pFmt->GetName() == rFmtName && IsUsed( *pFmt ) )
             return pFmt;
commit f9fe806df0991bf3d24e38c73077b5402df4ba9b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Dec 13 00:11:21 2014 +0100

    SwNoTxtFrm::nWeight is never read
    
    Change-Id: I18cc8f4fb5e2fa2b62c360c787a4d827dab7955c

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index e51fd92..c296fc9 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -153,10 +153,6 @@ SwNoTxtFrm::SwNoTxtFrm(SwNoTxtNode * const pNode, SwFrm* pSib )
 void SwNoTxtFrm::InitCtor()
 {
     mnType = FRMC_NOTXT;
-    // The graphic's weight is 0 if it has not been read,
-    // < 0 if we had a read error and we needed to use the replacement and
-    // > 0 if it is available
-    nWeight = 0;
 }
 
 SwCntntFrm *SwNoTxtNode::MakeFrm( SwFrm* pSib )
@@ -958,7 +954,6 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
                 else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
                     nResId = STR_COMCORE_CANT_SHOW;
 
-                const_cast<SwNoTxtFrm*>(this)->nWeight = -1;
                 OUString aText;
                 if ( !nResId &&
                      (aText = pGrfNd->GetTitle()).isEmpty() &&
diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx
index 8eb6dbe..452e200 100644
--- a/sw/source/core/inc/notxtfrm.hxx
+++ b/sw/source/core/inc/notxtfrm.hxx
@@ -30,8 +30,6 @@ class SwNoTxtFrm: public SwCntntFrm
 {
     friend void _FrmFinit();
 
-    short    nWeight;                   // importance of the graphic
-
     const Size& GetSize() const;
 
     void InitCtor();
@@ -60,9 +58,6 @@ public:
 
     void StopAnimation( OutputDevice* = 0 ) const;
     bool HasAnimation()  const;
-
-    // Routine for the graphics cache
-    sal_uInt16 GetWeight() { return nWeight; }
 };
 
 #endif


More information about the Libreoffice-commits mailing list