Mimetype optimization

David Faure faure at kde.org
Thu Apr 24 17:09:53 CEST 2008


On Tuesday 22 April 2008, Olivier Goffart wrote:
> Le mardi 22 avril 2008, Jakub Stachowski a écrit :
> > Index: kmimetypefactory.cpp
> > ===================================================================
> > --- kmimetypefactory.cpp        (wersja 799070)
> > +++ kmimetypefactory.cpp        (kopia robocza)
> > @@ -190,8 +190,10 @@
> >      int len = filename.length();
> >
> >      // Patterns like "*~", "*.extension"
> > -    if (pattern[0] == '*' && len + 1 >= pattern_len &&
> > pattern.indexOf('[') == -1) +    if (pattern[0] == '*'  &&
> > pattern.indexOf('[') == -1)
> >      {
> > +        if ( len + 1 < pattern_len ) return false;
> > +
> 
> What about patern like *foo*bar*
> this will not match "foobar" anymore.
> I think you should search for '*' in the pattern

Well, I would just like to point out that there is no such pattern in any mimetype that I can ever think of...
Let's optimize for what is useful, we can always extend the code if we need some strange mimetype glob to work.
Right now in both the fdo and the kde mimetypes, the * is always there only once, and always at the beginning or end.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


More information about the Kde-optimize mailing list