summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-10 14:39:07 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-11 06:54:34 +0000
commit265068d65b39688b8a4756dfbcd46453dd1f9b70 (patch)
tree6936185b2f2f46b99646d00e542cdde845ef073d /sot
parent9e0335d1db22bd3ad3f4bb249b30a00fd55558f4 (diff)
clang-tidy modernize-loop-convert in scripting to svtools
Change-Id: I98229d14109cf243839d632feabde1391ea9bad5 Reviewed-on: https://gerrit.libreoffice.org/24847 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sot')
-rw-r--r--sot/source/base/filelist.cxx4
-rw-r--r--sot/source/sdstor/stgelem.cxx16
-rw-r--r--sot/source/sdstor/ucbstorage.cxx19
3 files changed, 17 insertions, 22 deletions
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index 49346445e271..b22e2c62acda 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.cxx
@@ -48,8 +48,8 @@ void FileList::ClearAll()
FileList& FileList::operator=( const FileList& rFileList )
{
- for ( size_t i = 0, n = rFileList.aStrList.size(); i < n; ++i )
- aStrList.push_back( rFileList.aStrList[ i ] );
+ for (const auto & i : rFileList.aStrList)
+ aStrList.push_back( i );
return *this;
}
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 7e2c5fbd458d..fc269006c334 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -145,8 +145,8 @@ bool StgHeader::Load( SvStream& r )
.ReadInt32( m_nDataFATSize ) // 40 # of data FATpages
.ReadInt32( m_nMasterChain ) // 44 chain to the next master block
.ReadInt32( m_nMaster ); // 48 # of additional master blocks
- for( short i = 0; i < cFATPagesInHeader; i++ )
- r.ReadInt32( m_nMasterFAT[ i ] );
+ for(sal_Int32 & i : m_nMasterFAT)
+ r.ReadInt32( i );
return (r.GetErrorCode() == ERRCODE_NONE) && Check();
}
@@ -173,8 +173,8 @@ bool StgHeader::Store( StgIo& rIo )
.WriteInt32( m_nDataFATSize ) // 40 # of data FAT pages
.WriteInt32( m_nMasterChain ) // 44 chain to the next master block
.WriteInt32( m_nMaster ); // 48 # of additional master blocks
- for( short i = 0; i < cFATPagesInHeader; i++ )
- r.WriteInt32( m_nMasterFAT[ i ] );
+ for(sal_Int32 i : m_nMasterFAT)
+ r.WriteInt32( i );
m_bDirty = sal_uInt8(!rIo.Good());
return !m_bDirty;
}
@@ -392,8 +392,8 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 nUnderlyi
return false;
SvMemoryStream r( const_cast<void *>(pFrom), nBufSize, StreamMode::READ );
- for( short i = 0; i < 32; i++ )
- r.ReadUtf16( m_nName[ i ] ); // 00 name as WCHAR
+ for(sal_Unicode & i : m_nName)
+ r.ReadUtf16( i ); // 00 name as WCHAR
r.ReadUInt16( m_nNameLen ) // 40 size of name in bytes including 00H
.ReadUChar( m_cType ) // 42 entry type
.ReadUChar( m_cFlags ) // 43 0 or 1 (tree balance?)
@@ -453,8 +453,8 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 nUnderlyi
void StgEntry::Store( void* pTo )
{
SvMemoryStream r( pTo, 128, StreamMode::WRITE );
- for( short i = 0; i < 32; i++ )
- r.WriteUInt16( m_nName[ i ] ); // 00 name as WCHAR
+ for(sal_Unicode i : m_nName)
+ r.WriteUInt16( i ); // 00 name as WCHAR
r.WriteUInt16( m_nNameLen ) // 40 size of name in bytes including 00H
.WriteUChar( m_cType ) // 42 entry type
.WriteUChar( m_cFlags ) // 43 0 or 1 (tree balance?)
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 8aa42b0219db..0d2ef5d30850 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1871,9 +1871,8 @@ void UCBStorage_Impl::SetError( ErrCode nError )
sal_Int32 UCBStorage_Impl::GetObjectCount()
{
sal_Int32 nCount = m_aChildrenList.size();
- for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
+ for (UCBStorageElement_Impl* pElement : m_aChildrenList)
{
- UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.Is(), "Storage should be open!" );
if ( pElement->m_bIsFolder && pElement->m_xStorage.Is() )
nCount += pElement->m_xStorage->GetObjectCount();
@@ -1928,9 +1927,8 @@ void UCBStorage_Impl::SetProps( const Sequence < Sequence < PropertyValue > >& r
// the "FullPath" of a child always starts without '/'
aPath.clear();
- for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
+ for (UCBStorageElement_Impl* pElement : m_aChildrenList)
{
- UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.Is(), "Storage should be open!" );
if ( pElement->m_bIsFolder && pElement->m_xStorage.Is() )
pElement->m_xStorage->SetProps( rSequence, aPath );
@@ -1980,9 +1978,8 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
aPath.clear();
// now the properties of my elements
- for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
+ for (UCBStorageElement_Impl* pElement : m_aChildrenList)
{
- UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.Is(), "Storage should be open!" );
if ( pElement->m_bIsFolder && pElement->m_xStorage.Is() )
// storages add there properties by themselves ( see above )
@@ -2004,8 +2001,8 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
UCBStorage_Impl::~UCBStorage_Impl()
{
// first delete elements!
- for ( size_t i = 0, n = m_aChildrenList.size(); i < n; ++i )
- delete m_aChildrenList[ i ];
+ for (UCBStorageElement_Impl* i : m_aChildrenList)
+ delete i;
m_aChildrenList.clear();
delete m_pContent;
@@ -2444,9 +2441,8 @@ OUString UCBStorage::GetUserName()
void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const
{
// put information in childrenlist into StorageInfoList
- for ( size_t i = 0; i < pImp->GetChildrenList().size(); ++i )
+ for (UCBStorageElement_Impl* pElement : pImp->GetChildrenList())
{
- UCBStorageElement_Impl* pElement = pImp->GetChildrenList()[ i ];
if ( !pElement->m_bIsRemoved )
{
// problem: what about the size of a substorage ?!
@@ -2540,9 +2536,8 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const OUString& rName ) const
{
DBG_ASSERT( !rName.isEmpty(), "Name is empty!" );
- for ( size_t i = 0, n = pImp->GetChildrenList().size(); i < n; ++i )
+ for (UCBStorageElement_Impl* pElement : pImp->GetChildrenList())
{
- UCBStorageElement_Impl* pElement = pImp->GetChildrenList()[ i ];
if ( pElement->m_aName == rName && !pElement->m_bIsRemoved )
return pElement;
}