Re: Mimetype optimization
David Faure <[email protected]> Thu, 24 Apr 2008 17:09:53 +0200
| Newsgroups | gmane.comp.kde.devel.optimize |
|---|---|
| Organization | KDE |
| Message-ID | <[email protected]> |
On Tuesday 22 April 2008, Olivier Goffart wrote:
> Le mardi 22 avril 2008, Jakub Stachowski a =E9crit=A0:
> > Index: kmimetypefactory.cpp
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > --- kmimetypefactory.cpp (wersja 799070)
> > +++ kmimetypefactory.cpp (kopia robocza)
> > @@ -190,8 +190,10 @@
> > int len =3D filename.length();
> >
> > // Patterns like "*~", "*.extension"
> > - if (pattern[0] =3D=3D '*' && len + 1 >=3D pattern_len &&
> > pattern.indexOf('[') =3D=3D -1) + if (pattern[0] =3D=3D '*' &&
> > pattern.indexOf('[') =3D=3D -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 m=
imetype 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, [email protected], sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).