<table><tr><td style="">dfaure requested changes to this revision.<br />dfaure added inline comments.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D23902">View Revision</a></tr></table><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-136003">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:833</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">qCDebug</span><span class="p">(</span><span class="n">KIO_CORE_DIRLISTER</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span class="n">urlDir</span><span class="p">;</span> <span style="color: #74777d">// output urls, not qstrings, since they might contain a password</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span class="n"><span class="bright">Q_FOREACH</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span class="n">u<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">urlDir</span><span class="p">))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"></span><span style="color: #aa4000"><span class="bright">for</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span style="color: #a0a000">u<span class="bright"></span></span><span class="bright"> </span><span class="p"><span class="bright">:</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">urlDir</span><span class="p">))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">updateDirectory</span><span class="p">(</span><span class="n">u</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Well, then you need a local const variable here.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-136004">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:1079</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">isDir</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span class="n"><span class="bright">Q_FOREACH</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span class="n">dir<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">url</span><span class="p">))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"></span><span style="color: #aa4000"><span class="bright">for</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span style="color: #a0a000">dir<span class="bright"></span></span><span class="bright"> </span><span class="p"><span class="bright">:</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">url</span><span class="p">))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">handleFileDirty</span><span class="p">(</span><span class="n">dir</span><span class="p">);</span> <span style="color: #74777d">// e.g. for permission changes</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">and here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-136005">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:1084</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span class="n"><span class="bright">Q_FOREACH</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span class="n">dir<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">url</span><span class="p">.</span><span class="n">adjusted</span><span class="p">(</span><span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">RemoveFilename</span> <span style="color: #aa2211">|</span> <span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">StripTrailingSlash</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"></span><span style="color: #aa4000"><span class="bright">for</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span style="color: #a0a000">dir<span class="bright"></span></span><span class="bright"> </span><span class="p"><span class="bright">:</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">url</span><span class="p">.</span><span class="n">adjusted</span><span class="p">(</span><span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">RemoveFilename</span> <span style="color: #aa2211">|</span> <span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">StripTrailingSlash</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">QUrl</span> <span class="n">aliasUrl</span><span class="p">(</span><span class="n">dir</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">and here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-136006">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:1158</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">QStringList</span> <span class="n">fileUrls</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span class="n"><span class="bright">Q_FOREACH</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span class="n">url<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">dirUrl</span><span class="p">.</span><span class="n">adjusted</span><span class="p">(</span><span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">RemoveFilename</span> <span style="color: #aa2211">|</span> <span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">StripTrailingSlash</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"></span><span style="color: #aa4000"><span class="bright">for</span></span> <span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QUrl</span> <span style="color: #aa2211">&</span><span style="color: #a0a000">url<span class="bright"></span></span><span class="bright"> </span><span class="p"><span class="bright">:</span></span> <span class="n">directoriesForCanonicalPath</span><span class="p">(</span><span class="n">dirUrl</span><span class="p">.</span><span class="n">adjusted</span><span class="p">(</span><span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">RemoveFilename</span> <span style="color: #aa2211">|</span> <span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">StripTrailingSlash</span><span class="p">)))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">QUrl</span> <span class="n">urlInfo</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">and here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-136009">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:2248</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #aa4000">auto</span> <span class="n">kit</span> <span style="color: #aa2211">=</span> <span class="n">itemList</span><span style="color: #aa2211">-></span><span class="n">begin</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span style="color: #aa4000"><span class="bright">const</span></span><span class="bright"> </span><span style="color: #aa4000">auto</span> <span class="n">kend</span> <span style="color: #aa2211">=</span> <span class="n">itemList</span><span style="color: #aa2211">-></span><span class="n">end</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">auto</span> <span class="n">kit</span> <span style="color: #aa2211">=</span> <span class="n">itemList</span><span style="color: #aa2211">-><span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">c</span>begin</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">auto</span> <span class="n">kend</span> <span style="color: #aa2211">=</span> <span class="n">itemList</span><span style="color: #aa2211">-><span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">c</span>end</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">for</span> <span class="p">(;</span> <span class="n">kit</span> <span style="color: #aa2211">!=</span> <span class="n">kend</span><span class="p">;</span> <span style="color: #aa2211">++</span><span class="n">kit</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Why did you remove the const in front of "auto kend"?</p>
<p style="padding: 0; margin: 8px;">[alternatively, the next line could be ported to a range for, I guess]</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-135452">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ahmadsamir</span> wrote in <span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:2222</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">I thought that way it doesn't get cast (with qAsConst) twice, as lstDirs is used in another for loop a couple of lines down. But I was wrong, qAsConst doesn't copy its arguments, so qAsConst is better suited.</p>
<p style="padding: 0; margin: 8px;">However this loop doesn't look like it modifies lstDirs.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Did you forget to change it to <tt style="background: #ebebeb; font-size: 13px;">qAsConst(listDirs)</tt> ?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D23902#inline-135454">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ahmadsamir</span> wrote in <span style="color: #4b4d51; font-weight: bold;">kcoredirlister.cpp:2237</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">But this one might change lstDirs, as itemsDeleted is emitted, which calls deleteDir() and forgetDirs(); I am not sure though. I'll use a const var for this loop.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">well spotted.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D23902">https://phabricator.kde.org/D23902</a></div></div><br /><div><strong>To: </strong>ahmadsamir, kde-frameworks-devel, dfaure<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>