summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-05-31 20:41:44 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-05-31 23:35:54 +0200
commit0b8ae8aa7867e63f12517e4a575a700bd07f6d7d (patch)
tree6fbeaf8e8d6cdb2e5421135c37b2b5d0d5203073 /sw
parent1b554d3ada47063496b8cf4a28239da26a6537ae (diff)
Use size_t, auto and range-based for loops
Change-Id: I7f3672928b3d1ee937c7c6c2684b1396425b9fe6
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/htmlctxt.cxx18
-rw-r--r--sw/source/filter/html/htmlgrin.cxx2
-rw-r--r--sw/source/filter/html/htmlnumreader.cxx2
-rw-r--r--sw/source/filter/html/htmlsect.cxx6
-rw-r--r--sw/source/filter/html/htmltab.cxx24
-rw-r--r--sw/source/filter/html/swhtml.cxx15
-rw-r--r--sw/source/filter/html/swhtml.hxx4
7 files changed, 36 insertions, 35 deletions
diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index 8772b6827175..0184637824a9 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -47,10 +47,10 @@ class _HTMLAttrContext_SaveDoc
// wenn Attributierung nicht
// beibehalten werden soll.
- sal_uInt16 nContextStMin; // In Umgebung gueltige Stack-
+ size_t nContextStMin; // In Umgebung gueltige Stack-
// Untergrenze, wenn der Stack
// geschuetzt werden soll.
- sal_uInt16 nContextStAttrMin; // In Umgebung gueltige Stack-
+ size_t nContextStAttrMin; // In Umgebung gueltige Stack-
// Untergrenze, wenn die Attribute
// nicht beibehalten werden sollen.
@@ -63,7 +63,7 @@ public:
_HTMLAttrContext_SaveDoc() :
pPos( 0 ), pAttrTab( 0 ),
- nContextStMin( USHRT_MAX ), nContextStAttrMin( USHRT_MAX ),
+ nContextStMin( SIZE_MAX ), nContextStAttrMin( SIZE_MAX ),
bStripTrailingPara( false ), bKeepNumRules( false ),
bFixHeaderDist( false ), bFixFooterDist( false )
{}
@@ -80,11 +80,11 @@ public:
_HTMLAttrTable *GetAttrTab( bool bCreate= false );
- void SetContextStMin( sal_uInt16 nMin ) { nContextStMin = nMin; }
- sal_uInt16 GetContextStMin() const { return nContextStMin; }
+ void SetContextStMin( size_t nMin ) { nContextStMin = nMin; }
+ size_t GetContextStMin() const { return nContextStMin; }
- void SetContextStAttrMin( sal_uInt16 nMin ) { nContextStAttrMin = nMin; }
- sal_uInt16 GetContextStAttrMin() const { return nContextStAttrMin; }
+ void SetContextStAttrMin( size_t nMin ) { nContextStAttrMin = nMin; }
+ size_t GetContextStAttrMin() const { return nContextStAttrMin; }
void SetStripTrailingPara( bool bSet ) { bStripTrailingPara = bSet; }
bool GetStripTrailingPara() const { return bStripTrailingPara; }
@@ -309,10 +309,10 @@ void SwHTMLParser::RestoreDocContext( _HTMLAttrContext *pCntxt )
SetAttr();
}
- if( USHRT_MAX != pSave->GetContextStMin() )
+ if( SIZE_MAX != pSave->GetContextStMin() )
{
nContextStMin = pSave->GetContextStMin();
- if( USHRT_MAX != pSave->GetContextStAttrMin() )
+ if( SIZE_MAX != pSave->GetContextStAttrMin() )
nContextStAttrMin = pSave->GetContextStAttrMin();
}
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index ab51592c16d7..1246d1df8fd3 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -160,7 +160,7 @@ void SwHTMLParser::SetAnchorAndAdjustment( sal_Int16 eVertOri,
SfxItemSet& rFrmItemSet )
{
const SfxItemSet *pCntnrItemSet = 0;
- sal_uInt16 i = aContexts.size();
+ auto i = aContexts.size();
while( !pCntnrItemSet && i > nContextStMin )
pCntnrItemSet = aContexts[--i]->GetFrmItemSet();
diff --git a/sw/source/filter/html/htmlnumreader.cxx b/sw/source/filter/html/htmlnumreader.cxx
index dc1d49b846f1..d2a5fe33cbca 100644
--- a/sw/source/filter/html/htmlnumreader.cxx
+++ b/sw/source/filter/html/htmlnumreader.cxx
@@ -559,7 +559,7 @@ void SwHTMLParser::EndNumBulListItem( int nToken, bool bSetColl,
// Kontext zu dem Token suchen und vom Stack holen
_HTMLAttrContext *pCntxt = 0;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
nToken &= ~1;
while( !pCntxt && nPos>nContextStMin )
{
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index 9b5325d8af4e..6cddcd99fe84 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -389,7 +389,7 @@ void SwHTMLParser::EndDivision( int /*nToken*/ )
// Stack-Eintrag zu dem Token suchen (weil wir noch den Div-Stack
// haben unterscheiden wir erst einmal nicht zwischen DIV und CENTER
_HTMLAttrContext *pCntxt = 0;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
while( !pCntxt && nPos>nContextStMin )
{
switch( aContexts[--nPos]->GetToken() )
@@ -524,7 +524,7 @@ bool SwHTMLParser::EndSection( bool bLFStripped )
bool SwHTMLParser::EndSections( bool bLFStripped )
{
bool bSectionClosed = false;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
while( nPos>nContextStMin )
{
_HTMLAttrContext *pCntxt = aContexts[--nPos];
@@ -589,7 +589,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
//.is the multicol elememt contained in a container? That may be the
// case for 5.0 documents.
bool bInCntnr = false;
- sal_uInt16 i = aContexts.size();
+ auto i = aContexts.size();
while( !bInCntnr && i > nContextStMin )
bInCntnr = 0 != aContexts[--i]->GetFrmItemSet();
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index d01333dd1de7..b6e5bb5350ed 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -108,8 +108,8 @@ class _HTMLTableContext
SwFrameFormat *pFrameFormat; // der Fly frame::Frame, containing the table
SwPosition *pPos; // position behind the table
- sal_uInt16 nContextStAttrMin;
- sal_uInt16 nContextStMin;
+ size_t nContextStAttrMin;
+ size_t nContextStMin;
bool bRestartPRE : 1;
bool bRestartXMP : 1;
@@ -119,8 +119,8 @@ public:
_HTMLAttrTable aAttrTab; // attributes
- _HTMLTableContext( SwPosition *pPs, sal_uInt16 nCntxtStMin,
- sal_uInt16 nCntxtStAttrMin ) :
+ _HTMLTableContext( SwPosition *pPs, size_t nCntxtStMin,
+ size_t nCntxtStAttrMin ) :
pTableNd( 0 ),
pFrameFormat( 0 ),
pPos( pPs ),
@@ -149,8 +149,8 @@ public:
void SetFrameFormat( SwFrameFormat *pFormat ) { pFrameFormat = pFormat; }
SwFrameFormat *GetFrameFormat() const { return pFrameFormat; }
- sal_uInt16 GetContextStMin() const { return nContextStMin; }
- sal_uInt16 GetContextStAttrMin() const { return nContextStAttrMin; }
+ size_t GetContextStMin() const { return nContextStMin; }
+ size_t GetContextStAttrMin() const { return nContextStAttrMin; }
};
// Cell content is a linked list with SwStartNodes and
@@ -2985,7 +2985,9 @@ SvxBrushItem* SwHTMLParser::CreateBrushItem( const Color *pColor,
class _SectionSaveStruct : public SwPendingStackData
{
sal_uInt16 nBaseFontStMinSave, nFontStMinSave, nFontStHeadStartSave;
- sal_uInt16 nDefListDeepSave, nContextStMinSave, nContextStAttrMinSave;
+ sal_uInt16 nDefListDeepSave;
+ size_t nContextStMinSave;
+ size_t nContextStAttrMinSave;
public:
@@ -2995,7 +2997,7 @@ public:
virtual ~_SectionSaveStruct();
#if OSL_DEBUG_LEVEL > 0
- sal_uInt16 GetContextStAttrMin() const { return nContextStAttrMinSave; }
+ size_t GetContextStAttrMin() const { return nContextStAttrMinSave; }
#endif
void Restore( SwHTMLParser& rParser );
};
@@ -3303,7 +3305,7 @@ void _CellSaveStruct::InsertCell( SwHTMLParser& rParser,
{
_HTMLAttr** pTable = reinterpret_cast<_HTMLAttr**>(&rParser.aAttrTab);
- for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* );
+ for( auto nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* );
nCnt--; ++pTable )
{
OSL_ENSURE( !*pTable, "Die Attribut-Tabelle ist nicht leer" );
@@ -4096,7 +4098,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
// Alle noch offenen Kontexte beenden. Wir nehmen hier
// AttrMin, weil nContxtStMin evtl. veraendert wurde.
// Da es durch EndContext wieder restauriert wird, geht das.
- while( (sal_uInt16)aContexts.size() > nContextStAttrMin+1 )
+ while( aContexts.size() > nContextStAttrMin+1 )
{
_HTMLAttrContext *pCntxt = PopContext();
EndContext( pCntxt );
@@ -4915,7 +4917,7 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable )
}
// Alle noch offenen Kontexte beenden
- while( (sal_uInt16)aContexts.size() > nContextStAttrMin+1 )
+ while( aContexts.size() > nContextStAttrMin+1 )
{
_HTMLAttrContext *pCntxt = PopContext();
EndContext( pCntxt );
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 4ab6dee8fda1..f5f501e23d91 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -4085,7 +4085,7 @@ void SwHTMLParser::EndHeading()
// Kontext zu dem Token suchen und vom Stack holen
_HTMLAttrContext *pCntxt = 0;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
while( !pCntxt && nPos>nContextStMin )
{
switch( aContexts[--nPos]->GetToken() )
@@ -4283,7 +4283,7 @@ void SwHTMLParser::NewDefList()
nDefListDeep++;
bool bInDD = false, bNotInDD = false;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
while( !bInDD && !bNotInDD && nPos>nContextStMin )
{
sal_uInt16 nCntxtToken = aContexts[--nPos]->GetToken();
@@ -4377,7 +4377,7 @@ void SwHTMLParser::NewDefListItem( int nToken )
{
// festellen, ob das DD/DT in einer DL vorkommt
bool bInDefList = false, bNotInDefList = false;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
while( !bInDefList && !bNotInDefList && nPos>nContextStMin )
{
sal_uInt16 nCntxtToken = aContexts[--nPos]->GetToken();
@@ -4418,7 +4418,7 @@ void SwHTMLParser::EndDefListItem( int nToken, bool bSetColl,
// Kontext zu dem Token suchen und vom Stack holen
nToken &= ~1;
_HTMLAttrContext *pCntxt = 0;
- sal_uInt16 nPos = aContexts.size();
+ auto nPos = aContexts.size();
while( !pCntxt && nPos>nContextStMin )
{
sal_uInt16 nCntxtToken = aContexts[--nPos]->GetToken();
@@ -4547,9 +4547,8 @@ void SwHTMLParser::SetTextCollAttrs( _HTMLAttrContext *pContext )
sal_uInt16 nLeftMargin = 0, nRightMargin = 0; // die Einzuege und
short nFirstLineIndent = 0; // Abstaende
- sal_uInt16 i;
- for( i = nContextStAttrMin; i < aContexts.size(); i++ )
+ for( auto i = nContextStAttrMin; i < aContexts.size(); ++i )
{
const _HTMLAttrContext *pCntxt = aContexts[i];
@@ -4716,8 +4715,8 @@ void SwHTMLParser::SetTextCollAttrs( _HTMLAttrContext *pContext )
// bisherige harte Attributierung des Absatzes entfernen
if( !aParaAttrs.empty() )
{
- for( i=0; i<aParaAttrs.size(); i++ )
- aParaAttrs[i]->Invalidate();
+ for( auto pParaAttr : aParaAttrs )
+ pParaAttr->Invalidate();
aParaAttrs.clear();
}
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 8c9f9c1453ad..4b9701d4b171 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -418,8 +418,8 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
sal_uInt16 nSBModuleCnt; // Zaehler fuer Basic-Module
sal_uInt16 nMissingImgMaps; // Wie viele Image-Maps fehlen noch?
size_t nParaCnt;
- sal_uInt16 nContextStMin; // Untergrenze fuer PopContext
- sal_uInt16 nContextStAttrMin; // Untergrenze fuer Attributierung
+ size_t nContextStMin; // Untergrenze fuer PopContext
+ size_t nContextStAttrMin; // Untergrenze fuer Attributierung
sal_uInt16 nSelectEntryCnt; // Anzahl der Eintraege der akt. Listbox
sal_uInt16 nOpenParaToken; // ein geoeffnetes Absatz-Element