[CPP][Analyzers]Turn on warning 4244 (#22019)

* Turn on warning 4244

fix one occurrence of 4100

* changes from comments

* toupper on wchar
This commit is contained in:
sosssego 2022-11-17 16:24:56 +00:00 committed by GitHub
parent 8fb93dc6ee
commit 195c265a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 10 deletions

View File

@ -42,7 +42,7 @@
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>26800;28251;4244;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26800;28251;4245;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
<ConformanceMode>false</ConformanceMode>

View File

@ -2,6 +2,8 @@
#include "../utils/json.h"
#include <cwctype>
namespace PowerToysSettings
{
class HotkeyObject;
@ -230,7 +232,7 @@ namespace PowerToysSettings
if (output_bytes == 1 && output[0] >= 'a' && output[0] <= 'z')
{
// Make Latin letters keys capital, as it looks better
output[0] = toupper(output[0]);
output[0] = std::towupper(output[0]);
}
return output.data();
}

View File

@ -56,7 +56,7 @@ bool HotkeyManager::FilterKeyboardProc(KeyboardEvent ^ ev)
pressedKeys->Ctrl = GetAsyncKeyState(VK_CONTROL) & 0x8000;
pressedKeys->Alt = GetAsyncKeyState(VK_MENU) & 0x8000;
pressedKeys->Shift = GetAsyncKeyState(VK_SHIFT) & 0x8000;
pressedKeys->Key = ev->key;
pressedKeys->Key = static_cast<unsigned char>(ev->key);
// Convert to hotkey handle
auto pressedKeysHandle = GetHotkeyHandle(pressedKeys);

View File

@ -16,7 +16,7 @@ namespace package {
{
OSVERSIONINFOEX osvi{};
DWORDLONG dwlConditionMask = 0;
int op = VER_GREATER_EQUAL;
byte op = VER_GREATER_EQUAL;
// Initialize the OSVERSIONINFOEX structure.
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

View File

@ -619,7 +619,7 @@ void D2DOverlayWindow::render(ID2D1DeviceContext5* d2d_dc)
d2d_dc->Clear();
int x_offset = 0, y_offset = 0;
auto current_anim_value = (float)animation.value(Animation::AnimFunctions::LINEAR);
SetLayeredWindowAttributes(hwnd, 0, (int)(255 * current_anim_value), LWA_ALPHA);
SetLayeredWindowAttributes(hwnd, 0, static_cast<byte>(255 * current_anim_value), LWA_ALPHA);
double pos_anim_value = 1 - animation.value(Animation::AnimFunctions::EASE_OUT_EXPO);
if (!tasklist_buttons.empty())
{

View File

@ -311,7 +311,7 @@ private:
m_hotkey.modifiersMask |= MOD_ALT;
}
m_hotkey.vkCode = hotkey.get_code();
m_hotkey.vkCode = static_cast<WORD>(hotkey.get_code());
}
catch (...)
{

View File

@ -212,7 +212,6 @@ void Trace::FancyZones::DataChanged() noexcept
activeZoneSetInfo += L", custom zone data was deleted";
}
}
TraceLoggingWrite(
g_hProvider,
EventZoneSettingsChangedKey,
@ -220,7 +219,7 @@ void Trace::FancyZones::DataChanged() noexcept
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
TraceLoggingInt32(appsHistorySize, AppsInHistoryCountKey),
TraceLoggingInt32(static_cast<int>(customZones.size()), CustomZoneSetCountKey),
TraceLoggingInt32Array(customZonesArray.get(), static_cast<int>(customZones.size()), NumberOfZonesForEachCustomZoneSetKey),
TraceLoggingInt32Array(customZonesArray.get(), static_cast<uint16_t>(customZones.size()), NumberOfZonesForEachCustomZoneSetKey),
TraceLoggingInt32(static_cast<int>(layouts.size()), ActiveZoneSetsCountKey),
TraceLoggingWideString(activeZoneSetInfo.c_str(), ActiveZoneSetsListKey),
TraceLoggingInt32(static_cast<int>(quickKeysCount), LayoutUsingQuickKeyCountKey));

View File

@ -262,7 +262,7 @@ HRESULT CContextMenuHandler::ResizePictures(CMINVOKECOMMANDINFO* pici, IShellIte
startupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
if (pici)
{
startupInfo.wShowWindow = pici->nShow;
startupInfo.wShowWindow = static_cast<WORD>(pici->nShow);
}
else
{

View File

@ -165,7 +165,7 @@ HRESULT CPowerRenameMenu::RunPowerRename(CMINVOKECOMMANDINFO* pici, IShellItemAr
startupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
if (pici)
{
startupInfo.wShowWindow = pici->nShow;
startupInfo.wShowWindow = static_cast<WORD>(pici->nShow);
}
else
{