<table><tr><td style="">feverfew requested changes to this revision.<br />feverfew added a comment.<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/D27153">View Revision</a></tr></table><br /><div><div><p>Good  stuff, I'll admit I kind of skimmed over the bits that were rewrites <tt style="background: #ebebeb; font-size: 13px;">error(...); return;</tt> -> <tt style="background: #ebebeb; font-size: 13px;">Result::fail()</tt>, I assume you've mapped correctly there. Only minor comments from me.</p></div></div><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/D27153#inline-154615">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:145</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">KIO</span><span style="color: #aa2211">::</span><span class="n">fileoffset_t</span> <span class="n">offset</span> <span style="color: #aa2211">=</span> <span style="color: #aa2211">-</span><span style="color: #601200">1</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">while</span> <span class="p">((</span><span class="n">offset</span> <span style="color: #aa2211">=</span> <span class="n">QT_LSEEK</span><span class="p">(</span><span class="n">fd</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span> <span class="n">mode</span><span class="p">))</span> <span style="color: #aa2211">==</span> <span class="n">EAGAIN</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">return</span> <span class="n">offset</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Technically unrelated to your changes, but does this even work? isn't the check supposed to be against <tt style="background: #ebebeb; font-size: 13px;">errno</tt> in this case, not offset?</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/D27153#inline-154619">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:302</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(151, 234, 151, .6);"><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #aa2211">!</span><span class="n">result</span><span class="p">.</span><span class="n">success</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="n">error</span><span class="p">(</span><span class="n">result</span><span class="p">.</span><span class="n">error</span><span class="p">,</span> <span class="n">result</span><span class="p">.</span><span class="n">errorString</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">`if (result.success) { ...} else { ... } seems clearer to me</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/D27153#inline-154620">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:328</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">for</span> <span class="p">(</span><span style="color: #aa4000">int</span> <span class="n">i</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> <span class="n">i</span> <span style="color: #aa2211"><</span> <span class="n">n</span><span class="p">;</span> <span style="color: #aa2211">++</span><span class="n">i</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 style="color: #aa4000">for</span> <span class="p">(</span><span style="color: #aa4000">int</span> <span class="n">i<span class="bright">Int</span></span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> <span class="n">i<span class="bright">Int</span></span> <span style="color: #aa2211"><</span> <span class="n">n</span><span class="p">;</span> <span style="color: #aa2211">++</span><span class="n">i<span class="bright">Int</span></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 style="color: #aa4000">unsigned</span> <span style="color: #aa4000">int</span> <span class="n">i</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">static_cast</span><span style="color: #aa2211"><</span><span style="color: #aa4000">unsigned</span> <span style="color: #aa4000">int</span><span style="color: #aa2211">></span><span class="p">(</span><span class="n">iInt</span><span class="p">);</span> <span style="color: #74777d">// can only be >0</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">            <span style="color: #aa4000">char</span> <span class="n">echo</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I'm a bit confused, why is this necessary?</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/D27153#inline-154622">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:418</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">long</span> <span style="color: #aa4000">long</span> <span class="n">fileType</span> <span style="color: #aa2211">=</span> <span class="n">QT_STAT_REG</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">long</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">long</span></span> <span class="n">size</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0LL</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">uint64_t</span></span> <span class="n">size</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0LL</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Should then be changed from <tt style="background: #ebebeb; font-size: 13px;">0LL</tt> to <tt style="background: #ebebeb; font-size: 13px;">0U</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/D27153#inline-154625">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.cpp:1493</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">void</span> <span class="bright"></span><span class="n"><span class="bright">sftpProtoco</span>l</span><span style="color: #aa2211">::</span><span class="n">close</span><span class="p">()<span class="bright"></span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></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">closeWithoutFinish</span></span><span class="bright"></span><span class="p"><span class="bright">();</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">void</span> <span class="bright"></span><span class="n"><span class="bright">SFTPInterna</span>l</span><span style="color: #aa2211">::</span><span class="n">close</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 class="p"><span class="bright">{</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">We should be calling <tt style="background: #ebebeb; font-size: 13px;">finished()</tt> (or <tt style="background: #ebebeb; font-size: 13px;">Result::pass</tt>) on <tt style="background: #ebebeb; font-size: 13px;">close()</tt> IIRC? I'm not seeing it called.</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/D27153#inline-154608">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kio_sftp.h:77</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">void</span> <span style="color: #004012">setHost</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">h</span><span class="p">,</span> <span class="n">quint16</span> <span class="n">port</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">user</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">pass</span><span class="p">)<span class="bright"></span></span><span class="bright"> </span><span class="n"><span class="bright">override</span></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">void</span></span> <span style="color: #004012">get</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><span class="p">)<span class="bright"></span></span><span class="bright"> </span><span class="n"><span class="bright">override</span></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">void</span></span> <span style="color: #004012">listDir</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><span class="p">)<span class="bright"></span></span><span class="bright"> </span><span class="n"><span class="bright">override</span></span><span class="bright"> </span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">void</span> <span style="color: #004012">setHost</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">h</span><span class="p">,</span> <span class="n">quint16</span> <span class="n">port</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">user</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">pass</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 class="n"><span class="bright">Q_REQUIRED_RESULT</span></span><span class="bright"> </span><span class="n"><span class="bright">Result</span></span> <span style="color: #004012">get</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><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span class="n"><span class="bright">Q_REQUIRED_RESULT</span></span><span class="bright"> </span><span class="n"><span class="bright">Result</span></span> <span style="color: #004012">listDir</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><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">TODO KF6 <a href="https://en.cppreference.com/w/cpp/language/attributes/nodiscard" class="remarkup-link" target="_blank" rel="noreferrer">https://en.cppreference.com/w/cpp/language/attributes/nodiscard</a> ?</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R320 KIO Extras</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27153">https://phabricator.kde.org/D27153</a></div></div><br /><div><strong>To: </strong>sitter, dfaure, feverfew<br /><strong>Cc: </strong>kde-frameworks-devel, kfm-devel, pberestov, iasensio, fprice, LeGast00n, cblack, MrPepe, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov<br /></div>