mirror of
https://github.com/microsoft/PowerToys
synced 2025-08-22 01:58:04 +00:00
[Analyzers][CPP]Turn on warning 4456 (#22087)
This commit is contained in:
parent
d931937538
commit
e5f171c836
@ -42,7 +42,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<DisableSpecificWarnings>26800;28251;4389;4456;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>26800;28251;4389;4457;4701;6387;4458;4505;4515;4459;4702;6031;6248;26451;28182;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
|
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
|
||||||
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
||||||
<ConformanceMode>false</ConformanceMode>
|
<ConformanceMode>false</ConformanceMode>
|
||||||
|
@ -32,13 +32,12 @@ public:
|
|||||||
HRESULT __stdcall CreateInstance(IUnknown* punkOuter, const IID& riid, void** ppv)
|
HRESULT __stdcall CreateInstance(IUnknown* punkOuter, const IID& riid, void** ppv)
|
||||||
{
|
{
|
||||||
*ppv = nullptr;
|
*ppv = nullptr;
|
||||||
HRESULT hr;
|
|
||||||
if (punkOuter)
|
if (punkOuter)
|
||||||
{
|
{
|
||||||
hr = CLASS_E_NOAGGREGATION;
|
return CLASS_E_NOAGGREGATION;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
T* psrm = new (std::nothrow) T();
|
T* psrm = new (std::nothrow) T();
|
||||||
HRESULT hr = psrm ? S_OK : E_OUTOFMEMORY;
|
HRESULT hr = psrm ? S_OK : E_OUTOFMEMORY;
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
@ -48,8 +47,6 @@ public:
|
|||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT __stdcall LockServer(BOOL)
|
HRESULT __stdcall LockServer(BOOL)
|
||||||
{
|
{
|
||||||
|
@ -278,11 +278,11 @@ D2DOverlayWindow::D2DOverlayWindow() :
|
|||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
// Removing <std::mutex> causes C3538 on std::unique_lock lock(mutex); in show(..)
|
// Removing <std::mutex> causes C3538 on std::unique_lock lock(mutex); in show(..)
|
||||||
std::unique_lock<std::mutex> lock(tasklist_cv_mutex);
|
std::unique_lock<std::mutex> task_list_lock(tasklist_cv_mutex);
|
||||||
tasklist_cv.wait(lock, [&] { return !running || tasklist_update; });
|
tasklist_cv.wait(task_list_lock, [&] { return !running || tasklist_update; });
|
||||||
if (!running)
|
if (!running)
|
||||||
return;
|
return;
|
||||||
lock.unlock();
|
task_list_lock.unlock();
|
||||||
while (running && tasklist_update)
|
while (running && tasklist_update)
|
||||||
{
|
{
|
||||||
std::vector<TasklistButton> buttons;
|
std::vector<TasklistButton> buttons;
|
||||||
|
@ -404,10 +404,10 @@ ZonesMap LayoutConfigurator::Custom(FancyZonesUtils::Rect workArea, HMONITOR mon
|
|||||||
DPIAware::Convert(monitor, x, y);
|
DPIAware::Convert(monitor, x, y);
|
||||||
DPIAware::Convert(monitor, zoneWidth, zoneHeight);
|
DPIAware::Convert(monitor, zoneWidth, zoneHeight);
|
||||||
|
|
||||||
Zone zone(RECT{ static_cast<long>(x), static_cast<long>(y), static_cast<long>(x + zoneWidth), static_cast<long>(y + zoneHeight) }, zones.size());
|
Zone zone_to_add(RECT{ static_cast<long>(x), static_cast<long>(y), static_cast<long>(x + zoneWidth), static_cast<long>(y + zoneHeight) }, zones.size());
|
||||||
if (zone.IsValid())
|
if (zone_to_add.IsValid())
|
||||||
{
|
{
|
||||||
if (!AddZone(zone, zones))
|
if (!AddZone(zone_to_add, zones))
|
||||||
{
|
{
|
||||||
Logger::error(L"Failed to create Custom layout. Invalid zone id");
|
Logger::error(L"Failed to create Custom layout. Invalid zone id");
|
||||||
return {};
|
return {};
|
||||||
|
@ -428,30 +428,30 @@ TEST_METHOD (VerifyFileAttributesMonthandDayNames)
|
|||||||
std::locale::global(std::locale(""));
|
std::locale::global(std::locale(""));
|
||||||
SYSTEMTIME fileTime = { 2020, 1, 3, 1, 15, 6, 42, 453 };
|
SYSTEMTIME fileTime = { 2020, 1, 3, 1, 15, 6, 42, 453 };
|
||||||
wchar_t localeName[LOCALE_NAME_MAX_LENGTH];
|
wchar_t localeName[LOCALE_NAME_MAX_LENGTH];
|
||||||
wchar_t result[MAX_PATH] = L"bar";
|
wchar_t dest[MAX_PATH] = L"bar";
|
||||||
wchar_t formattedDate[MAX_PATH];
|
wchar_t formattedDate[MAX_PATH];
|
||||||
if (GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) == 0)
|
if (GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) == 0)
|
||||||
StringCchCopy(localeName, LOCALE_NAME_MAX_LENGTH, L"en_US");
|
StringCchCopy(localeName, LOCALE_NAME_MAX_LENGTH, L"en_US");
|
||||||
|
|
||||||
GetDateFormatEx(localeName, NULL, &fileTime, L"MMM", formattedDate, MAX_PATH, NULL);
|
GetDateFormatEx(localeName, NULL, &fileTime, L"MMM", formattedDate, MAX_PATH, NULL);
|
||||||
formattedDate[0] = towupper(formattedDate[0]);
|
formattedDate[0] = towupper(formattedDate[0]);
|
||||||
StringCchPrintf(result, MAX_PATH, TEXT("%s%s"), result, formattedDate);
|
StringCchPrintf(dest, MAX_PATH, TEXT("%s%s"), dest, formattedDate);
|
||||||
|
|
||||||
GetDateFormatEx(localeName, NULL, &fileTime, L"MMMM", formattedDate, MAX_PATH, NULL);
|
GetDateFormatEx(localeName, NULL, &fileTime, L"MMMM", formattedDate, MAX_PATH, NULL);
|
||||||
formattedDate[0] = towupper(formattedDate[0]);
|
formattedDate[0] = towupper(formattedDate[0]);
|
||||||
StringCchPrintf(result, MAX_PATH, TEXT("%s-%s"), result, formattedDate);
|
StringCchPrintf(dest, MAX_PATH, TEXT("%s-%s"), dest, formattedDate);
|
||||||
|
|
||||||
GetDateFormatEx(localeName, NULL, &fileTime, L"ddd", formattedDate, MAX_PATH, NULL);
|
GetDateFormatEx(localeName, NULL, &fileTime, L"ddd", formattedDate, MAX_PATH, NULL);
|
||||||
formattedDate[0] = towupper(formattedDate[0]);
|
formattedDate[0] = towupper(formattedDate[0]);
|
||||||
StringCchPrintf(result, MAX_PATH, TEXT("%s-%s"), result, formattedDate);
|
StringCchPrintf(dest, MAX_PATH, TEXT("%s-%s"), dest, formattedDate);
|
||||||
|
|
||||||
GetDateFormatEx(localeName, NULL, &fileTime, L"dddd", formattedDate, MAX_PATH, NULL);
|
GetDateFormatEx(localeName, NULL, &fileTime, L"dddd", formattedDate, MAX_PATH, NULL);
|
||||||
formattedDate[0] = towupper(formattedDate[0]);
|
formattedDate[0] = towupper(formattedDate[0]);
|
||||||
StringCchPrintf(result, MAX_PATH, TEXT("%s-%s"), result, formattedDate);
|
StringCchPrintf(dest, MAX_PATH, TEXT("%s-%s"), dest, formattedDate);
|
||||||
|
|
||||||
SearchReplaceExpected sreTable[] = {
|
SearchReplaceExpected sreTable[] = {
|
||||||
//search, replace, test, result
|
//search, replace, test, result
|
||||||
{ L"foo", L"bar$MMM-$MMMM-$DDD-$DDDD", L"foo", result },
|
{ L"foo", L"bar$MMM-$MMMM-$DDD-$DDDD", L"foo", dest },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
|
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
|
||||||
|
@ -477,8 +477,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR l
|
|||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
// Save settings on closing, if closed 'normal'
|
// Save settings on closing, if closed 'normal'
|
||||||
auto general_settings = get_general_settings();
|
PTSettingsHelper::save_general_settings(get_general_settings().to_json());
|
||||||
PTSettingsHelper::save_general_settings(general_settings.to_json());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -144,7 +144,7 @@ wstring GetChecksum(path filePath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring result = L"CryptGetHashParam() failed. " + get_last_error_or_default(GetLastError());;
|
result = L"CryptGetHashParam() failed. " + get_last_error_or_default(GetLastError());;
|
||||||
}
|
}
|
||||||
|
|
||||||
CryptDestroyHash(hHash);
|
CryptDestroyHash(hHash);
|
||||||
|
@ -281,7 +281,7 @@ void ReportRegistry(const filesystem::path& tmpDir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD data = 0;
|
DWORD data = 0;
|
||||||
DWORD dataSize = sizeof(data);
|
dataSize = sizeof(data);
|
||||||
result = RegGetValueW(rootKey, subKey.c_str(), value.c_str(), flags, &type, &data, &dataSize);
|
result = RegGetValueW(rootKey, subKey.c_str(), value.c_str(), flags, &type, &data, &dataSize);
|
||||||
if (result == ERROR_SUCCESS)
|
if (result == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user