diff --git a/samples/ReadConsoleInputStream/ReadConsoleInputStream.cs b/samples/ReadConsoleInputStream/ReadConsoleInputStream.cs index 0d2526766..921d3ecfc 100644 --- a/samples/ReadConsoleInputStream/ReadConsoleInputStream.cs +++ b/samples/ReadConsoleInputStream/ReadConsoleInputStream.cs @@ -37,7 +37,7 @@ namespace Samples.Terminal internal ReadConsoleInputStream(HFILE handle, BlockingCollection nonKeyEvents) { - Debug.Assert(handle.IsInvalid == false, "handle.IsInvalid == false"); + Debug.Assert(!handle.IsInvalid, "handle.IsInvalid == false"); _handle = handle.DangerousGetHandle(); _nonKeyEvents = nonKeyEvents; @@ -111,7 +111,7 @@ namespace Samples.Terminal if (record.EventType == Kernel32.EVENT_TYPE.KEY_EVENT) { // skip key up events - if not, every key will be duped in the stream - if (record.Event.KeyEvent.bKeyDown == false) continue; + if (!record.Event.KeyEvent.bKeyDown) continue; // pack ucs-2/utf-16le/unicode chars into position in our byte[] buffer. var glyph = (ushort) record.Event.KeyEvent.uChar; diff --git a/src/cascadia/TerminalApp/WslDistroGenerator.cpp b/src/cascadia/TerminalApp/WslDistroGenerator.cpp index 1dee85a2c..ab63dcf92 100644 --- a/src/cascadia/TerminalApp/WslDistroGenerator.cpp +++ b/src/cascadia/TerminalApp/WslDistroGenerator.cpp @@ -76,7 +76,7 @@ std::vector WslDistroGenerator::GenerateProfiles() THROW_HR(ERROR_UNHANDLED_EXCEPTION); } DWORD exitCode; - if (GetExitCodeProcess(pi.hProcess, &exitCode) == false) + if (!GetExitCodeProcess(pi.hProcess, &exitCode)) { THROW_HR(E_INVALIDARG); } @@ -116,7 +116,7 @@ std::vector WslDistroGenerator::GenerateProfiles() continue; } - size_t firstChar = distName.find_first_of(L"( "); + const size_t firstChar = distName.find_first_of(L"( "); // Some localizations don't have a space between the name and "(Default)" // https://github.com/microsoft/terminal/issues/1168#issuecomment-500187109 if (firstChar < distName.size()) diff --git a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp index 3994fdceb..2238cf770 100644 --- a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp @@ -403,7 +403,7 @@ int NonClientIslandWindow::_GetResizeHandleHeight() const noexcept // window frame. [[nodiscard]] LRESULT NonClientIslandWindow::_OnNcCalcSize(const WPARAM wParam, const LPARAM lParam) noexcept { - if (wParam == false) + if (!wParam) { return 0; } @@ -417,7 +417,7 @@ int NonClientIslandWindow::_GetResizeHandleHeight() const noexcept const auto originalSize = params->rgrc[0]; // apply the default frame - auto ret = DefWindowProc(_window.get(), WM_NCCALCSIZE, wParam, lParam); + const auto ret = DefWindowProc(_window.get(), WM_NCCALCSIZE, wParam, lParam); if (ret != 0) { return ret; @@ -783,9 +783,9 @@ void NonClientIslandWindow::_UpdateFrameMargins() const noexcept [[nodiscard]] LRESULT NonClientIslandWindow::_OnNcCreate(WPARAM wParam, LPARAM lParam) noexcept { const auto ret = IslandWindow::_OnNcCreate(wParam, lParam); - if (ret == FALSE) + if (!ret) { - return ret; + return FALSE; } // This is a hack to make the window borders dark instead of light. diff --git a/src/host/CursorBlinker.cpp b/src/host/CursorBlinker.cpp index efe50c59e..9941b054c 100644 --- a/src/host/CursorBlinker.cpp +++ b/src/host/CursorBlinker.cpp @@ -218,7 +218,7 @@ void CursorBlinker::KillCaretTimer() // A failure to delete the timer with the LastError being ERROR_IO_PENDING means that the timer is // currently in use and will get cleaned up when released. Delete should not be called again. // We treat that case as a success. - if (bRet == false && GetLastError() != ERROR_IO_PENDING) + if (!bRet && GetLastError() != ERROR_IO_PENDING) { LOG_LAST_ERROR(); } diff --git a/src/interactivity/onecore/ConIoSrvComm.cpp b/src/interactivity/onecore/ConIoSrvComm.cpp index abd9c47eb..067fe0f51 100644 --- a/src/interactivity/onecore/ConIoSrvComm.cpp +++ b/src/interactivity/onecore/ConIoSrvComm.cpp @@ -100,7 +100,7 @@ ConIoSrvComm::~ConIoSrvComm() // Initialize the server port name. Ret = RtlCreateUnicodeString(&PortName, CIS_ALPC_PORT_NAME); - if (Ret == FALSE) + if (!Ret) { return STATUS_NO_MEMORY; } diff --git a/src/tools/U8U16Test/U8U16Test.cpp b/src/tools/U8U16Test/U8U16Test.cpp index ae12937ee..95e8b26da 100644 --- a/src/tools/U8U16Test/U8U16Test.cpp +++ b/src/tools/U8U16Test/U8U16Test.cpp @@ -303,7 +303,7 @@ void u16state::reset() noexcept } // *** convert the code point to UTF-16 *** - if (codePoint != unicodeReplacementChar || discardInvalids == false) + if (codePoint != unicodeReplacementChar || !discardInvalids) { if (codePoint < 0x00010000u) { @@ -471,7 +471,7 @@ void u16state::reset() noexcept } // *** convert the code point to UTF-16 *** - if (codePoint != unicodeReplacementChar || discardInvalids == false) + if (codePoint != unicodeReplacementChar || !discardInvalids) { if (codePoint < 0x00010000u) { @@ -562,7 +562,7 @@ void u16state::reset() noexcept } // *** convert the code point to UTF-8 *** - if (codePoint != unicodeReplacementChar || discardInvalids == false) + if (codePoint != unicodeReplacementChar || !discardInvalids) { // the outcome of performance tests is that subsequent calls of push_back // perform much better than appending a single initializer_list @@ -664,7 +664,7 @@ void u16state::reset() noexcept } // *** convert the code point to UTF-8 *** - if (codePoint != unicodeReplacementChar || discardInvalids == false) + if (codePoint != unicodeReplacementChar || !discardInvalids) { // the outcome of further performance tests is that using pointers // perform even better than subsequent calls of push_back diff --git a/src/tools/U8U16Test/main.cpp b/src/tools/U8U16Test/main.cpp index 60c8f21b6..fd4cb8fd0 100644 --- a/src/tools/U8U16Test/main.cpp +++ b/src/tools/U8U16Test/main.cpp @@ -538,7 +538,7 @@ ptrdiff_t RandomIndex(ptrdiff_t length) { static bool generatorInitialized{ false }; static std::default_random_engine generator; - if (generatorInitialized == false) + if (!generatorInitialized) { generator.seed(static_cast(std::chrono::system_clock::now().time_since_epoch().count())); generatorInitialized = true; diff --git a/src/tools/pixels/main.cpp b/src/tools/pixels/main.cpp index 8a1061430..3f9290695 100644 --- a/src/tools/pixels/main.cpp +++ b/src/tools/pixels/main.cpp @@ -222,9 +222,7 @@ int __cdecl wmain(int /*argc*/, WCHAR* /*argv*/[]) CONSOLE_SCREEN_BUFFER_INFOEX csbiex = { 0 }; csbiex.cbSize = sizeof(csbiex); - BOOL b = GetConsoleScreenBufferInfoEx(hOut, &csbiex); - - if (b == FALSE) + if (!GetConsoleScreenBufferInfoEx(hOut, &csbiex)) { wcout << GetLastError() << endl; }