C26460, use const on params that are unchanged (and remove some unnecessary span refs).
This commit is contained in:
parent
9678dd894c
commit
dd49c3ed51
|
@ -1503,6 +1503,11 @@ float DxEngine::GetScaling() const noexcept
|
|||
|
||||
THROW_IF_FAILED(fontFace0.As(&fontFace));
|
||||
|
||||
// Retrieve metrics in case the font we created was different than what was requested.
|
||||
weight = font->GetWeight();
|
||||
stretch = font->GetStretch();
|
||||
style = font->GetStyle();
|
||||
|
||||
// Dig the family name out at the end to return it.
|
||||
familyName = _GetFontFamilyName(fontFamily.Get(), localeName);
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ namespace Microsoft::Console::Utils
|
|||
std::string ColorToHexString(const COLORREF color);
|
||||
COLORREF ColorFromHexString(const std::string wstr);
|
||||
|
||||
void InitializeCampbellColorTable(gsl::span<COLORREF>& table);
|
||||
void InitializeCampbellColorTableForConhost(gsl::span<COLORREF>& table);
|
||||
void SwapANSIColorOrderForConhost(gsl::span<COLORREF>& table);
|
||||
void Initialize256ColorTable(gsl::span<COLORREF>& table);
|
||||
void SetColorTableAlpha(gsl::span<COLORREF>& table, const BYTE newAlpha) noexcept;
|
||||
void InitializeCampbellColorTable(const gsl::span<COLORREF> table);
|
||||
void InitializeCampbellColorTableForConhost(const gsl::span<COLORREF> table);
|
||||
void SwapANSIColorOrderForConhost(const gsl::span<COLORREF> table);
|
||||
void Initialize256ColorTable(const gsl::span<COLORREF> table);
|
||||
void SetColorTableAlpha(const gsl::span<COLORREF> table, const BYTE newAlpha) noexcept;
|
||||
|
||||
constexpr uint16_t EndianSwap(uint16_t value)
|
||||
{
|
||||
|
@ -57,5 +57,5 @@ namespace Microsoft::Console::Utils
|
|||
return value;
|
||||
}
|
||||
|
||||
GUID CreateV5Uuid(const GUID& namespaceGuid, const gsl::span<const gsl::byte>& name);
|
||||
GUID CreateV5Uuid(const GUID& namespaceGuid, const gsl::span<const gsl::byte> name);
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ void UtilsTests::TestSwapColorPalette()
|
|||
std::array<COLORREF, COLOR_TABLE_SIZE> consoleTable;
|
||||
|
||||
gsl::span<COLORREF> terminalTableView = { &terminalTable[0], gsl::narrow<ptrdiff_t>(terminalTable.size()) };
|
||||
gsl::span<COLORREF> consoleTableleView = { &consoleTable[0], gsl::narrow<ptrdiff_t>(consoleTable.size()) };
|
||||
gsl::span<COLORREF> consoleTableView = { &consoleTable[0], gsl::narrow<ptrdiff_t>(consoleTable.size()) };
|
||||
|
||||
// First set up the colors
|
||||
InitializeCampbellColorTable(terminalTableView);
|
||||
InitializeCampbellColorTableForConhost(consoleTableleView);
|
||||
InitializeCampbellColorTableForConhost(consoleTableView);
|
||||
|
||||
VERIFY_ARE_EQUAL(terminalTable[0], consoleTable[0]);
|
||||
VERIFY_ARE_EQUAL(terminalTable[1], consoleTable[4]);
|
||||
|
|
|
@ -123,7 +123,7 @@ bool Utils::IsValidHandle(const HANDLE handle) noexcept
|
|||
// - table: a color table with at least 16 entries
|
||||
// Return Value:
|
||||
// - <none>, throws if the table has less that 16 entries
|
||||
void Utils::InitializeCampbellColorTable(gsl::span<COLORREF>& table)
|
||||
void Utils::InitializeCampbellColorTable(const gsl::span<COLORREF> table)
|
||||
{
|
||||
THROW_HR_IF(E_INVALIDARG, table.size() < 16);
|
||||
|
||||
|
@ -154,7 +154,7 @@ void Utils::InitializeCampbellColorTable(gsl::span<COLORREF>& table)
|
|||
// - table: a color table with at least 16 entries
|
||||
// Return Value:
|
||||
// - <none>, throws if the table has less that 16 entries
|
||||
void Utils::InitializeCampbellColorTableForConhost(gsl::span<COLORREF>& table)
|
||||
void Utils::InitializeCampbellColorTableForConhost(const gsl::span<COLORREF> table)
|
||||
{
|
||||
THROW_HR_IF(E_INVALIDARG, table.size() < 16);
|
||||
InitializeCampbellColorTable(table);
|
||||
|
@ -167,7 +167,7 @@ void Utils::InitializeCampbellColorTableForConhost(gsl::span<COLORREF>& table)
|
|||
// - table: a color table with at least 16 entries
|
||||
// Return Value:
|
||||
// - <none>, throws if the table has less that 16 entries
|
||||
void Utils::SwapANSIColorOrderForConhost(gsl::span<COLORREF>& table)
|
||||
void Utils::SwapANSIColorOrderForConhost(const gsl::span<COLORREF> table)
|
||||
{
|
||||
THROW_HR_IF(E_INVALIDARG, table.size() < 16);
|
||||
std::swap(table[1], table[4]);
|
||||
|
@ -183,7 +183,7 @@ void Utils::SwapANSIColorOrderForConhost(gsl::span<COLORREF>& table)
|
|||
// - table: a color table with at least 256 entries
|
||||
// Return Value:
|
||||
// - <none>, throws if the table has less that 256 entries
|
||||
void Utils::Initialize256ColorTable(gsl::span<COLORREF>& table)
|
||||
void Utils::Initialize256ColorTable(const gsl::span<COLORREF> table)
|
||||
{
|
||||
THROW_HR_IF(E_INVALIDARG, table.size() < 256);
|
||||
|
||||
|
@ -454,7 +454,7 @@ void Utils::Initialize256ColorTable(gsl::span<COLORREF>& table)
|
|||
// - newAlpha: the new value to use as the alpha for all the entries in that table.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Utils::SetColorTableAlpha(gsl::span<COLORREF>& table, const BYTE newAlpha) noexcept
|
||||
void Utils::SetColorTableAlpha(const gsl::span<COLORREF> table, const BYTE newAlpha) noexcept
|
||||
{
|
||||
const auto shiftedAlpha = newAlpha << 24;
|
||||
for (auto& color : table)
|
||||
|
@ -473,7 +473,7 @@ void Utils::SetColorTableAlpha(gsl::span<COLORREF>& table, const BYTE newAlpha)
|
|||
// - name: Bytes comprising the name (in a namespace-specific format)
|
||||
// Return Value:
|
||||
// - a new stable v5 UUID
|
||||
GUID Utils::CreateV5Uuid(const GUID& namespaceGuid, const gsl::span<const gsl::byte>& name)
|
||||
GUID Utils::CreateV5Uuid(const GUID& namespaceGuid, const gsl::span<const gsl::byte> name)
|
||||
{
|
||||
// v5 uuid generation happens over values in network byte order, so let's enforce that
|
||||
auto correctEndianNamespaceGuid{ EndianSwap(namespaceGuid) };
|
||||
|
|
Loading…
Reference in a new issue