Mimetype optimization
Jakub Stachowski
qbast at go2.pl
Wed Apr 23 19:48:18 CEST 2008
Dnia wtorek, 22 kwietnia 2008, Olivier Goffart napisał:
> 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
Right.
>
> (oh, and is there some escaping in regexp? such as "*foo\?\?" )
Right. Current parser is somehow limited - it does not detect ? or '\'. There
are no pattern with these chars yet, but they may be added.
Attached is a patch to fix these problems.
I added some static QChar() vars (conversion char* -> QChar took ~10% of
matchFileName). Is it a problem?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mimematchfix.patch
Type: text/x-diff
Size: 1987 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-optimize/attachments/20080423/aaf3c648/attachment.bin
More information about the Kde-optimize
mailing list