diff --git a/src/host/VtIo.cpp b/src/host/VtIo.cpp index d64d142d210..1b8a8591d20 100644 --- a/src/host/VtIo.cpp +++ b/src/host/VtIo.cpp @@ -567,10 +567,11 @@ void VtIo::Writer::WriteUTF16(std::wstring_view str) const // C++23's resize_and_overwrite is too valuable to not use. // It reduce the CPU overhead by roughly half. -#if !defined(_HAS_CXX23) || !_HAS_CXX23 +#if !defined(__cpp_lib_string_resize_and_overwrite) && _MSVC_STL_UPDATE >= 202111L #define resize_and_overwrite _Resize_and_overwrite +#elif !defined(__cpp_lib_string_resize_and_overwrite) +#error "rely on resize_and_overwrite" #endif - // NOTE: Throwing inside resize_and_overwrite invokes undefined behavior. _io->_back.resize_and_overwrite(totalUTF8Cap, [&](char* buf, const size_t) noexcept { const auto len = WideCharToMultiByte(CP_UTF8, 0, str.data(), gsl::narrow_cast(incomingUTF16Len), buf + existingUTF8Len, gsl::narrow_cast(incomingUTF8Cap), nullptr, nullptr); diff --git a/src/inc/LibraryIncludes.h b/src/inc/LibraryIncludes.h index a80e351ffeb..6a2c1a1393b 100644 --- a/src/inc/LibraryIncludes.h +++ b/src/inc/LibraryIncludes.h @@ -65,7 +65,6 @@ // GSL // Block GSL Multi Span include because it both has C++17 deprecated iterators // and uses the C-namespaced "max" which conflicts with Windows definitions. -#include #include #include diff --git a/src/renderer/atlas/pch.h b/src/renderer/atlas/pch.h index 240af13275b..7e9109010b9 100644 --- a/src/renderer/atlas/pch.h +++ b/src/renderer/atlas/pch.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/src/renderer/gdi/gdirenderer.hpp b/src/renderer/gdi/gdirenderer.hpp index d88f10de784..d8bac221314 100644 --- a/src/renderer/gdi/gdirenderer.hpp +++ b/src/renderer/gdi/gdirenderer.hpp @@ -165,7 +165,7 @@ namespace Microsoft::Console::Render // It's important the pool is first so it can be given to the others on construction. std::pmr::unsynchronized_pool_resource _pool; std::pmr::vector _polyStrings; - std::pmr::vector> _polyWidths; + std::pmr::vector> _polyWidths; std::vector _imageMask; diff --git a/src/renderer/gdi/paint.cpp b/src/renderer/gdi/paint.cpp index 58eca36f843..86db0de9400 100644 --- a/src/renderer/gdi/paint.cpp +++ b/src/renderer/gdi/paint.cpp @@ -362,7 +362,7 @@ bool GdiEngine::FontHasWesternScript(HDC hdc) polyString.back() &= softFontCharMask; polyWidth.push_back(gsl::narrow(cluster.GetColumns()) * coordFontSize.width); cchCharWidths += polyWidth.back(); - polyWidth.append(text.size() - 1, 0); + polyWidth.resize(polyWidth.size() + text.size() - 1); } // Detect and convert for raster font... diff --git a/src/server/WaitBlock.h b/src/server/WaitBlock.h index d1964394769..560eaee91f9 100644 --- a/src/server/WaitBlock.h +++ b/src/server/WaitBlock.h @@ -42,10 +42,10 @@ class ConsoleWaitBlock _In_ IWaitRoutine* const pWaiter); ConsoleWaitQueue* const _pProcessQueue; - std::_List_const_iterator>> _itProcessQueue; + typename std::list::const_iterator _itProcessQueue; ConsoleWaitQueue* const _pObjectQueue; - std::_List_const_iterator>> _itObjectQueue; + typename std::list::const_iterator _itObjectQueue; CONSOLE_API_MSG _WaitReplyMessage; diff --git a/src/terminal/adapter/SixelParser.hpp b/src/terminal/adapter/SixelParser.hpp index 1966228d77f..ea97783fec2 100644 --- a/src/terminal/adapter/SixelParser.hpp +++ b/src/terminal/adapter/SixelParser.hpp @@ -104,7 +104,7 @@ namespace Microsoft::Console::VirtualTerminal size_t _colorsUsed = 0; size_t _colorsAvailable = 0; bool _colorTableChanged = false; - IndexedPixel _foregroundPixel = 0; + IndexedPixel _foregroundPixel = {}; void _initImageBuffer(); void _resizeImageBuffer(const til::CoordType requiredHeight); diff --git a/src/types/colorTable.cpp b/src/types/colorTable.cpp index 0a67fe510c7..c86a9df8959 100644 --- a/src/types/colorTable.cpp +++ b/src/types/colorTable.cpp @@ -247,6 +247,9 @@ void Utils::InitializeVT340ColorTable(const std::span table) noexcept } } +#pragma warning(push) +#pragma warning(disable : 26497) // This is a false positive in audit mode. + // Function Description: // - Fill color table entries from 16 to 255 with the default colors used by // modern terminals. This includes a range of colors from a 6x6x6 color cube @@ -255,7 +258,7 @@ void Utils::InitializeVT340ColorTable(const std::span table) noexcept // - table: a color table to be filled // Return Value: // - -constexpr void Utils::InitializeExtendedColorTable(const std::span table, const bool monochrome) noexcept +void Utils::InitializeExtendedColorTable(const std::span table, const bool monochrome) noexcept { if (table.size() >= 256) { @@ -279,6 +282,8 @@ constexpr void Utils::InitializeExtendedColorTable(const std::span tab } } +#pragma warning(pop) + #pragma warning(push) #pragma warning(disable : 26447) // This is a false positive. diff --git a/src/types/inc/colorTable.hpp b/src/types/inc/colorTable.hpp index 8e2187dc98b..7d659c9e003 100644 --- a/src/types/inc/colorTable.hpp +++ b/src/types/inc/colorTable.hpp @@ -15,7 +15,7 @@ namespace Microsoft::Console::Utils void InitializeColorTable(const std::span table) noexcept; void InitializeANSIColorTable(const std::span table) noexcept; void InitializeVT340ColorTable(const std::span table) noexcept; - constexpr void InitializeExtendedColorTable(const std::span table, const bool monochrome = false) noexcept; + void InitializeExtendedColorTable(const std::span table, const bool monochrome = false) noexcept; std::span CampbellColorTable() noexcept; std::optional ColorFromXOrgAppColorName(const std::wstring_view wstr) noexcept;