summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2014-08-31 12:55:04 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2014-09-06 12:12:26 +0200
commitdc925031190414ecf0fc09afb5b7e2ecfe7df95e (patch)
tree6ee4b7a30d9792cacc324c4e92c11a0b4397cf12 /sw
parent698ee302a289c1cd5581b4415f06ade8af448c0e (diff)
Use more proper types, constify, avoid magic numbers
Change-Id: I15d0fd7de815398ae7323209c5e1d3613b722401
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/porrst.cxx4
-rw-r--r--sw/source/core/text/portxt.cxx2
-rw-r--r--sw/source/core/text/redlnitr.cxx21
3 files changed, 13 insertions, 14 deletions
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 5c80ebd913b0..17a30fe6f7a0 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -250,7 +250,7 @@ SwTwips SwTxtFrm::EmptyHeight() const
const IDocumentRedlineAccess* pIDRA = rTxtNode.getIDocumentRedlineAccess();
if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
{
- sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
+ const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
if( USHRT_MAX != nRedlPos )
{
SwAttrHandler aAttrHandler;
@@ -405,7 +405,7 @@ bool SwTxtFrm::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
break;
case SVX_LINE_SPACE_MIN:
{
- if( rRegDiff < sal_uInt16( rSpace.GetLineHeight() ) )
+ if( rRegDiff < rSpace.GetLineHeight() )
rRegDiff = rSpace.GetLineHeight();
break;
}
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index cb35fd24f32d..4f17702621f9 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -470,7 +470,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf )
{
// calculate number of blanks
sal_Int32 nX = rInf.GetIdx() - 1;
- sal_uInt16 nHoleLen = 1;
+ sal_Int32 nHoleLen = 1;
while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
nHoleLen++;
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 828f6ef97ec0..8427364d38e7 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -94,16 +94,15 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
pFnt->SetActual( SwScriptInfo::WhichFont( 0, 0, pScriptInfo ) );
sal_Int32 nChg = 0;
- sal_uInt16 nCnt = 0;
+ size_t nCnt = 0;
do
{
if ( nCnt >= pScriptInfo->CountScriptChg() )
break;
nChg = pScriptInfo->GetScriptChg( nCnt );
- sal_uInt16 nScript = pScriptInfo->GetScriptType( nCnt++ );
- sal_uInt8 nTmp = 4;
- switch ( nScript ) {
+ int nTmp = SW_SCRIPTS;
+ switch ( pScriptInfo->GetScriptType( nCnt++ ) ) {
case i18n::ScriptType::ASIAN :
if( !aMagicNo[SW_CJK] ) nTmp = SW_CJK; break;
case i18n::ScriptType::COMPLEX :
@@ -111,7 +110,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
default:
if( !aMagicNo[SW_LATIN ] ) nTmp = SW_LATIN;
}
- if( nTmp < 4 )
+ if( nTmp < SW_SCRIPTS )
{
pFnt->ChkMagic( pShell, nTmp );
pFnt->GetMagic( aMagicNo[ nTmp ], aFntIdx[ nTmp ], nTmp );
@@ -133,7 +132,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
const bool bShow = IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() );
if( pExtInp || bShow )
{
- sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
+ const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
if( pExtInp || USHRT_MAX != nRedlPos )
{
const std::vector<sal_uInt16> *pArr = 0;
@@ -364,7 +363,7 @@ bool SwRedlineItr::_ChkSpecialUnderline() const
// below the base line
for (size_t i = 0; i < m_Hints.size(); ++i)
{
- sal_uInt16 nWhich = m_Hints[i]->Which();
+ const sal_uInt16 nWhich = m_Hints[i]->Which();
if( RES_CHRATR_UNDERLINE == nWhich ||
RES_CHRATR_ESCAPEMENT == nWhich )
return true;
@@ -442,11 +441,11 @@ short SwExtend::Enter(SwFont& rFnt, sal_Int32 nNew)
bool SwExtend::_Leave(SwFont& rFnt, sal_Int32 nNew)
{
OSL_ENSURE( Inside(), "SwExtend: Leave without Enter" );
- sal_uInt16 nOldAttr = rArr[ nPos - nStart ];
+ const sal_uInt16 nOldAttr = rArr[ nPos - nStart ];
nPos = nNew;
if( Inside() )
{ // We stayed within the ExtendText-section
- sal_uInt16 nAttr = rArr[ nPos - nStart ];
+ const sal_uInt16 nAttr = rArr[ nPos - nStart ];
if( nOldAttr != nAttr ) // Is there an (inner) change of attributes?
{
rFnt = *pFnt;
@@ -473,8 +472,8 @@ sal_Int32 SwExtend::Next( sal_Int32 nNext )
else if( nPos < nEnd )
{
sal_Int32 nIdx = nPos - nStart;
- sal_uInt16 nAttr = rArr[ nIdx ];
- while( ++nIdx < (sal_Int32)rArr.size() && nAttr == rArr[ nIdx ] )
+ const sal_uInt16 nAttr = rArr[ nIdx ];
+ while( static_cast<size_t>(++nIdx) < rArr.size() && nAttr == rArr[ nIdx ] )
; //nothing
nIdx = nIdx + nStart;
if( nNext > nIdx )