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

Reply via email to