summaryrefslogtreecommitdiff
path: root/desktop/source/migration/services
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-06 22:36:02 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-07 07:20:18 +0100
commit1b0beef8794210b2af49d8c4a00ca7d4e3ebedb7 (patch)
tree33ab3e47f8643ea48f6bee5a1aaa145f1c5b05d5 /desktop/source/migration/services
parent9d1f56903b05841020dfae21dca0c686483b2494 (diff)
Use for-range loops in desktop (part2)
+ use 1 time replace size() > 0 by !empty() Change-Id: If62a17171fc09e0bead7c0a791758705f62920d1 Reviewed-on: https://gerrit.libreoffice.org/50847 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'desktop/source/migration/services')
-rw-r--r--desktop/source/migration/services/basicmigration.cxx16
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.cxx16
-rw-r--r--desktop/source/migration/services/wordbookmigration.cxx18
3 files changed, 20 insertions, 30 deletions
diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx
index 1b407adba228..a3f266d4f88b 100644
--- a/desktop/source/migration/services/basicmigration.cxx
+++ b/desktop/source/migration/services/basicmigration.cxx
@@ -87,12 +87,10 @@ namespace migration
}
// iterate recursive over subfolders
- TStringVector::const_iterator aI = aSubDirs.begin();
- while ( aI != aSubDirs.end() )
+ for (auto const& subDir : aSubDirs)
{
- TStringVectorPtr aSubResult = getFiles( *aI );
+ TStringVectorPtr aSubResult = getFiles(subDir);
aResult->insert( aResult->end(), aSubResult->begin(), aSubResult->end() );
- ++aI;
}
}
@@ -121,21 +119,19 @@ namespace migration
{
sTargetDir += sTargetUserBasic;
TStringVectorPtr aFileList = getFiles( m_sSourceDir );
- TStringVector::const_iterator aI = aFileList->begin();
- while ( aI != aFileList->end() )
+ for (auto const& elem : *aFileList)
{
- OUString sLocalName = aI->copy( m_sSourceDir.getLength() );
+ OUString sLocalName = elem.copy( m_sSourceDir.getLength() );
OUString sTargetName = sTargetDir + sLocalName;
INetURLObject aURL( sTargetName );
aURL.removeSegment();
checkAndCreateDirectory( aURL );
- ::osl::FileBase::RC aResult = ::osl::File::copy( *aI, sTargetName );
+ ::osl::FileBase::RC aResult = ::osl::File::copy( elem, sTargetName );
if ( aResult != ::osl::FileBase::E_None )
{
SAL_WARN( "desktop", "BasicMigration::copyFiles: cannot copy "
- << *aI << " to " << sTargetName );
+ << elem << " to " << sTargetName );
}
- ++aI;
}
}
else
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index b98b90bf559f..75bbf5864c45 100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -152,11 +152,11 @@ OO3ExtensionMigration::ScanResult OO3ExtensionMigration::scanExtensionFolder( co
}
}
- TStringVector::const_iterator pIter = aDirectories.begin();
- while ( pIter != aDirectories.end() && aResult == SCANRESULT_NOTFOUND )
+ for (auto const& directory : aDirectories)
{
- aResult = scanExtensionFolder( *pIter );
- ++pIter;
+ aResult = scanExtensionFolder(directory);
+ if (aResult != SCANRESULT_NOTFOUND)
+ break;
}
}
return aResult;
@@ -345,13 +345,11 @@ Any OO3ExtensionMigration::execute( const Sequence< beans::NamedValue >& )
sSourceDir += "/user/uno_packages/cache/uno_packages";
TStringVector aExtensionToMigrate;
scanUserExtensions( sSourceDir, aExtensionToMigrate );
- if ( aExtensionToMigrate.size() > 0 )
+ if (!aExtensionToMigrate.empty())
{
- TStringVector::iterator pIter = aExtensionToMigrate.begin();
- while ( pIter != aExtensionToMigrate.end() )
+ for (auto const& extensionToMigrate : aExtensionToMigrate)
{
- migrateExtension( *pIter );
- ++pIter;
+ migrateExtension(extensionToMigrate);
}
}
}
diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx
index 8730a8707b29..3a0f4bd1c165 100644
--- a/desktop/source/migration/services/wordbookmigration.cxx
+++ b/desktop/source/migration/services/wordbookmigration.cxx
@@ -80,12 +80,10 @@ namespace migration
}
// iterate recursive over subfolders
- TStringVector::const_iterator aI = aSubDirs.begin();
- while ( aI != aSubDirs.end() )
+ for (auto const& subDir : aSubDirs)
{
- TStringVectorPtr aSubResult = getFiles( *aI );
+ TStringVectorPtr aSubResult = getFiles(subDir);
aResult->insert( aResult->end(), aSubResult->begin(), aSubResult->end() );
- ++aI;
}
}
@@ -152,24 +150,22 @@ bool IsUserWordbook( const OUString& rFile )
{
sTargetDir += "/user/wordbook";
TStringVectorPtr aFileList = getFiles( m_sSourceDir );
- TStringVector::const_iterator aI = aFileList->begin();
- while ( aI != aFileList->end() )
+ for (auto const& elem : *aFileList)
{
- if (IsUserWordbook(*aI) )
+ if (IsUserWordbook(elem) )
{
- OUString sSourceLocalName = aI->copy( m_sSourceDir.getLength() );
+ OUString sSourceLocalName = elem.copy( m_sSourceDir.getLength() );
OUString sTargetName = sTargetDir + sSourceLocalName;
INetURLObject aURL( sTargetName );
aURL.removeSegment();
checkAndCreateDirectory( aURL );
- ::osl::FileBase::RC aResult = ::osl::File::copy( *aI, sTargetName );
+ ::osl::FileBase::RC aResult = ::osl::File::copy( elem, sTargetName );
if ( aResult != ::osl::FileBase::E_None )
{
SAL_WARN( "desktop", "WordbookMigration::copyFiles: cannot copy "
- << *aI << " to " << sTargetName);
+ << elem << " to " << sTargetName);
}
}
- ++aI;
}
}
else