D12932: handle string lists as input
Stefan BrĂ¼ns
noreply at phabricator.kde.org
Wed May 16 19:02:33 UTC 2018
bruns added inline comments.
INLINE COMMENTS
> result.cpp:90
> + const QStringList val = value.toStringList();
> + if (val.isEmpty())
> + return;
this check is not strictly necessary - if the list is empty, you iterate zero times in the loop. But see below [1]
> result.cpp:92
> + return;
> + KFileMetaData::PropertyInfo pi(property);
> + for (int i = 0; i < val.size(); ++i)
`bool shouldBeIndexed = KFMD:PropertyInfo(property).shouldBeIndexed(); `
avoids the check on each iteration
> result.cpp:93
> + KFileMetaData::PropertyInfo pi(property);
> + for (int i = 0; i < val.size(); ++i)
> + {
range-based-for loop, please:
`for (const auto& val : values) { ... }`
> result.cpp:94
> + for (int i = 0; i < val.size(); ++i)
> + {
> + m_termGen.indexText(val.at(i), prefix);
[1] ... here you miss the check on val.at(i).empty() - the list can contain empty strings.
REPOSITORY
R293 Baloo
REVISION DETAIL
https://phabricator.kde.org/D12932
To: astippich, bruns
Cc: kde-frameworks-devel, #baloo, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180516/879af6e5/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list