From 30359f725e722114c2f7feb9b7fdb8e3e9e5919c Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sun, 16 Feb 2020 21:16:41 +0100 Subject: [PATCH] OutputWindow: Reduce scope of local variable Found by cppcheck. Change-Id: I597021ddb3317cf6320bf25eb2d52141fa1e4f80 Reviewed-by: Orgad Shaneh --- src/plugins/coreplugin/outputwindow.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 4d70830ccec..3c7941ba6fc 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -439,14 +439,13 @@ void OutputWindow::appendMessage(const QString &output, OutputFormat format) if (sameLine) { d->scrollToBottom = true; - int newline = -1; bool enforceNewline = d->enforceNewline; d->enforceNewline = false; if (enforceNewline) { out.prepend('\n'); } else { - newline = out.indexOf(QLatin1Char('\n')); + const int newline = out.indexOf(QLatin1Char('\n')); moveCursor(QTextCursor::End); if (newline != -1) { if (d->formatter)