D25684: [core/*] replace foreach, deprecated, with range-for
Albert Astals Cid
noreply at phabricator.kde.org
Tue Dec 3 23:22:46 GMT 2019
aacid added a comment.
Thanks for the patch!
Some small comments
INLINE COMMENTS
> annotations.cpp:2094
> double outsideDistance = DBL_MAX;
> - foreach ( const HighlightAnnotation::Quad& quad, m_highlightQuads )
> + for ( const HighlightAnnotation::Quad &quad : qAsConst(m_highlightQuads) )
> {
i'm going to commit a patch that makes distanceSqr be const so you won't need this anymore.
> annotations.cpp:2309
> double distance = DBL_MAX;
> - foreach ( const QLinkedList<NormalizedPoint>& path, m_transformedInkPaths )
> + for ( const QLinkedList<NormalizedPoint> &path : qAsConst(m_transformedInkPaths) )
> {
same
> document.cpp:3920
> *pagesToNotify += s->highlightedPages;
> - foreach(int pageNumber, s->highlightedPages)
> + for (const int &pageNumber : qAsConst(s->highlightedPages)) {
> d->m_pagesVector.at(pageNumber)->d->deleteHighlights( searchID );
don't do const & for basic types, it's cheaper to copy them than to reference them
> document.cpp:4034
> // unhighlight pages and inform observers about that
> - foreach(int pageNumber, s->highlightedPages)
> + for (const int &pageNumber : qAsConst(s->highlightedPages))
> {
same
> form.cpp:258
> QStringList list;
> - foreach ( int c, choices )
> + for ( const int &c : qAsConst(choices) )
> {
same
> page.cpp:504
> {
> - foreach(Annotation *a, m_annotations)
> + for (Annotation *a : qAsConst(m_annotations))
> {
we don't need qAsConst here, do we?
> textpage.cpp:301
> QString res;
> - foreach(const WordWithCharacters &word, m_region_wordWithCharacters)
> + for (const WordWithCharacters &word : qAsConst(m_region_wordWithCharacters)) {
> res += word.text();
if the function is const, m_region_blabla is const already
REPOSITORY
R223 Okular
REVISION DETAIL
https://phabricator.kde.org/D25684
To: ahmadsamir, aacid
Cc: okular-devel, johnzh, andisa, siddharthmanthan, maguirre, fbampaloukas, joaonetto, kezik, tfella, ngraham, darcyshen, aacid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20191203/913c32a7/attachment-0001.html>
More information about the Okular-devel
mailing list