Move to GSL 3.1.0 (#6908)

GSL 3, the next major version of GSL after the one we're using, replaced
their local implementation of `span` with one that more closely mimics
C++20's span. Unfortunately, that is a breaking change for all of GSL's
consumers.

This commit updates our use of span to comply with the new changes in
GSL 3.

Chief among those breaking changes is:

* `span::at` no longer exists; I replaced many instances of `span::at`
  with `gsl::at(x)`
* `span::size_type` has finally given up on `ptrdiff_t` and become
  `size_t` like all other containers

While I was here, I also made the following mechanical replacements:

* In some of our "early standardized" code, we used std::optional's
  `has_value` and `value` back-to-back. Each `value` incurs an
  additional presence test.
  * Change: `x.value().member` -> `x->member` (`optional::operator->`
    skips the presence test)
  * Change: `x.value()` -> `*x` (as above)
* GSL 3 uses `size_t` for `size_type`.
  * Change: `gsl::narrow<size_t>(x.size())` -> `x.size()`
  * Change: `gsl::narrow<ptrdiff_t>(nonSpan.size())` -> `nonSpan.size()`
    during span construction

I also replaced two instances of `x[x.size() - 1]` with `x.back()` and
one instance of a manual array walk (for comparison) with a direct
comparison.

NOTE: Span comparison and `make_span` are not part of the C++20 span
library.

Fixes #6251
This commit is contained in:
Dustin L. Howett 2020-07-14 11:30:59 -07:00 committed by GitHub
parent ff27fdfed1
commit 54a7fce3e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 332 additions and 333 deletions

@ -1 +1 @@
Subproject commit 7e99e76c9761d0d0b0848b91f8648830670ee872
Subproject commit 0f6dbc9e2915ef5c16830f3fa3565738de2a9230

View File

@ -927,7 +927,7 @@ void Terminal::SetBackgroundCallback(std::function<void(const COLORREF)> pfn) no
void Terminal::_InitializeColorTable()
try
{
const gsl::span<COLORREF> tableView = { _colorTable.data(), gsl::narrow<ptrdiff_t>(_colorTable.size()) };
const gsl::span<COLORREF> tableView = { _colorTable.data(), _colorTable.size() };
// First set up the basic 256 colors
Utils::Initialize256ColorTable(tableView);
// Then use fill the first 16 values with the Campbell scheme

View File

@ -102,7 +102,7 @@ namespace TerminalAppUnitTests
VERIFY_ARE_EQUAL(ARGB(0, 0xFF, 0xFF, 0xFF), scheme.GetCursorColor());
std::array<COLORREF, COLOR_TABLE_SIZE> expectedCampbellTable;
auto campbellSpan = gsl::span<COLORREF>(&expectedCampbellTable[0], gsl::narrow<ptrdiff_t>(COLOR_TABLE_SIZE));
auto campbellSpan = gsl::span<COLORREF>(&expectedCampbellTable[0], COLOR_TABLE_SIZE);
Utils::InitializeCampbellColorTable(campbellSpan);
Utils::SetColorTableAlpha(campbellSpan, 0);

View File

@ -147,9 +147,9 @@ std::unordered_map<std::wstring,
// Ensure output variables are initialized
writtenOrNeeded = 0;
if (target.has_value() && target.value().size() > 0)
if (target.has_value() && target->size() > 0)
{
target.value().at(0) = UNICODE_NULL;
gsl::at(*target, 0) = UNICODE_NULL;
}
std::wstring exeNameString(exeName);
@ -178,9 +178,9 @@ std::unordered_map<std::wstring,
if (target.has_value())
{
// if the user didn't give us enough space, return with insufficient buffer code early.
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), gsl::narrow<size_t>(target.value().size()) < neededSize);
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), target->size() < neededSize);
RETURN_IF_FAILED(StringCchCopyNW(target.value().data(), target.value().size(), targetString.data(), targetSize));
RETURN_IF_FAILED(StringCchCopyNW(target->data(), target->size(), targetString.data(), targetSize));
}
return S_OK;
@ -211,7 +211,7 @@ std::unordered_map<std::wstring,
{
if (target.size() > 0)
{
target.at(0) = ANSI_NULL;
gsl::at(target, 0) = ANSI_NULL;
}
LockConsole();
@ -449,14 +449,14 @@ void Alias::s_ClearCmdExeAliases()
// Ensure output variables are initialized.
writtenOrNeeded = 0;
if (aliasBuffer.has_value() && aliasBuffer.value().size() > 0)
if (aliasBuffer.has_value() && aliasBuffer->size() > 0)
{
aliasBuffer.value().at(0) = UNICODE_NULL;
gsl::at(*aliasBuffer, 0) = UNICODE_NULL;
}
std::wstring exeNameString(exeName);
LPWSTR AliasesBufferPtrW = aliasBuffer.has_value() ? aliasBuffer.value().data() : nullptr;
LPWSTR AliasesBufferPtrW = aliasBuffer.has_value() ? aliasBuffer->data() : nullptr;
size_t cchTotalLength = 0; // accumulate the characters we need/have copied as we walk the list
// Each of the aliases will be made up of the source, a separator, the target, then a null character.
@ -489,10 +489,10 @@ void Alias::s_ClearCmdExeAliases()
size_t cchNewTotal;
RETURN_IF_FAILED(SizeTAdd(cchTotalLength, cchNeeded, &cchNewTotal));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), cchNewTotal > gsl::narrow<size_t>(aliasBuffer.value().size()));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), cchNewTotal > aliasBuffer->size());
size_t cchAliasBufferRemaining;
RETURN_IF_FAILED(SizeTSub(aliasBuffer.value().size(), cchTotalLength, &cchAliasBufferRemaining));
RETURN_IF_FAILED(SizeTSub(aliasBuffer->size(), cchTotalLength, &cchAliasBufferRemaining));
RETURN_IF_FAILED(StringCchCopyNW(AliasesBufferPtrW, cchAliasBufferRemaining, pair.first.data(), cchSource));
RETURN_IF_FAILED(SizeTSub(cchAliasBufferRemaining, cchSource, &cchAliasBufferRemaining));
@ -543,7 +543,7 @@ void Alias::s_ClearCmdExeAliases()
{
if (alias.size() > 0)
{
alias.at(0) = '\0';
gsl::at(alias, 0) = '\0';
}
LockConsole();
@ -574,7 +574,7 @@ void Alias::s_ClearCmdExeAliases()
// Copy safely to the output buffer
// - Aliases are a series of null terminated strings. We cannot use a SafeString function to copy.
// So instead, validate and use raw memory copy.
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), converted.size() > gsl::narrow<size_t>(alias.size()));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), converted.size() > alias.size());
memcpy_s(alias.data(), alias.size(), converted.data(), converted.size());
// And return the size copied.
@ -696,12 +696,12 @@ void Alias::s_ClearCmdExeAliases()
{
// Ensure output variables are initialized.
writtenOrNeeded = 0;
if (aliasExesBuffer.has_value() && aliasExesBuffer.value().size() > 0)
if (aliasExesBuffer.has_value() && aliasExesBuffer->size() > 0)
{
aliasExesBuffer.value().at(0) = UNICODE_NULL;
gsl::at(*aliasExesBuffer, 0) = UNICODE_NULL;
}
LPWSTR AliasExesBufferPtrW = aliasExesBuffer.has_value() ? aliasExesBuffer.value().data() : nullptr;
LPWSTR AliasExesBufferPtrW = aliasExesBuffer.has_value() ? aliasExesBuffer->data() : nullptr;
size_t cchTotalLength = 0; // accumulate the characters we need/have copied as we walk the list
size_t const cchNull = 1;
@ -722,10 +722,10 @@ void Alias::s_ClearCmdExeAliases()
// Error out early if there is a problem.
size_t cchNewTotal;
RETURN_IF_FAILED(SizeTAdd(cchTotalLength, cchNeeded, &cchNewTotal));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), cchNewTotal > gsl::narrow<size_t>(aliasExesBuffer.value().size()));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), cchNewTotal > aliasExesBuffer->size());
size_t cchRemaining;
RETURN_IF_FAILED(SizeTSub(aliasExesBuffer.value().size(), cchTotalLength, &cchRemaining));
RETURN_IF_FAILED(SizeTSub(aliasExesBuffer->size(), cchTotalLength, &cchRemaining));
RETURN_IF_FAILED(StringCchCopyNW(AliasExesBufferPtrW, cchRemaining, pair.first.data(), cchExe));
AliasExesBufferPtrW += cchNeeded;
@ -761,7 +761,7 @@ void Alias::s_ClearCmdExeAliases()
{
if (aliasExes.size() > 0)
{
aliasExes.at(0) = '\0';
gsl::at(aliasExes, 0) = '\0';
}
LockConsole();
@ -788,7 +788,7 @@ void Alias::s_ClearCmdExeAliases()
// Copy safely to the output buffer
// - AliasExes are a series of null terminated strings. We cannot use a SafeString function to copy.
// So instead, validate and use raw memory copy.
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), converted.size() > gsl::narrow<size_t>(aliasExes.size()));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), converted.size() > aliasExes.size());
memcpy_s(aliasExes.data(), aliasExes.size(), converted.data(), converted.size());
// And return the size copied.

View File

@ -64,13 +64,15 @@ DWORD UnicodeRasterFontCellMungeOnRead(const gsl::span<CHAR_INFO> buffer)
DWORD iDst = 0;
// Walk through every CHAR_INFO
for (DWORD iSrc = 0; iSrc < gsl::narrow<size_t>(buffer.size()); iSrc++)
for (DWORD iSrc = 0; iSrc < buffer.size(); iSrc++)
{
// If it's not a trailing byte, copy it straight over, stripping out the Leading/Trailing flags from the attributes field.
if (!WI_IsFlagSet(buffer.at(iSrc).Attributes, COMMON_LVB_TRAILING_BYTE))
auto& src{ gsl::at(buffer, iSrc) };
if (!WI_IsFlagSet(src.Attributes, COMMON_LVB_TRAILING_BYTE))
{
buffer.at(iDst) = buffer.at(iSrc);
WI_ClearAllFlags(buffer.at(iDst).Attributes, COMMON_LVB_SBCSDBCS);
auto& dst{ gsl::at(buffer, iDst) };
dst = src;
WI_ClearAllFlags(dst.Attributes, COMMON_LVB_SBCSDBCS);
iDst++;
}
@ -90,7 +92,7 @@ DWORD UnicodeRasterFontCellMungeOnRead(const gsl::span<CHAR_INFO> buffer)
iDst += cchDstToClear;
// now that we're done, we should have copied, left alone, or cleared the entire length.
FAIL_FAST_IF(!(iDst == gsl::narrow<size_t>(buffer.size())));
FAIL_FAST_IF(iDst != buffer.size());
return iDst;
}

View File

@ -610,7 +610,7 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
{
try
{
std::vector<CHAR_INFO> tempBuffer(buffer.cbegin(), buffer.cend());
std::vector<CHAR_INFO> tempBuffer(buffer.begin(), buffer.end());
const auto size = rectangle.Dimensions();
auto tempIter = tempBuffer.cbegin();
@ -761,7 +761,7 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
result.reserve(buffer.size() * 2); // we estimate we'll need up to double the cells if they all expand.
const auto size = rectangle.Dimensions();
auto bufferIter = buffer.cbegin();
auto bufferIter = buffer.begin();
for (SHORT i = 0; i < size.Y; i++)
{
@ -835,9 +835,8 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
}
// The buffer given should be big enough to hold the dimensions of the request.
ptrdiff_t targetArea;
RETURN_IF_FAILED(PtrdiffTMult(targetSize.X, targetSize.Y, &targetArea));
RETURN_HR_IF(E_INVALIDARG, targetArea < 0);
size_t targetArea;
RETURN_IF_FAILED(SizeTMult(targetSize.X, targetSize.Y, &targetArea));
RETURN_HR_IF(E_INVALIDARG, targetArea < targetBuffer.size());
// Clip the request rectangle to the size of the storage buffer
@ -1145,7 +1144,7 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
// for compatibility reasons, if we receive more chars than can fit in the buffer
// then we don't send anything back.
if (chars.size() <= gsl::narrow<size_t>(buffer.size()))
if (chars.size() <= buffer.size())
{
std::copy(chars.cbegin(), chars.cend(), buffer.begin());
written = chars.size();
@ -1173,7 +1172,7 @@ void EventsToUnicode(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& inEvents,
buffer.size());
// Only copy if the whole result will fit.
if (chars.size() <= gsl::narrow<size_t>(buffer.size()))
if (chars.size() <= buffer.size())
{
std::copy(chars.cbegin(), chars.cend(), buffer.begin());
written = chars.size();

View File

@ -1602,9 +1602,9 @@ void DoSrvPrivateRefreshWindow(_In_ const SCREEN_INFORMATION& screenInfo)
written = 0;
needed = 0;
if (title.has_value() && title.value().size() > 0)
if (title.has_value() && title->size() > 0)
{
title.value().at(0) = ANSI_NULL;
gsl::at(*title, 0) = ANSI_NULL;
}
// Get the appropriate title and length depending on the mode.
@ -1628,13 +1628,13 @@ void DoSrvPrivateRefreshWindow(_In_ const SCREEN_INFORMATION& screenInfo)
// If we have a pointer to receive the data, then copy it out.
if (title.has_value())
{
HRESULT const hr = StringCchCopyNW(title.value().data(), title.value().size(), pwszTitle, cchTitleLength);
HRESULT const hr = StringCchCopyNW(title->data(), title->size(), pwszTitle, cchTitleLength);
// Insufficient buffer is allowed. If we return a partial string, that's still OK by historical/compat standards.
// Just say how much we managed to return.
if (SUCCEEDED(hr) || STRSAFE_E_INSUFFICIENT_BUFFER == hr)
{
written = std::min(gsl::narrow<size_t>(title.value().size()), cchTitleLength);
written = std::min(title->size(), cchTitleLength);
}
}
return S_OK;
@ -1667,7 +1667,7 @@ void DoSrvPrivateRefreshWindow(_In_ const SCREEN_INFORMATION& screenInfo)
if (title.size() > 0)
{
title.at(0) = ANSI_NULL;
gsl::at(title, 0) = ANSI_NULL;
}
// Figure out how big our temporary Unicode buffer must be to get the title.
@ -1694,7 +1694,7 @@ void DoSrvPrivateRefreshWindow(_In_ const SCREEN_INFORMATION& screenInfo)
// The legacy A behavior is a bit strange. If the buffer given doesn't have enough space to hold
// the string without null termination (e.g. the title is 9 long, 10 with null. The buffer given isn't >= 9).
// then do not copy anything back and do not report how much space we need.
if (gsl::narrow<size_t>(title.size()) >= converted.size())
if (title.size() >= converted.size())
{
// Say how many characters of buffer we would need to hold the entire result.
needed = converted.size();
@ -1707,13 +1707,13 @@ void DoSrvPrivateRefreshWindow(_In_ const SCREEN_INFORMATION& screenInfo)
if (SUCCEEDED(hr) || STRSAFE_E_INSUFFICIENT_BUFFER == hr)
{
// And return the size copied (either the size of the buffer or the null terminated length of the string we filled it with.)
written = std::min(gsl::narrow<size_t>(title.size()), converted.size() + 1);
written = std::min(title.size(), converted.size() + 1);
// Another compatibility fix... If we had exactly the number of bytes needed for an unterminated string,
// then replace the terminator left behind by StringCchCopyNA with the final character of the title string.
if (gsl::narrow<size_t>(title.size()) == converted.size())
if (title.size() == converted.size())
{
title.at(title.size() - 1) = converted.data()[converted.size() - 1];
title.back() = converted.back();
}
}
}
@ -1722,7 +1722,7 @@ void DoSrvPrivateRefreshWindow(_In_ const SCREEN_INFORMATION& screenInfo)
// If we didn't copy anything back and there is space, null terminate the given buffer and return.
if (title.size() > 0)
{
title.at(0) = ANSI_NULL;
gsl::at(title, 0) = ANSI_NULL;
written = 1;
}
}

View File

@ -782,7 +782,7 @@ HRESULT GetConsoleCommandHistoryWImplHelper(const std::wstring_view exeName,
writtenOrNeeded = 0;
if (historyBuffer.size() > 0)
{
historyBuffer.at(0) = UNICODE_NULL;
gsl::at(historyBuffer, 0) = UNICODE_NULL;
}
CommandHistory* const CommandHistory = CommandHistory::s_FindByExe(exeName);
@ -812,7 +812,7 @@ HRESULT GetConsoleCommandHistoryWImplHelper(const std::wstring_view exeName,
size_t cchNewTotal;
RETURN_IF_FAILED(SizeTAdd(cchTotalLength, cchNeeded, &cchNewTotal));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), cchNewTotal > gsl::narrow<size_t>(historyBuffer.size()));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), cchNewTotal > historyBuffer.size());
size_t cchRemaining;
RETURN_IF_FAILED(SizeTSub(historyBuffer.size(),
@ -859,7 +859,7 @@ HRESULT ApiRoutines::GetConsoleCommandHistoryAImpl(const std::string_view exeNam
{
if (commandHistory.size() > 0)
{
commandHistory.at(0) = ANSI_NULL;
gsl::at(commandHistory, 0) = ANSI_NULL;
}
LockConsole();
@ -889,7 +889,7 @@ HRESULT ApiRoutines::GetConsoleCommandHistoryAImpl(const std::string_view exeNam
// Copy safely to output buffer
// - CommandHistory are a series of null terminated strings. We cannot use a SafeString function to copy.
// So instead, validate and use raw memory copy.
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), converted.size() > gsl::narrow<size_t>(commandHistory.size()));
RETURN_HR_IF(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW), converted.size() > commandHistory.size());
memcpy_s(commandHistory.data(), commandHistory.size(), converted.data(), converted.size());
// And return the size copied.

View File

@ -81,7 +81,7 @@ Settings::Settings() :
_CursorColor = Cursor::s_InvertCursorColor;
_CursorType = CursorType::Legacy;
gsl::span<COLORREF> tableView = { _colorTable.data(), gsl::narrow<ptrdiff_t>(_colorTable.size()) };
gsl::span<COLORREF> tableView = { _colorTable.data(), _colorTable.size() };
::Microsoft::Console::Utils::Initialize256ColorTable(tableView);
::Microsoft::Console::Utils::InitializeCampbellColorTableForConhost(tableView);
}
@ -122,7 +122,7 @@ void Settings::ApplyDesktopSpecificDefaults()
_uNumberOfHistoryBuffers = 4;
_bHistoryNoDup = FALSE;
gsl::span<COLORREF> tableView = { _colorTable.data(), gsl::narrow<ptrdiff_t>(_colorTable.size()) };
gsl::span<COLORREF> tableView = { _colorTable.data(), _colorTable.size() };
::Microsoft::Console::Utils::InitializeCampbellColorTableForConhost(tableView);
_fTrimLeadingZeros = false;

View File

@ -67,10 +67,7 @@ class CommandLineTests
{
const auto span = cookedReadData.SpanWholeBuffer();
VERIFY_ARE_EQUAL(cookedReadData._bytesRead, wstr.size() * sizeof(wchar_t));
for (size_t i = 0; i < wstr.size(); ++i)
{
VERIFY_ARE_EQUAL(span.at(i), wstr.at(i));
}
VERIFY_ARE_EQUAL(wstr, (std::wstring_view{ span.data(), cookedReadData._bytesRead / sizeof(wchar_t) }));
}
void InitCookedReadData(COOKED_READ_DATA& cookedReadData,

View File

@ -64,6 +64,7 @@
#ifndef BLOCK_GSL
#define GSL_MULTI_SPAN_H
#include <gsl/gsl>
#include <gsl/span_ext>
#endif
// CppCoreCheck

View File

@ -446,7 +446,7 @@ CATCH_RETURN()
// Draw the background
// The rectangle needs to be deduced based on the origin and the BidiDirection
const auto advancesSpan = gsl::make_span(glyphRun->glyphAdvances, glyphRun->glyphCount);
const auto totalSpan = std::accumulate(advancesSpan.cbegin(), advancesSpan.cend(), 0.0f);
const auto totalSpan = std::accumulate(advancesSpan.begin(), advancesSpan.end(), 0.0f);
D2D1_RECT_F rect;
rect.top = origin.y;

View File

@ -52,8 +52,8 @@ void UtilsTests::TestSwapColorPalette()
std::array<COLORREF, COLOR_TABLE_SIZE> terminalTable;
std::array<COLORREF, COLOR_TABLE_SIZE> consoleTable;
gsl::span<COLORREF> terminalTableView = { &terminalTable[0], gsl::narrow<ptrdiff_t>(terminalTable.size()) };
gsl::span<COLORREF> consoleTableView = { &consoleTable[0], gsl::narrow<ptrdiff_t>(consoleTable.size()) };
gsl::span<COLORREF> terminalTableView = { &terminalTable[0], terminalTable.size() };
gsl::span<COLORREF> consoleTableView = { &consoleTable[0], consoleTable.size() };
// First set up the colors
InitializeCampbellColorTable(terminalTableView);

View File

@ -122,22 +122,22 @@ void Utils::InitializeCampbellColorTable(const gsl::span<COLORREF> table)
THROW_HR_IF(E_INVALIDARG, table.size() < 16);
// clang-format off
table[0] = RGB(12, 12, 12);
table[1] = RGB(197, 15, 31);
table[2] = RGB(19, 161, 14);
table[3] = RGB(193, 156, 0);
table[4] = RGB(0, 55, 218);
table[5] = RGB(136, 23, 152);
table[6] = RGB(58, 150, 221);
table[7] = RGB(204, 204, 204);
table[8] = RGB(118, 118, 118);
table[9] = RGB(231, 72, 86);
table[10] = RGB(22, 198, 12);
table[11] = RGB(249, 241, 165);
table[12] = RGB(59, 120, 255);
table[13] = RGB(180, 0, 158);
table[14] = RGB(97, 214, 214);
table[15] = RGB(242, 242, 242);
gsl::at(table, 0) = RGB(12, 12, 12);
gsl::at(table, 1) = RGB(197, 15, 31);
gsl::at(table, 2) = RGB(19, 161, 14);
gsl::at(table, 3) = RGB(193, 156, 0);
gsl::at(table, 4) = RGB(0, 55, 218);
gsl::at(table, 5) = RGB(136, 23, 152);
gsl::at(table, 6) = RGB(58, 150, 221);
gsl::at(table, 7) = RGB(204, 204, 204);
gsl::at(table, 8) = RGB(118, 118, 118);
gsl::at(table, 9) = RGB(231, 72, 86);
gsl::at(table, 10) = RGB(22, 198, 12);
gsl::at(table, 11) = RGB(249, 241, 165);
gsl::at(table, 12) = RGB(59, 120, 255);
gsl::at(table, 13) = RGB(180, 0, 158);
gsl::at(table, 14) = RGB(97, 214, 214);
gsl::at(table, 15) = RGB(242, 242, 242);
// clang-format on
}
@ -164,10 +164,10 @@ void Utils::InitializeCampbellColorTableForConhost(const gsl::span<COLORREF> tab
void Utils::SwapANSIColorOrderForConhost(const gsl::span<COLORREF> table)
{
THROW_HR_IF(E_INVALIDARG, table.size() < 16);
std::swap(table[1], table[4]);
std::swap(table[3], table[6]);
std::swap(table[9], table[12]);
std::swap(table[11], table[14]);
std::swap(gsl::at(table, 1), gsl::at(table, 4));
std::swap(gsl::at(table, 3), gsl::at(table, 6));
std::swap(gsl::at(table, 9), gsl::at(table, 12));
std::swap(gsl::at(table, 11), gsl::at(table, 14));
}
// Function Description:
@ -182,262 +182,262 @@ void Utils::Initialize256ColorTable(const gsl::span<COLORREF> table)
THROW_HR_IF(E_INVALIDARG, table.size() < 256);
// clang-format off
table[0] = RGB(0x00, 0x00, 0x00);
table[1] = RGB(0x80, 0x00, 0x00);
table[2] = RGB(0x00, 0x80, 0x00);
table[3] = RGB(0x80, 0x80, 0x00);
table[4] = RGB(0x00, 0x00, 0x80);
table[5] = RGB(0x80, 0x00, 0x80);
table[6] = RGB(0x00, 0x80, 0x80);
table[7] = RGB(0xc0, 0xc0, 0xc0);
table[8] = RGB(0x80, 0x80, 0x80);
table[9] = RGB(0xff, 0x00, 0x00);
table[10] = RGB(0x00, 0xff, 0x00);
table[11] = RGB(0xff, 0xff, 0x00);
table[12] = RGB(0x00, 0x00, 0xff);
table[13] = RGB(0xff, 0x00, 0xff);
table[14] = RGB(0x00, 0xff, 0xff);
table[15] = RGB(0xff, 0xff, 0xff);
table[16] = RGB(0x00, 0x00, 0x00);
table[17] = RGB(0x00, 0x00, 0x5f);
table[18] = RGB(0x00, 0x00, 0x87);
table[19] = RGB(0x00, 0x00, 0xaf);
table[20] = RGB(0x00, 0x00, 0xd7);
table[21] = RGB(0x00, 0x00, 0xff);
table[22] = RGB(0x00, 0x5f, 0x00);
table[23] = RGB(0x00, 0x5f, 0x5f);
table[24] = RGB(0x00, 0x5f, 0x87);
table[25] = RGB(0x00, 0x5f, 0xaf);
table[26] = RGB(0x00, 0x5f, 0xd7);
table[27] = RGB(0x00, 0x5f, 0xff);
table[28] = RGB(0x00, 0x87, 0x00);
table[29] = RGB(0x00, 0x87, 0x5f);
table[30] = RGB(0x00, 0x87, 0x87);
table[31] = RGB(0x00, 0x87, 0xaf);
table[32] = RGB(0x00, 0x87, 0xd7);
table[33] = RGB(0x00, 0x87, 0xff);
table[34] = RGB(0x00, 0xaf, 0x00);
table[35] = RGB(0x00, 0xaf, 0x5f);
table[36] = RGB(0x00, 0xaf, 0x87);
table[37] = RGB(0x00, 0xaf, 0xaf);
table[38] = RGB(0x00, 0xaf, 0xd7);
table[39] = RGB(0x00, 0xaf, 0xff);
table[40] = RGB(0x00, 0xd7, 0x00);
table[41] = RGB(0x00, 0xd7, 0x5f);
table[42] = RGB(0x00, 0xd7, 0x87);
table[43] = RGB(0x00, 0xd7, 0xaf);
table[44] = RGB(0x00, 0xd7, 0xd7);
table[45] = RGB(0x00, 0xd7, 0xff);
table[46] = RGB(0x00, 0xff, 0x00);
table[47] = RGB(0x00, 0xff, 0x5f);
table[48] = RGB(0x00, 0xff, 0x87);
table[49] = RGB(0x00, 0xff, 0xaf);
table[50] = RGB(0x00, 0xff, 0xd7);
table[51] = RGB(0x00, 0xff, 0xff);
table[52] = RGB(0x5f, 0x00, 0x00);
table[53] = RGB(0x5f, 0x00, 0x5f);
table[54] = RGB(0x5f, 0x00, 0x87);
table[55] = RGB(0x5f, 0x00, 0xaf);
table[56] = RGB(0x5f, 0x00, 0xd7);
table[57] = RGB(0x5f, 0x00, 0xff);
table[58] = RGB(0x5f, 0x5f, 0x00);
table[59] = RGB(0x5f, 0x5f, 0x5f);
table[60] = RGB(0x5f, 0x5f, 0x87);
table[61] = RGB(0x5f, 0x5f, 0xaf);
table[62] = RGB(0x5f, 0x5f, 0xd7);
table[63] = RGB(0x5f, 0x5f, 0xff);
table[64] = RGB(0x5f, 0x87, 0x00);
table[65] = RGB(0x5f, 0x87, 0x5f);
table[66] = RGB(0x5f, 0x87, 0x87);
table[67] = RGB(0x5f, 0x87, 0xaf);
table[68] = RGB(0x5f, 0x87, 0xd7);
table[69] = RGB(0x5f, 0x87, 0xff);
table[70] = RGB(0x5f, 0xaf, 0x00);
table[71] = RGB(0x5f, 0xaf, 0x5f);
table[72] = RGB(0x5f, 0xaf, 0x87);
table[73] = RGB(0x5f, 0xaf, 0xaf);
table[74] = RGB(0x5f, 0xaf, 0xd7);
table[75] = RGB(0x5f, 0xaf, 0xff);
table[76] = RGB(0x5f, 0xd7, 0x00);
table[77] = RGB(0x5f, 0xd7, 0x5f);
table[78] = RGB(0x5f, 0xd7, 0x87);
table[79] = RGB(0x5f, 0xd7, 0xaf);
table[80] = RGB(0x5f, 0xd7, 0xd7);
table[81] = RGB(0x5f, 0xd7, 0xff);
table[82] = RGB(0x5f, 0xff, 0x00);
table[83] = RGB(0x5f, 0xff, 0x5f);
table[84] = RGB(0x5f, 0xff, 0x87);
table[85] = RGB(0x5f, 0xff, 0xaf);
table[86] = RGB(0x5f, 0xff, 0xd7);
table[87] = RGB(0x5f, 0xff, 0xff);
table[88] = RGB(0x87, 0x00, 0x00);
table[89] = RGB(0x87, 0x00, 0x5f);
table[90] = RGB(0x87, 0x00, 0x87);
table[91] = RGB(0x87, 0x00, 0xaf);
table[92] = RGB(0x87, 0x00, 0xd7);
table[93] = RGB(0x87, 0x00, 0xff);
table[94] = RGB(0x87, 0x5f, 0x00);
table[95] = RGB(0x87, 0x5f, 0x5f);
table[96] = RGB(0x87, 0x5f, 0x87);
table[97] = RGB(0x87, 0x5f, 0xaf);
table[98] = RGB(0x87, 0x5f, 0xd7);
table[99] = RGB(0x87, 0x5f, 0xff);
table[100] = RGB(0x87, 0x87, 0x00);
table[101] = RGB(0x87, 0x87, 0x5f);
table[102] = RGB(0x87, 0x87, 0x87);
table[103] = RGB(0x87, 0x87, 0xaf);
table[104] = RGB(0x87, 0x87, 0xd7);
table[105] = RGB(0x87, 0x87, 0xff);
table[106] = RGB(0x87, 0xaf, 0x00);
table[107] = RGB(0x87, 0xaf, 0x5f);
table[108] = RGB(0x87, 0xaf, 0x87);
table[109] = RGB(0x87, 0xaf, 0xaf);
table[110] = RGB(0x87, 0xaf, 0xd7);
table[111] = RGB(0x87, 0xaf, 0xff);
table[112] = RGB(0x87, 0xd7, 0x00);
table[113] = RGB(0x87, 0xd7, 0x5f);
table[114] = RGB(0x87, 0xd7, 0x87);
table[115] = RGB(0x87, 0xd7, 0xaf);
table[116] = RGB(0x87, 0xd7, 0xd7);
table[117] = RGB(0x87, 0xd7, 0xff);
table[118] = RGB(0x87, 0xff, 0x00);
table[119] = RGB(0x87, 0xff, 0x5f);
table[120] = RGB(0x87, 0xff, 0x87);
table[121] = RGB(0x87, 0xff, 0xaf);
table[122] = RGB(0x87, 0xff, 0xd7);
table[123] = RGB(0x87, 0xff, 0xff);
table[124] = RGB(0xaf, 0x00, 0x00);
table[125] = RGB(0xaf, 0x00, 0x5f);
table[126] = RGB(0xaf, 0x00, 0x87);
table[127] = RGB(0xaf, 0x00, 0xaf);
table[128] = RGB(0xaf, 0x00, 0xd7);
table[129] = RGB(0xaf, 0x00, 0xff);
table[130] = RGB(0xaf, 0x5f, 0x00);
table[131] = RGB(0xaf, 0x5f, 0x5f);
table[132] = RGB(0xaf, 0x5f, 0x87);
table[133] = RGB(0xaf, 0x5f, 0xaf);
table[134] = RGB(0xaf, 0x5f, 0xd7);
table[135] = RGB(0xaf, 0x5f, 0xff);
table[136] = RGB(0xaf, 0x87, 0x00);
table[137] = RGB(0xaf, 0x87, 0x5f);
table[138] = RGB(0xaf, 0x87, 0x87);
table[139] = RGB(0xaf, 0x87, 0xaf);
table[140] = RGB(0xaf, 0x87, 0xd7);
table[141] = RGB(0xaf, 0x87, 0xff);
table[142] = RGB(0xaf, 0xaf, 0x00);
table[143] = RGB(0xaf, 0xaf, 0x5f);
table[144] = RGB(0xaf, 0xaf, 0x87);
table[145] = RGB(0xaf, 0xaf, 0xaf);
table[146] = RGB(0xaf, 0xaf, 0xd7);
table[147] = RGB(0xaf, 0xaf, 0xff);
table[148] = RGB(0xaf, 0xd7, 0x00);
table[149] = RGB(0xaf, 0xd7, 0x5f);
table[150] = RGB(0xaf, 0xd7, 0x87);
table[151] = RGB(0xaf, 0xd7, 0xaf);
table[152] = RGB(0xaf, 0xd7, 0xd7);
table[153] = RGB(0xaf, 0xd7, 0xff);
table[154] = RGB(0xaf, 0xff, 0x00);
table[155] = RGB(0xaf, 0xff, 0x5f);
table[156] = RGB(0xaf, 0xff, 0x87);
table[157] = RGB(0xaf, 0xff, 0xaf);
table[158] = RGB(0xaf, 0xff, 0xd7);
table[159] = RGB(0xaf, 0xff, 0xff);
table[160] = RGB(0xd7, 0x00, 0x00);
table[161] = RGB(0xd7, 0x00, 0x5f);
table[162] = RGB(0xd7, 0x00, 0x87);
table[163] = RGB(0xd7, 0x00, 0xaf);
table[164] = RGB(0xd7, 0x00, 0xd7);
table[165] = RGB(0xd7, 0x00, 0xff);
table[166] = RGB(0xd7, 0x5f, 0x00);
table[167] = RGB(0xd7, 0x5f, 0x5f);
table[168] = RGB(0xd7, 0x5f, 0x87);
table[169] = RGB(0xd7, 0x5f, 0xaf);
table[170] = RGB(0xd7, 0x5f, 0xd7);
table[171] = RGB(0xd7, 0x5f, 0xff);
table[172] = RGB(0xd7, 0x87, 0x00);
table[173] = RGB(0xd7, 0x87, 0x5f);
table[174] = RGB(0xd7, 0x87, 0x87);
table[175] = RGB(0xd7, 0x87, 0xaf);
table[176] = RGB(0xd7, 0x87, 0xd7);
table[177] = RGB(0xd7, 0x87, 0xff);
table[178] = RGB(0xd7, 0xaf, 0x00);
table[179] = RGB(0xd7, 0xaf, 0x5f);
table[180] = RGB(0xd7, 0xaf, 0x87);
table[181] = RGB(0xd7, 0xaf, 0xaf);
table[182] = RGB(0xd7, 0xaf, 0xd7);
table[183] = RGB(0xd7, 0xaf, 0xff);
table[184] = RGB(0xd7, 0xd7, 0x00);
table[185] = RGB(0xd7, 0xd7, 0x5f);
table[186] = RGB(0xd7, 0xd7, 0x87);
table[187] = RGB(0xd7, 0xd7, 0xaf);
table[188] = RGB(0xd7, 0xd7, 0xd7);
table[189] = RGB(0xd7, 0xd7, 0xff);
table[190] = RGB(0xd7, 0xff, 0x00);
table[191] = RGB(0xd7, 0xff, 0x5f);
table[192] = RGB(0xd7, 0xff, 0x87);
table[193] = RGB(0xd7, 0xff, 0xaf);
table[194] = RGB(0xd7, 0xff, 0xd7);
table[195] = RGB(0xd7, 0xff, 0xff);
table[196] = RGB(0xff, 0x00, 0x00);
table[197] = RGB(0xff, 0x00, 0x5f);
table[198] = RGB(0xff, 0x00, 0x87);
table[199] = RGB(0xff, 0x00, 0xaf);
table[200] = RGB(0xff, 0x00, 0xd7);
table[201] = RGB(0xff, 0x00, 0xff);
table[202] = RGB(0xff, 0x5f, 0x00);
table[203] = RGB(0xff, 0x5f, 0x5f);
table[204] = RGB(0xff, 0x5f, 0x87);
table[205] = RGB(0xff, 0x5f, 0xaf);
table[206] = RGB(0xff, 0x5f, 0xd7);
table[207] = RGB(0xff, 0x5f, 0xff);
table[208] = RGB(0xff, 0x87, 0x00);
table[209] = RGB(0xff, 0x87, 0x5f);
table[210] = RGB(0xff, 0x87, 0x87);
table[211] = RGB(0xff, 0x87, 0xaf);
table[212] = RGB(0xff, 0x87, 0xd7);
table[213] = RGB(0xff, 0x87, 0xff);
table[214] = RGB(0xff, 0xaf, 0x00);
table[215] = RGB(0xff, 0xaf, 0x5f);
table[216] = RGB(0xff, 0xaf, 0x87);
table[217] = RGB(0xff, 0xaf, 0xaf);
table[218] = RGB(0xff, 0xaf, 0xd7);
table[219] = RGB(0xff, 0xaf, 0xff);
table[220] = RGB(0xff, 0xd7, 0x00);
table[221] = RGB(0xff, 0xd7, 0x5f);
table[222] = RGB(0xff, 0xd7, 0x87);
table[223] = RGB(0xff, 0xd7, 0xaf);
table[224] = RGB(0xff, 0xd7, 0xd7);
table[225] = RGB(0xff, 0xd7, 0xff);
table[226] = RGB(0xff, 0xff, 0x00);
table[227] = RGB(0xff, 0xff, 0x5f);
table[228] = RGB(0xff, 0xff, 0x87);
table[229] = RGB(0xff, 0xff, 0xaf);
table[230] = RGB(0xff, 0xff, 0xd7);
table[231] = RGB(0xff, 0xff, 0xff);
table[232] = RGB(0x08, 0x08, 0x08);
table[233] = RGB(0x12, 0x12, 0x12);
table[234] = RGB(0x1c, 0x1c, 0x1c);
table[235] = RGB(0x26, 0x26, 0x26);
table[236] = RGB(0x30, 0x30, 0x30);
table[237] = RGB(0x3a, 0x3a, 0x3a);
table[238] = RGB(0x44, 0x44, 0x44);
table[239] = RGB(0x4e, 0x4e, 0x4e);
table[240] = RGB(0x58, 0x58, 0x58);
table[241] = RGB(0x62, 0x62, 0x62);
table[242] = RGB(0x6c, 0x6c, 0x6c);
table[243] = RGB(0x76, 0x76, 0x76);
table[244] = RGB(0x80, 0x80, 0x80);
table[245] = RGB(0x8a, 0x8a, 0x8a);
table[246] = RGB(0x94, 0x94, 0x94);
table[247] = RGB(0x9e, 0x9e, 0x9e);
table[248] = RGB(0xa8, 0xa8, 0xa8);
table[249] = RGB(0xb2, 0xb2, 0xb2);
table[250] = RGB(0xbc, 0xbc, 0xbc);
table[251] = RGB(0xc6, 0xc6, 0xc6);
table[252] = RGB(0xd0, 0xd0, 0xd0);
table[253] = RGB(0xda, 0xda, 0xda);
table[254] = RGB(0xe4, 0xe4, 0xe4);
table[255] = RGB(0xee, 0xee, 0xee);
gsl::at(table, 0) = RGB(0x00, 0x00, 0x00);
gsl::at(table, 1) = RGB(0x80, 0x00, 0x00);
gsl::at(table, 2) = RGB(0x00, 0x80, 0x00);
gsl::at(table, 3) = RGB(0x80, 0x80, 0x00);
gsl::at(table, 4) = RGB(0x00, 0x00, 0x80);
gsl::at(table, 5) = RGB(0x80, 0x00, 0x80);
gsl::at(table, 6) = RGB(0x00, 0x80, 0x80);
gsl::at(table, 7) = RGB(0xc0, 0xc0, 0xc0);
gsl::at(table, 8) = RGB(0x80, 0x80, 0x80);
gsl::at(table, 9) = RGB(0xff, 0x00, 0x00);
gsl::at(table, 10) = RGB(0x00, 0xff, 0x00);
gsl::at(table, 11) = RGB(0xff, 0xff, 0x00);
gsl::at(table, 12) = RGB(0x00, 0x00, 0xff);
gsl::at(table, 13) = RGB(0xff, 0x00, 0xff);
gsl::at(table, 14) = RGB(0x00, 0xff, 0xff);
gsl::at(table, 15) = RGB(0xff, 0xff, 0xff);
gsl::at(table, 16) = RGB(0x00, 0x00, 0x00);
gsl::at(table, 17) = RGB(0x00, 0x00, 0x5f);
gsl::at(table, 18) = RGB(0x00, 0x00, 0x87);
gsl::at(table, 19) = RGB(0x00, 0x00, 0xaf);
gsl::at(table, 20) = RGB(0x00, 0x00, 0xd7);
gsl::at(table, 21) = RGB(0x00, 0x00, 0xff);
gsl::at(table, 22) = RGB(0x00, 0x5f, 0x00);
gsl::at(table, 23) = RGB(0x00, 0x5f, 0x5f);
gsl::at(table, 24) = RGB(0x00, 0x5f, 0x87);
gsl::at(table, 25) = RGB(0x00, 0x5f, 0xaf);
gsl::at(table, 26) = RGB(0x00, 0x5f, 0xd7);
gsl::at(table, 27) = RGB(0x00, 0x5f, 0xff);
gsl::at(table, 28) = RGB(0x00, 0x87, 0x00);
gsl::at(table, 29) = RGB(0x00, 0x87, 0x5f);
gsl::at(table, 30) = RGB(0x00, 0x87, 0x87);
gsl::at(table, 31) = RGB(0x00, 0x87, 0xaf);
gsl::at(table, 32) = RGB(0x00, 0x87, 0xd7);
gsl::at(table, 33) = RGB(0x00, 0x87, 0xff);
gsl::at(table, 34) = RGB(0x00, 0xaf, 0x00);
gsl::at(table, 35) = RGB(0x00, 0xaf, 0x5f);
gsl::at(table, 36) = RGB(0x00, 0xaf, 0x87);
gsl::at(table, 37) = RGB(0x00, 0xaf, 0xaf);
gsl::at(table, 38) = RGB(0x00, 0xaf, 0xd7);
gsl::at(table, 39) = RGB(0x00, 0xaf, 0xff);
gsl::at(table, 40) = RGB(0x00, 0xd7, 0x00);
gsl::at(table, 41) = RGB(0x00, 0xd7, 0x5f);
gsl::at(table, 42) = RGB(0x00, 0xd7, 0x87);
gsl::at(table, 43) = RGB(0x00, 0xd7, 0xaf);
gsl::at(table, 44) = RGB(0x00, 0xd7, 0xd7);
gsl::at(table, 45) = RGB(0x00, 0xd7, 0xff);
gsl::at(table, 46) = RGB(0x00, 0xff, 0x00);
gsl::at(table, 47) = RGB(0x00, 0xff, 0x5f);
gsl::at(table, 48) = RGB(0x00, 0xff, 0x87);
gsl::at(table, 49) = RGB(0x00, 0xff, 0xaf);
gsl::at(table, 50) = RGB(0x00, 0xff, 0xd7);
gsl::at(table, 51) = RGB(0x00, 0xff, 0xff);
gsl::at(table, 52) = RGB(0x5f, 0x00, 0x00);
gsl::at(table, 53) = RGB(0x5f, 0x00, 0x5f);
gsl::at(table, 54) = RGB(0x5f, 0x00, 0x87);
gsl::at(table, 55) = RGB(0x5f, 0x00, 0xaf);
gsl::at(table, 56) = RGB(0x5f, 0x00, 0xd7);
gsl::at(table, 57) = RGB(0x5f, 0x00, 0xff);
gsl::at(table, 58) = RGB(0x5f, 0x5f, 0x00);
gsl::at(table, 59) = RGB(0x5f, 0x5f, 0x5f);
gsl::at(table, 60) = RGB(0x5f, 0x5f, 0x87);
gsl::at(table, 61) = RGB(0x5f, 0x5f, 0xaf);
gsl::at(table, 62) = RGB(0x5f, 0x5f, 0xd7);
gsl::at(table, 63) = RGB(0x5f, 0x5f, 0xff);
gsl::at(table, 64) = RGB(0x5f, 0x87, 0x00);
gsl::at(table, 65) = RGB(0x5f, 0x87, 0x5f);
gsl::at(table, 66) = RGB(0x5f, 0x87, 0x87);
gsl::at(table, 67) = RGB(0x5f, 0x87, 0xaf);
gsl::at(table, 68) = RGB(0x5f, 0x87, 0xd7);
gsl::at(table, 69) = RGB(0x5f, 0x87, 0xff);
gsl::at(table, 70) = RGB(0x5f, 0xaf, 0x00);
gsl::at(table, 71) = RGB(0x5f, 0xaf, 0x5f);
gsl::at(table, 72) = RGB(0x5f, 0xaf, 0x87);
gsl::at(table, 73) = RGB(0x5f, 0xaf, 0xaf);
gsl::at(table, 74) = RGB(0x5f, 0xaf, 0xd7);
gsl::at(table, 75) = RGB(0x5f, 0xaf, 0xff);
gsl::at(table, 76) = RGB(0x5f, 0xd7, 0x00);
gsl::at(table, 77) = RGB(0x5f, 0xd7, 0x5f);
gsl::at(table, 78) = RGB(0x5f, 0xd7, 0x87);
gsl::at(table, 79) = RGB(0x5f, 0xd7, 0xaf);
gsl::at(table, 80) = RGB(0x5f, 0xd7, 0xd7);
gsl::at(table, 81) = RGB(0x5f, 0xd7, 0xff);
gsl::at(table, 82) = RGB(0x5f, 0xff, 0x00);
gsl::at(table, 83) = RGB(0x5f, 0xff, 0x5f);
gsl::at(table, 84) = RGB(0x5f, 0xff, 0x87);
gsl::at(table, 85) = RGB(0x5f, 0xff, 0xaf);
gsl::at(table, 86) = RGB(0x5f, 0xff, 0xd7);
gsl::at(table, 87) = RGB(0x5f, 0xff, 0xff);
gsl::at(table, 88) = RGB(0x87, 0x00, 0x00);
gsl::at(table, 89) = RGB(0x87, 0x00, 0x5f);
gsl::at(table, 90) = RGB(0x87, 0x00, 0x87);
gsl::at(table, 91) = RGB(0x87, 0x00, 0xaf);
gsl::at(table, 92) = RGB(0x87, 0x00, 0xd7);
gsl::at(table, 93) = RGB(0x87, 0x00, 0xff);
gsl::at(table, 94) = RGB(0x87, 0x5f, 0x00);
gsl::at(table, 95) = RGB(0x87, 0x5f, 0x5f);
gsl::at(table, 96) = RGB(0x87, 0x5f, 0x87);
gsl::at(table, 97) = RGB(0x87, 0x5f, 0xaf);
gsl::at(table, 98) = RGB(0x87, 0x5f, 0xd7);
gsl::at(table, 99) = RGB(0x87, 0x5f, 0xff);
gsl::at(table, 100) = RGB(0x87, 0x87, 0x00);
gsl::at(table, 101) = RGB(0x87, 0x87, 0x5f);
gsl::at(table, 102) = RGB(0x87, 0x87, 0x87);
gsl::at(table, 103) = RGB(0x87, 0x87, 0xaf);
gsl::at(table, 104) = RGB(0x87, 0x87, 0xd7);
gsl::at(table, 105) = RGB(0x87, 0x87, 0xff);
gsl::at(table, 106) = RGB(0x87, 0xaf, 0x00);
gsl::at(table, 107) = RGB(0x87, 0xaf, 0x5f);
gsl::at(table, 108) = RGB(0x87, 0xaf, 0x87);
gsl::at(table, 109) = RGB(0x87, 0xaf, 0xaf);
gsl::at(table, 110) = RGB(0x87, 0xaf, 0xd7);
gsl::at(table, 111) = RGB(0x87, 0xaf, 0xff);
gsl::at(table, 112) = RGB(0x87, 0xd7, 0x00);
gsl::at(table, 113) = RGB(0x87, 0xd7, 0x5f);
gsl::at(table, 114) = RGB(0x87, 0xd7, 0x87);
gsl::at(table, 115) = RGB(0x87, 0xd7, 0xaf);
gsl::at(table, 116) = RGB(0x87, 0xd7, 0xd7);
gsl::at(table, 117) = RGB(0x87, 0xd7, 0xff);
gsl::at(table, 118) = RGB(0x87, 0xff, 0x00);
gsl::at(table, 119) = RGB(0x87, 0xff, 0x5f);
gsl::at(table, 120) = RGB(0x87, 0xff, 0x87);
gsl::at(table, 121) = RGB(0x87, 0xff, 0xaf);
gsl::at(table, 122) = RGB(0x87, 0xff, 0xd7);
gsl::at(table, 123) = RGB(0x87, 0xff, 0xff);
gsl::at(table, 124) = RGB(0xaf, 0x00, 0x00);
gsl::at(table, 125) = RGB(0xaf, 0x00, 0x5f);
gsl::at(table, 126) = RGB(0xaf, 0x00, 0x87);
gsl::at(table, 127) = RGB(0xaf, 0x00, 0xaf);
gsl::at(table, 128) = RGB(0xaf, 0x00, 0xd7);
gsl::at(table, 129) = RGB(0xaf, 0x00, 0xff);
gsl::at(table, 130) = RGB(0xaf, 0x5f, 0x00);
gsl::at(table, 131) = RGB(0xaf, 0x5f, 0x5f);
gsl::at(table, 132) = RGB(0xaf, 0x5f, 0x87);
gsl::at(table, 133) = RGB(0xaf, 0x5f, 0xaf);
gsl::at(table, 134) = RGB(0xaf, 0x5f, 0xd7);
gsl::at(table, 135) = RGB(0xaf, 0x5f, 0xff);
gsl::at(table, 136) = RGB(0xaf, 0x87, 0x00);
gsl::at(table, 137) = RGB(0xaf, 0x87, 0x5f);
gsl::at(table, 138) = RGB(0xaf, 0x87, 0x87);
gsl::at(table, 139) = RGB(0xaf, 0x87, 0xaf);
gsl::at(table, 140) = RGB(0xaf, 0x87, 0xd7);
gsl::at(table, 141) = RGB(0xaf, 0x87, 0xff);
gsl::at(table, 142) = RGB(0xaf, 0xaf, 0x00);
gsl::at(table, 143) = RGB(0xaf, 0xaf, 0x5f);
gsl::at(table, 144) = RGB(0xaf, 0xaf, 0x87);
gsl::at(table, 145) = RGB(0xaf, 0xaf, 0xaf);
gsl::at(table, 146) = RGB(0xaf, 0xaf, 0xd7);
gsl::at(table, 147) = RGB(0xaf, 0xaf, 0xff);
gsl::at(table, 148) = RGB(0xaf, 0xd7, 0x00);
gsl::at(table, 149) = RGB(0xaf, 0xd7, 0x5f);
gsl::at(table, 150) = RGB(0xaf, 0xd7, 0x87);
gsl::at(table, 151) = RGB(0xaf, 0xd7, 0xaf);
gsl::at(table, 152) = RGB(0xaf, 0xd7, 0xd7);
gsl::at(table, 153) = RGB(0xaf, 0xd7, 0xff);
gsl::at(table, 154) = RGB(0xaf, 0xff, 0x00);
gsl::at(table, 155) = RGB(0xaf, 0xff, 0x5f);
gsl::at(table, 156) = RGB(0xaf, 0xff, 0x87);
gsl::at(table, 157) = RGB(0xaf, 0xff, 0xaf);
gsl::at(table, 158) = RGB(0xaf, 0xff, 0xd7);
gsl::at(table, 159) = RGB(0xaf, 0xff, 0xff);
gsl::at(table, 160) = RGB(0xd7, 0x00, 0x00);
gsl::at(table, 161) = RGB(0xd7, 0x00, 0x5f);
gsl::at(table, 162) = RGB(0xd7, 0x00, 0x87);
gsl::at(table, 163) = RGB(0xd7, 0x00, 0xaf);
gsl::at(table, 164) = RGB(0xd7, 0x00, 0xd7);
gsl::at(table, 165) = RGB(0xd7, 0x00, 0xff);
gsl::at(table, 166) = RGB(0xd7, 0x5f, 0x00);
gsl::at(table, 167) = RGB(0xd7, 0x5f, 0x5f);
gsl::at(table, 168) = RGB(0xd7, 0x5f, 0x87);
gsl::at(table, 169) = RGB(0xd7, 0x5f, 0xaf);
gsl::at(table, 170) = RGB(0xd7, 0x5f, 0xd7);
gsl::at(table, 171) = RGB(0xd7, 0x5f, 0xff);
gsl::at(table, 172) = RGB(0xd7, 0x87, 0x00);
gsl::at(table, 173) = RGB(0xd7, 0x87, 0x5f);
gsl::at(table, 174) = RGB(0xd7, 0x87, 0x87);
gsl::at(table, 175) = RGB(0xd7, 0x87, 0xaf);
gsl::at(table, 176) = RGB(0xd7, 0x87, 0xd7);
gsl::at(table, 177) = RGB(0xd7, 0x87, 0xff);
gsl::at(table, 178) = RGB(0xd7, 0xaf, 0x00);
gsl::at(table, 179) = RGB(0xd7, 0xaf, 0x5f);
gsl::at(table, 180) = RGB(0xd7, 0xaf, 0x87);
gsl::at(table, 181) = RGB(0xd7, 0xaf, 0xaf);
gsl::at(table, 182) = RGB(0xd7, 0xaf, 0xd7);
gsl::at(table, 183) = RGB(0xd7, 0xaf, 0xff);
gsl::at(table, 184) = RGB(0xd7, 0xd7, 0x00);
gsl::at(table, 185) = RGB(0xd7, 0xd7, 0x5f);
gsl::at(table, 186) = RGB(0xd7, 0xd7, 0x87);
gsl::at(table, 187) = RGB(0xd7, 0xd7, 0xaf);
gsl::at(table, 188) = RGB(0xd7, 0xd7, 0xd7);
gsl::at(table, 189) = RGB(0xd7, 0xd7, 0xff);
gsl::at(table, 190) = RGB(0xd7, 0xff, 0x00);
gsl::at(table, 191) = RGB(0xd7, 0xff, 0x5f);
gsl::at(table, 192) = RGB(0xd7, 0xff, 0x87);
gsl::at(table, 193) = RGB(0xd7, 0xff, 0xaf);
gsl::at(table, 194) = RGB(0xd7, 0xff, 0xd7);
gsl::at(table, 195) = RGB(0xd7, 0xff, 0xff);
gsl::at(table, 196) = RGB(0xff, 0x00, 0x00);
gsl::at(table, 197) = RGB(0xff, 0x00, 0x5f);
gsl::at(table, 198) = RGB(0xff, 0x00, 0x87);
gsl::at(table, 199) = RGB(0xff, 0x00, 0xaf);
gsl::at(table, 200) = RGB(0xff, 0x00, 0xd7);
gsl::at(table, 201) = RGB(0xff, 0x00, 0xff);
gsl::at(table, 202) = RGB(0xff, 0x5f, 0x00);
gsl::at(table, 203) = RGB(0xff, 0x5f, 0x5f);
gsl::at(table, 204) = RGB(0xff, 0x5f, 0x87);
gsl::at(table, 205) = RGB(0xff, 0x5f, 0xaf);
gsl::at(table, 206) = RGB(0xff, 0x5f, 0xd7);
gsl::at(table, 207) = RGB(0xff, 0x5f, 0xff);
gsl::at(table, 208) = RGB(0xff, 0x87, 0x00);
gsl::at(table, 209) = RGB(0xff, 0x87, 0x5f);
gsl::at(table, 210) = RGB(0xff, 0x87, 0x87);
gsl::at(table, 211) = RGB(0xff, 0x87, 0xaf);
gsl::at(table, 212) = RGB(0xff, 0x87, 0xd7);
gsl::at(table, 213) = RGB(0xff, 0x87, 0xff);
gsl::at(table, 214) = RGB(0xff, 0xaf, 0x00);
gsl::at(table, 215) = RGB(0xff, 0xaf, 0x5f);
gsl::at(table, 216) = RGB(0xff, 0xaf, 0x87);
gsl::at(table, 217) = RGB(0xff, 0xaf, 0xaf);
gsl::at(table, 218) = RGB(0xff, 0xaf, 0xd7);
gsl::at(table, 219) = RGB(0xff, 0xaf, 0xff);
gsl::at(table, 220) = RGB(0xff, 0xd7, 0x00);
gsl::at(table, 221) = RGB(0xff, 0xd7, 0x5f);
gsl::at(table, 222) = RGB(0xff, 0xd7, 0x87);
gsl::at(table, 223) = RGB(0xff, 0xd7, 0xaf);
gsl::at(table, 224) = RGB(0xff, 0xd7, 0xd7);
gsl::at(table, 225) = RGB(0xff, 0xd7, 0xff);
gsl::at(table, 226) = RGB(0xff, 0xff, 0x00);
gsl::at(table, 227) = RGB(0xff, 0xff, 0x5f);
gsl::at(table, 228) = RGB(0xff, 0xff, 0x87);
gsl::at(table, 229) = RGB(0xff, 0xff, 0xaf);
gsl::at(table, 230) = RGB(0xff, 0xff, 0xd7);
gsl::at(table, 231) = RGB(0xff, 0xff, 0xff);
gsl::at(table, 232) = RGB(0x08, 0x08, 0x08);
gsl::at(table, 233) = RGB(0x12, 0x12, 0x12);
gsl::at(table, 234) = RGB(0x1c, 0x1c, 0x1c);
gsl::at(table, 235) = RGB(0x26, 0x26, 0x26);
gsl::at(table, 236) = RGB(0x30, 0x30, 0x30);
gsl::at(table, 237) = RGB(0x3a, 0x3a, 0x3a);
gsl::at(table, 238) = RGB(0x44, 0x44, 0x44);
gsl::at(table, 239) = RGB(0x4e, 0x4e, 0x4e);
gsl::at(table, 240) = RGB(0x58, 0x58, 0x58);
gsl::at(table, 241) = RGB(0x62, 0x62, 0x62);
gsl::at(table, 242) = RGB(0x6c, 0x6c, 0x6c);
gsl::at(table, 243) = RGB(0x76, 0x76, 0x76);
gsl::at(table, 244) = RGB(0x80, 0x80, 0x80);
gsl::at(table, 245) = RGB(0x8a, 0x8a, 0x8a);
gsl::at(table, 246) = RGB(0x94, 0x94, 0x94);
gsl::at(table, 247) = RGB(0x9e, 0x9e, 0x9e);
gsl::at(table, 248) = RGB(0xa8, 0xa8, 0xa8);
gsl::at(table, 249) = RGB(0xb2, 0xb2, 0xb2);
gsl::at(table, 250) = RGB(0xbc, 0xbc, 0xbc);
gsl::at(table, 251) = RGB(0xc6, 0xc6, 0xc6);
gsl::at(table, 252) = RGB(0xd0, 0xd0, 0xd0);
gsl::at(table, 253) = RGB(0xda, 0xda, 0xda);
gsl::at(table, 254) = RGB(0xe4, 0xe4, 0xe4);
gsl::at(table, 255) = RGB(0xee, 0xee, 0xee);
// clang-format on
}