From e9aa3c99d2ae577d9e2fbddc95f10d6230cf1e68 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 4 Jan 2016 17:49:08 +0100 Subject: Simplify code Change-Id: I28cff254d2cc1e2abe6fc893d918bd84bfc8645c --- xmlhelp/source/cxxhelp/provider/databases.cxx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index c09f2d7e8cf4..14e5c1c1b2e4 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -316,8 +316,6 @@ const std::vector< OUString >& Databases::getModuleList( const OUString& Languag osl::DirectoryItem aDirItem; osl::FileStatus aStatus( osl_FileStatus_Mask_FileName ); - sal_Int32 idx; - if( osl::FileBase::E_None != dirFile.open() ) return m_avModules; @@ -330,22 +328,17 @@ const std::vector< OUString >& Databases::getModuleList( const OUString& Languag fileName = aStatus.getFileName(); // Check, whether fileName is of the form *.cfg - idx = fileName.lastIndexOf( '.' ); - - if( idx == -1 ) + if (!fileName.endsWithIgnoreAsciiCase(".cfg", &fileName)) { continue; - - const sal_Unicode* str = fileName.getStr(); - - if( fileName.getLength() == idx + 4 && - ( str[idx + 1] == 'c' || str[idx + 1] == 'C' ) && - ( str[idx + 2] == 'f' || str[idx + 2] == 'F' ) && - ( str[idx + 3] == 'g' || str[idx + 3] == 'G' ) && - ( fileName = fileName.copy(0,idx).toAsciiLowerCase() ) != "picture" ) { - if(! m_bShowBasic && fileName == "sbasic" ) + } + fileName = fileName.toAsciiLowerCase(); + if (fileName == "picture" + || (!m_bShowBasic && fileName == "sbasic")) + { continue; - m_avModules.push_back( fileName ); } + + m_avModules.push_back( fileName ); } } return m_avModules; -- cgit