fdo#57950: Remove some chained appends in xmhelp

Change-Id: I4680547aa1d12d3e8eab3c33e3158845848c2068
Reviewed-on: https://gerrit.libreoffice.org/5376
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
This commit is contained in:
Jelle van der Waa 2013-08-12 21:29:22 +02:00 committed by Tor Lillqvist
parent 5a2c13a79a
commit 87b5ac652d
3 changed files with 13 additions and 38 deletions

View File

@ -576,7 +576,7 @@ helpdatafileproxy::Hdf* Databases::getHelpDataFile( const OUString& Database,
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
OUString aFileExt( helpText ? OUString(".ht") : OUString(".db") ); OUString aFileExt( helpText ? OUString(".ht") : OUString(".db") );
OUString dbFileName = OUStringBuffer().append('/').append(Database).append(aFileExt).makeStringAndClear(); OUString dbFileName = "/" + Database + aFileExt;
OUString key; OUString key;
if( pExtensionPath == NULL ) if( pExtensionPath == NULL )
key = processLang( Language ) + dbFileName; key = processLang( Language ) + dbFileName;
@ -920,7 +920,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const OUString& jar,
{ {
return Reference< XHierarchicalNameAccess >( 0 ); return Reference< XHierarchicalNameAccess >( 0 );
} }
OUString key = OUStringBuffer(processLang(Language)).append('/').append(jar).makeStringAndClear(); OUString key = processLang(Language) + "/" + jar;
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
@ -940,12 +940,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const OUString& jar,
OUString aExtensionPath = jar.copy( nQuestionMark1 + 1, nQuestionMark2 - nQuestionMark1 - 1 ); OUString aExtensionPath = jar.copy( nQuestionMark1 + 1, nQuestionMark2 - nQuestionMark1 - 1 );
OUString aPureJar = jar.copy( nQuestionMark2 + 1 ); OUString aPureJar = jar.copy( nQuestionMark2 + 1 );
OUStringBuffer aStrBuf; zipFile = expandURL( aExtensionPath + "/" + aPureJar );
aStrBuf.append( aExtensionPath );
aStrBuf.append( '/' );
aStrBuf.append( aPureJar );
zipFile = expandURL( aStrBuf.makeStringAndClear() );
} }
else else
{ {
@ -1485,18 +1480,13 @@ OUString ExtensionIteratorBase::implGetFileFromPackage(
OUString aLanguage = m_aLanguage; OUString aLanguage = m_aLanguage;
for( sal_Int32 iPass = 0 ; iPass < 2 ; ++iPass ) for( sal_Int32 iPass = 0 ; iPass < 2 ; ++iPass )
{ {
OUStringBuffer aStrBuf; OUString aStr = xPackage->getRegistrationDataURL().Value + "/" + aLanguage;
aStrBuf.append( xPackage->getRegistrationDataURL().Value);
aStrBuf.append( '/' );
aStrBuf.append( aLanguage );
if( !bLangFolderOnly ) if( !bLangFolderOnly )
{ {
aStrBuf.append( '/' ); aStr += "/help" + rFileExtension;
aStrBuf.append( "help" );
aStrBuf.append( rFileExtension );
} }
aFile = m_rDatabases.expandURL( aStrBuf.makeStringAndClear() ); aFile = m_rDatabases.expandURL( aStr );
if( iPass == 0 ) if( iPass == 0 )
{ {
if( m_xSFA->exists( aFile ) ) if( m_xSFA->exists( aFile ) )
@ -1626,7 +1616,7 @@ helpdatafileproxy::Hdf* DataBaseIterator::implGetHdfFromPackage( Reference< depl
helpdatafileproxy::Hdf* pRetHdf = NULL; helpdatafileproxy::Hdf* pRetHdf = NULL;
if (optRegData.IsPresent && !optRegData.Value.isEmpty()) if (optRegData.IsPresent && !optRegData.Value.isEmpty())
{ {
OUString aRegDataUrl = OUStringBuffer(optRegData.Value).append('/').makeStringAndClear(); OUString aRegDataUrl = optRegData.Value + "/";
OUString aHelpFilesBaseName("help"); OUString aHelpFilesBaseName("help");
@ -1652,7 +1642,7 @@ helpdatafileproxy::Hdf* DataBaseIterator::implGetHdfFromPackage( Reference< depl
*o_pExtensionPath = aRegDataUrl + aUsedLanguage; *o_pExtensionPath = aRegDataUrl + aUsedLanguage;
if( o_pExtensionRegistryPath ) if( o_pExtensionRegistryPath )
*o_pExtensionRegistryPath = OUStringBuffer(xPackage->getURL()).append('/').append(aUsedLanguage).makeStringAndClear(); *o_pExtensionRegistryPath = xPackage->getURL() + "/" + aUsedLanguage;
} }
return pRetHdf; return pRetHdf;
@ -1869,9 +1859,9 @@ OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o_rbTe
switch( m_eState ) switch( m_eState )
{ {
case INITIAL_MODULE: case INITIAL_MODULE:
aIndexFolder = OUStringBuffer(m_rDatabases.getInstallPathAsURL()). aIndexFolder = m_rDatabases.getInstallPathAsURL()
append(m_rDatabases.processLang(m_aLanguage)).append('/'). + m_rDatabases.processLang(m_aLanguage) + "/"
append(m_aInitialModule).append(".idxl").makeStringAndClear(); + m_aInitialModule + ".idxl";
o_rbTemporary = false; o_rbTemporary = false;
o_rbExtension = false; o_rbExtension = false;

View File

@ -306,12 +306,7 @@ void URLParameter::readHelpDataFile()
m_aJar = converter.getDatabase(); m_aJar = converter.getDatabase();
if( !aExtensionPath.isEmpty() ) if( !aExtensionPath.isEmpty() )
{ {
OUStringBuffer aExtendedJarStrBuf; m_aJar = "?" + aExtensionPath + "?" + m_aJar;
aExtendedJarStrBuf.append( '?' );
aExtendedJarStrBuf.append( aExtensionPath );
aExtendedJarStrBuf.append( '?' );
aExtendedJarStrBuf.append( m_aJar );
m_aJar = aExtendedJarStrBuf.makeStringAndClear();
m_aExtensionRegistryPath = aExtensionRegistryPath; m_aExtensionRegistryPath = aExtensionRegistryPath;
} }
m_aTag = converter.getHash(); m_aTag = converter.getHash();

View File

@ -913,8 +913,6 @@ void TVChildTarget::subst( OUString& instpath ) const
// class ExtensionIteratorBase // class ExtensionIteratorBase
static OUString aSlash("/");
static OUString aHelpFilesBaseName("help");
static OUString aHelpMediaType("application/vnd.sun.star.help"); static OUString aHelpMediaType("application/vnd.sun.star.help");
ExtensionIteratorBase::ExtensionIteratorBase( const OUString& aLanguage ) ExtensionIteratorBase::ExtensionIteratorBase( const OUString& aLanguage )
@ -1212,15 +1210,7 @@ OUString TreeFileIterator::implGetTreeFileFromPackage
OUString aLanguage = m_aLanguage; OUString aLanguage = m_aLanguage;
for( sal_Int32 iPass = 0 ; iPass < 2 ; ++iPass ) for( sal_Int32 iPass = 0 ; iPass < 2 ; ++iPass )
{ {
OUStringBuffer aStrBuf; aRetFile = expandURL( xPackage->getURL() + "/" + aLanguage + "/help.tree" );
aStrBuf.append( xPackage->getURL() );
aStrBuf.append( aSlash );
aStrBuf.append( aLanguage );
aStrBuf.append( aSlash );
aStrBuf.append( aHelpFilesBaseName );
aStrBuf.appendAscii( ".tree" );
aRetFile = expandURL( aStrBuf.makeStringAndClear() );
if( iPass == 0 ) if( iPass == 0 )
{ {
if( m_xSFA->exists( aRetFile ) ) if( m_xSFA->exists( aRetFile ) )