diff --git a/src/buffer/out/OutputCellIterator.cpp b/src/buffer/out/OutputCellIterator.cpp index 12ac7ad508..9b5437041b 100644 --- a/src/buffer/out/OutputCellIterator.cpp +++ b/src/buffer/out/OutputCellIterator.cpp @@ -112,26 +112,16 @@ OutputCellIterator::OutputCellIterator(const std::wstring_view utf16Text, const // - This is an iterator over legacy colors only. The text is not modified. // Arguments: // - legacyAttrs - One legacy color item per cell -// - unused - useless bool to change function signature for legacyAttrs constructor because the C++ compiler in -// razzle cannot distinguish between a std::wstring_view and a std::basic_string_view -// NOTE: This one internally casts to wchar_t because Razzle sees WORD and wchar_t as the same type -// despite that Visual Studio build can tell the difference. -#pragma warning(push) -#pragma warning(suppress : 26490) -// Suppresses reinterpret_cast. We're only doing this because Windows doesn't understand the type difference between wchar_t and DWORD. -// It is not worth trying to separate that out further or risking performance over this particular warning here. -// TODO GH 2673 - Investigate real wchar_t flag in Windows and resolve this audit issue -OutputCellIterator::OutputCellIterator(const std::basic_string_view legacyAttrs, const bool /*unused*/) noexcept : +OutputCellIterator::OutputCellIterator(const std::basic_string_view legacyAttrs) noexcept : _mode(Mode::LegacyAttr), _currentView(s_GenerateViewLegacyAttr(legacyAttrs.at(0))), - _run(std::wstring_view(reinterpret_cast(legacyAttrs.data()), legacyAttrs.size())), + _run(legacyAttrs), _attr(InvalidTextAttribute), _distance(0), _pos(0), _fillLimit(0) { } -#pragma warning(pop) // Routine Description: // - This is an iterator over legacy cell data. We will use the unicode text and the legacy color attribute. @@ -198,7 +188,7 @@ OutputCellIterator::operator bool() const noexcept } case Mode::LegacyAttr: { - return _pos < std::get(_run).length(); + return _pos < std::get>(_run).length(); } default: FAIL_FAST_HR(E_NOTIMPL); @@ -295,7 +285,7 @@ OutputCellIterator& OutputCellIterator::operator++() _pos++; if (operator bool()) { - _currentView = s_GenerateViewLegacyAttr(std::get(_run).at(_pos)); + _currentView = s_GenerateViewLegacyAttr(std::get>(_run).at(_pos)); } break; } diff --git a/src/buffer/out/OutputCellIterator.hpp b/src/buffer/out/OutputCellIterator.hpp index 02f6aefa54..0d4b866e7c 100644 --- a/src/buffer/out/OutputCellIterator.hpp +++ b/src/buffer/out/OutputCellIterator.hpp @@ -39,7 +39,7 @@ public: OutputCellIterator(const CHAR_INFO& charInfo, const size_t fillLimit = 0) noexcept; OutputCellIterator(const std::wstring_view utf16Text); OutputCellIterator(const std::wstring_view utf16Text, const TextAttribute attribute); - OutputCellIterator(const std::basic_string_view legacyAttributes, const bool unused) noexcept; + OutputCellIterator(const std::basic_string_view legacyAttributes) noexcept; OutputCellIterator(const std::basic_string_view charInfos) noexcept; OutputCellIterator(const std::basic_string_view cells); ~OutputCellIterator() = default; @@ -90,6 +90,7 @@ private: std::variant< std::wstring_view, + std::basic_string_view, std::basic_string_view, std::basic_string_view, std::monostate> diff --git a/src/host/_output.cpp b/src/host/_output.cpp index 67ad7fedf3..65413033a4 100644 --- a/src/host/_output.cpp +++ b/src/host/_output.cpp @@ -91,7 +91,7 @@ void WriteToScreen(SCREEN_INFORMATION& screenInfo, const Viewport& region) return E_INVALIDARG; } - const OutputCellIterator it(attrs, true); + const OutputCellIterator it(attrs); const auto done = screenInfo.Write(it, target); used = done.GetCellDistance(it); diff --git a/src/host/ut_host/OutputCellIteratorTests.cpp b/src/host/ut_host/OutputCellIteratorTests.cpp index 6f35855852..4d22fabb17 100644 --- a/src/host/ut_host/OutputCellIteratorTests.cpp +++ b/src/host/ut_host/OutputCellIteratorTests.cpp @@ -369,7 +369,7 @@ class OutputCellIteratorTests const std::vector colors{ FOREGROUND_GREEN, FOREGROUND_RED | BACKGROUND_BLUE, FOREGROUND_BLUE | FOREGROUND_INTENSITY, BACKGROUND_GREEN }; const std::basic_string_view view{ colors.data(), colors.size() }; - OutputCellIterator it(view, false); + OutputCellIterator it(view); for (const auto& color : colors) { diff --git a/src/project.inc b/src/project.inc index fa480e3221..c083d8b82c 100644 --- a/src/project.inc +++ b/src/project.inc @@ -8,7 +8,7 @@ # ------------------------------------- UNICODE = 1 -C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE +C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE -DFMT_HEADER_ONLY # ------------------------------------- # CRT Configuration @@ -16,6 +16,7 @@ C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE USE_UNICRT = 1 USE_MSVCRT = 1 +NO_WCHAR_T = 1 # use native wchar_t USE_STL = 1 STL_VER = STL_VER_CURRENT diff --git a/src/project.unittest.inc b/src/project.unittest.inc index 13b0caa9f4..8d625b78e8 100644 --- a/src/project.unittest.inc +++ b/src/project.unittest.inc @@ -9,7 +9,7 @@ # Preprocessor Settings # ------------------------------------- -C_DEFINES = $(C_DEFINES) -DINLINE_TEST_METHOD_MARKUP -DUNIT_TESTING +C_DEFINES = $(C_DEFINES) -DINLINE_TEST_METHOD_MARKUP -DUNIT_TESTING -DFMT_HEADER_ONLY # ------------------------------------- # Program Information