D11745: databasesanitizer: Use flags for filtering

Stefan BrĂ¼ns noreply at phabricator.kde.org
Mon Apr 9 15:03:26 UTC 2018


bruns added inline comments.

INLINE COMMENTS

> databasesanitizer.cpp:100
>          QTextStream err(stderr);
>          for (quint64 id: keys) {
>              printProgress(err, i, max, 100);

As you are not iterating over sorted keys, just directly iterate on the map.

> databasesanitizer.cpp:104
>              const quint32* arr = reinterpret_cast<quint32*>(&id);
>              const auto url = docUrlDb.get(id);
>              FileInfo info;

Why are you fetching the url a second time here? url == map[key].second.

> databasesanitizer.cpp:225
> +        if (!(accessFilter & IgnoreAvailable)) {
>              out << QStringLiteral("%1").arg(info.accessible ? "+" : "!") << sep;
>          } else if (!info.accessible) {

You filter a second time here (first time in createList).

I would propose to use the same format independent of the Ignore(Un)Available.

> databasesanitizer.cpp:237
>      }
>      err << i18n("Found %1 matching items", infos.count()) << endl;
>  

This needs improvement - if you only print the inaccessible ones, the count is off.
Better explicitly mention number of Total, Accessible, Inaccessible.

> michaelh wrote in databasesanitizer.h:41
> That's a sneaky question! :-)

Hm still awkward:

  IgnoreNone = 0,
  IgnoreAvailable = 1,
  IgnoreUnavailable = 2,
  IgnoreMounted = IgnoreAvailable << 4,       <--  (1 << 4) == 16
  IgnoreUnmounted = IgnoreUnavailable << 4    <--  (2 << 4) == 32

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D11745

To: michaelh, #baloo, #frameworks
Cc: bruns, ngraham, smithjd, ashaposhnikov, michaelh, astippich, spoorun, alexeymin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180409/ed7bfc7f/attachment.html>


More information about the Kde-frameworks-devel mailing list