<table><tr><td style="">mpyne created this revision.<br />mpyne added reviewers: dfaure, Frameworks, apol.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />mpyne requested review of this revision.
</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/D20008">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>As reported in <a href="https://bugs.kde.org/show_bug.cgi?id=404474" class="remarkup-link" target="_blank" rel="noreferrer">bug 404474</a>, GCC gives a warning about using an uninitialized value in KIO.</p>

<p>The relevant portion of code is:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">FileOperationType opType;
switch (command) {
case CMD_DEL:
    opType = Delete;
    break;
case CMD_RENAME:
    opType = Rename;
    break;
case CMD_SYMLINK:
    opType = Symlink;
    break;
}
job->d_func()->m_operationType = opType;</pre></div>

<p><tt style="background: #ebebeb; font-size: 13px;">command</tt> in this case is an <tt style="background: #ebebeb; font-size: 13px;">int</tt> and there's no other checks here to let the compiler know that <tt style="background: #ebebeb; font-size: 13px;">command</tt> could only be one of those three values. There's a comment here but even I don't know whether the comment discusses what *should* be true or what *is* actually checked elsewhere.</p>

<p>Since even I was confused I don't blame the compiler. So I add a default branch that just returns the job unmodified. There may be a better error condition here.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Builds, installs, KIO-using software works fine still.</p></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/D20008">https://phabricator.kde.org/D20008</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/core/job_p.h</div></div></div><br /><div><strong>To: </strong>mpyne, dfaure, Frameworks, apol<br /><strong>Cc: </strong>kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>