From b07e38b2028a5ebc7dd078f7282c0bd3274c897e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 22 Jan 2018 15:54:01 +0100 Subject: Remove dead code from SfxFilter ctor In fd069bee7e57ad529c3c0974559fd2d84ec3151a "initial import" the code was: +void SfxFilter::InitMembers_Impl() +{ + String aExts = GetWildcard()(); + String aShort, aLong; + String aRet; + sal_uInt16 nMaxLength = +#if defined( WIN ) || defined( OS2 ) + 3 +#else + USHRT_MAX +#endif + ; + String aTest; + sal_uInt16 nPos = 0; + while( ( aRet = aExts.GetToken( nPos++, ';' ) ).Len() ) + { + aTest = aRet; + aTest.SearchAndReplace( DEFINE_CONST_UNICODE( "*." ), String() ); + if( aTest.Len() <= nMaxLength ) + { + if( aShort.Len() ) aShort += ';'; + aShort += aRet; + } + else + { + if( aLong.Len() ) aLong += ';'; + aLong += aRet; + } + } + if( aShort.Len() && aLong.Len() ) + { + aShort += ';'; + aShort += aLong; + } + aWildCard = aShort; + + nVersion = SOFFICE_FILEFORMAT_NOW; + bPlugDataSearched = 0; + pPlugData = 0; + + aName = pContainer->GetName(); + aName += DEFINE_CONST_UNICODE( ": " ); + aName += aFilterName; + + aUIName = aFilterName; +} where USHRT_MAX apparently effectively meant "arbitrarily large". But when b7c596059dfa9a808f587af9f30b01489e75fb0e "INTEGRATION: CWS sfxcleanup" removed the WIN/OS2 special case it didn't remove all the other code that was now effectively useless. Change-Id: I883759f13e0267a189ad176c2ffcc1c78680b0a5 Reviewed-on: https://gerrit.libreoffice.org/48336 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sfx2/source/doc/docfilt.cxx | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 7dddb700e60d..b3d931124f4c 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -67,33 +67,16 @@ SfxFilter::SfxFilter( const OUString &rName, lFormat(lFmt) { OUString aExts = GetWildcard().getGlob(); - OUString aShort, aLong; + OUString glob; OUString aRet; - OUString aTest; sal_uInt16 nPos = 0; while (!(aRet = aExts.getToken(nPos++, ';')).isEmpty() ) { - aTest = aRet; - aTest = aTest.replaceFirst( "*." , "" ); - if( aTest.getLength() <= USHRT_MAX ) - { - if (!aShort.isEmpty()) - aShort += ";"; - aShort += aRet; - } - else - { - if (!aLong.isEmpty()) - aLong += ";"; - aLong += aRet; - } - } - if (!aShort.isEmpty() && !aLong.isEmpty()) - { - aShort += ";"; - aShort += aLong; + if (!glob.isEmpty()) + glob += ";"; + glob += aRet; } - aWildCard.setGlob(aShort); + aWildCard.setGlob(glob); } SfxFilter::~SfxFilter() -- cgit