mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[Analyzers][CPP]Changes to fix warning 26493 on src/common (#23467)
* Changes to fix warning 26493 on src/common It will be multi PR change. This does not turn on the rule but fix the code under src/commom * int cast
This commit is contained in:
@@ -247,7 +247,7 @@ namespace PowerToysSettings
|
||||
bool Settings::serialize_to_buffer(wchar_t* buffer, int* buffer_size)
|
||||
{
|
||||
auto result = m_json.Stringify();
|
||||
const int result_len = (int)result.size() + 1;
|
||||
const int result_len = static_cast<int>(result.size() + 1);
|
||||
|
||||
if (buffer == nullptr || *buffer_size < result_len)
|
||||
{
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace PowerToysSettings
|
||||
std::array<BYTE, 256> key_states{}; // Zero-initialize
|
||||
std::array<wchar_t, 256> output;
|
||||
const UINT wFlags = 1 << 2; // If bit 2 is set, keyboard state is not changed (Windows 10, version 1607 and newer)
|
||||
auto output_bytes = ToUnicodeEx(key_code, scan_code, key_states.data(), output.data(), (int)output.size() - 1, wFlags, layout);
|
||||
auto output_bytes = ToUnicodeEx(key_code, scan_code, key_states.data(), output.data(), static_cast<int>(output.size()) - 1, wFlags, layout);
|
||||
if (output_bytes <= 0)
|
||||
{
|
||||
// If ToUnicodeEx fails (e.g. for F1-F12 keys) use GetKeyNameTextW
|
||||
|
||||
Reference in New Issue
Block a user