[Libreoffice-commits] core.git: sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Feb 17 17:57:45 UTC 2019
sfx2/source/doc/docfilt.cxx | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
New commits:
commit e81ee9289b818ffca76a52a3b37e0ea091f2d8f3
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sun Feb 10 15:51:37 2019 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sun Feb 17 18:57:24 2019 +0100
SfxFilter: truncate extensions list at first empty one...
... instead of rebuilding such list token by token until an
empty extension is found
Change-Id: Ib084b3064dccd1cf820bbb62ed47db03224b2161
Reviewed-on: https://gerrit.libreoffice.org/67631
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index 500b0ad224fc..ef1bef3235d6 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -67,17 +67,24 @@ SfxFilter::SfxFilter( const OUString &rName,
lFormat(lFmt),
mbEnabled(bEnabled)
{
- OUString aExts = GetWildcard().getGlob();
- OUStringBuffer glob;
- OUString aRet;
- sal_uInt16 nPos = 0;
- while (!(aRet = aExts.getToken(nPos++, ';')).isEmpty() )
+ const OUString aExts = GetWildcard().getGlob();
+ sal_Int32 nLen{ aExts.getLength() };
+ if (nLen>0)
{
- if (!glob.isEmpty())
- glob.append(";");
- glob.append(aRet);
+ // truncate to first empty extension
+ if (aExts[0]==';')
+ {
+ aWildCard.setGlob("");
+ return;
+ }
+ const sal_Int32 nIdx{ aExts.indexOf(";;") };
+ if (nIdx>0)
+ nLen = nIdx;
+ else if (aExts[nLen-1]==';')
+ --nLen;
+ if (nLen<aExts.getLength())
+ aWildCard.setGlob(aExts.copy(0, nLen));
}
- aWildCard.setGlob(glob.makeStringAndClear());
}
SfxFilter::~SfxFilter()
More information about the Libreoffice-commits
mailing list