[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Sun Jan 25 02:19:28 PST 2015
sw/inc/docary.hxx | 1 +
sw/source/core/doc/docbasic.cxx | 4 ++--
sw/source/core/doc/docbm.cxx | 2 +-
sw/source/core/doc/docchart.cxx | 16 ++++++++--------
sw/source/core/doc/doccomp.cxx | 11 +++++------
sw/source/core/doc/docglos.cxx | 4 ++--
6 files changed, 19 insertions(+), 19 deletions(-)
New commits:
commit 802b80fcd378d5788adff1c7c98af526651a30c2
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Jan 25 01:31:20 2015 +0100
Retrieve sub-OUStrings without unnecessary copying
Change-Id: I1aaaef4bf81f5b56fe71ca0aae59b59dbd0dee59
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index bbe92a0..426fd56 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -51,16 +51,16 @@ bool SwTable::IsTblComplexForChart( const OUString& rSelection ) const
const SwTableBox* pSttBox, *pEndBox;
if( 2 < rSelection.getLength() )
{
- // Remove brackets at the beginning and from the end
- OUString sBox( rSelection );
- if( '<' == sBox[0] ) sBox = sBox.copy( 1 );
- if( '>' == sBox[ sBox.getLength()-1 ] ) sBox = sBox.copy( 0, sBox.getLength()-1 );
-
- sal_Int32 nSeparator = sBox.indexOf( ':' );
+ const sal_Int32 nSeparator {rSelection.indexOf( ':' )};
OSL_ENSURE( -1 != nSeparator, "no valid selection" );
- pSttBox = GetTblBox( sBox.copy( 0, nSeparator ));
- pEndBox = GetTblBox( sBox.copy( nSeparator+1 ));
+ // Remove brackets at the beginning and from the end
+ const sal_Int32 nOffset {'<' == rSelection[0] ? 1 : 0};
+ const sal_Int32 nLength {'>' == rSelection[ rSelection.getLength()-1 ]
+ ? rSelection.getLength()-1 : rSelection.getLength()};
+
+ pSttBox = GetTblBox(rSelection.copy( nOffset, nSeparator - nOffset ));
+ pEndBox = GetTblBox(rSelection.copy( nSeparator+1, nLength - (nSeparator+1) ));
}
else
{
commit 834f711841f0d7a29b23eac47267c6ad852f395e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Jan 25 01:03:12 2015 +0100
Fix selection handling in SwTable::IsTblComplexForChart
Change-Id: I5f35a705316db164474c64ea99ee4e4eada57d49
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index 669fa78..bbe92a0 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -53,7 +53,7 @@ bool SwTable::IsTblComplexForChart( const OUString& rSelection ) const
{
// Remove brackets at the beginning and from the end
OUString sBox( rSelection );
- if( '<' == sBox[0] ) sBox = sBox.copy( 0, 1 );
+ if( '<' == sBox[0] ) sBox = sBox.copy( 1 );
if( '>' == sBox[ sBox.getLength()-1 ] ) sBox = sBox.copy( 0, sBox.getLength()-1 );
sal_Int32 nSeparator = sBox.indexOf( ':' );
commit 0019a535f27e666fba98bc37d8d672544d40c526
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Jan 25 00:56:38 2015 +0100
Use more proper integer types
Change-Id: I0c0eceb46738af44e527cbda48e62f4ca75e069d
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 4f40a22..fba92fb 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -229,6 +229,7 @@ public:
using _SwRedlineTbl::begin;
using _SwRedlineTbl::end;
using _SwRedlineTbl::size;
+ using _SwRedlineTbl::size_type;
using _SwRedlineTbl::operator[];
using _SwRedlineTbl::empty;
};
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index fd3f601..b3272a5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1369,7 +1369,7 @@ void _DelBookmarks(
// which holds all position information as offset.
// Assignement happens after moving.
SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
- for(sal_uInt16 nCnt = 0; nCnt < rTbl.size(); ++nCnt )
+ for(SwRedlineTbl::size_type nCnt = 0; nCnt < rTbl.size(); ++nCnt )
{
// Is at position?
SwRangeRedline* pRedl = rTbl[ nCnt ];
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 91ab8d0..61f207f 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -624,16 +624,15 @@ void Compare::CountDifference( const CompareData& rData, sal_uLong* pCounts )
void Compare::SetDiscard( const CompareData& rData,
sal_Char* pDiscard, sal_uLong* pCounts )
{
- sal_uLong nLen = rData.GetLineCount();
+ const sal_uLong nLen = rData.GetLineCount();
// calculate Max with respect to the line count
- sal_uInt16 nMax = 5;
- sal_uLong n;
+ sal_uLong nMax = 5;
- for( n = nLen / 64; ( n = n >> 2 ) > 0; )
+ for( sal_uLong n = nLen / 64; ( n = n >> 2 ) > 0; )
nMax <<= 1;
- for( n = 0; n < nLen; ++n )
+ for( sal_uLong n = 0; n < nLen; ++n )
{
sal_uLong nIdx = rData.GetIndex( n );
if( nIdx )
@@ -2077,7 +2076,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTbl();
sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex();
sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex();
- for( sal_uInt16 n = 0; n < rSrcRedlTbl.size(); ++n )
+ for( SwRedlineTbl::size_type n = 0; n < rSrcRedlTbl.size(); ++n )
{
const SwRangeRedline* pRedl = rSrcRedlTbl[ n ];
sal_uLong nNd = pRedl->GetPoint()->nNode.GetIndex();
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
index 51cb97c..0e08b60 100644
--- a/sw/source/core/doc/docglos.cxx
+++ b/sw/source/core/doc/docglos.cxx
@@ -130,8 +130,8 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
SwPaM& rPaM, SwCrsrShell* pShell )
{
bool bRet = false;
- sal_uInt16 nIdx = rBlock.GetIndex( rEntry );
- if( (sal_uInt16) -1 != nIdx )
+ const sal_uInt16 nIdx = rBlock.GetIndex( rEntry );
+ if( USHRT_MAX != nIdx )
{
bool bSav_IsInsGlossary = mbInsOnlyTxtGlssry;
mbInsOnlyTxtGlssry = rBlock.IsOnlyTextBlock( nIdx );
commit 43ecb25e97d3566bb1dcd6ce171550195f185fa1
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Jan 24 21:04:03 2015 +0100
sal_uInt16 to size_t, avoid unneeded OUString temporary
Change-Id: I218603ae912523429176a815165750c6f2e17bbb
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index af1194d..e460114 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -51,7 +51,7 @@ static Sequence<Any> *lcl_docbasic_convertArgs( SbxArray& rArgs )
switch( pVar->GetType() )
{
case SbxSTRING:
- pUnoArgs[i] <<= OUString( pVar->GetOUString() );
+ pUnoArgs[i] <<= pVar->GetOUString();
break;
case SbxCHAR:
pUnoArgs[i] <<= (sal_Int16)pVar->GetChar() ;
@@ -183,7 +183,7 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
if( GetSpzFrmFmts()->Contains( pFmt ) &&
0 != (pIMap = pFmt->GetURL().GetMap()) )
{
- for( sal_uInt16 nPos = pIMap->GetIMapObjectCount(); nPos; )
+ for( size_t nPos = pIMap->GetIMapObjectCount(); nPos; )
if( pIMapObj == pIMap->GetIMapObject( --nPos ))
{
bCheckPtr = false; // misuse as a flag
More information about the Libreoffice-commits
mailing list