[Analyzers][CPP]Changes to fix warning 26493 on src/modules/ (P) (#23604)

* Changes to fix warning 26493 on src/modules/
This commit is contained in:
sosssego
2023-02-08 13:10:28 +00:00
committed by GitHub
parent 17475ec705
commit c7f761a589
13 changed files with 29 additions and 23 deletions

View File

@@ -420,7 +420,7 @@ BOOL GetEnumeratedFileName(__out_ecount(cchMax) PWSTR pszUniqueName, UINT cchMax
if (!pszRest)
{
pszRest = PathFindExtension(pszTemplate);
cchStem = (int)(pszRest - pszTemplate);
cchStem = static_cast<int>(pszRest - pszTemplate);
hr = StringCchCopy(szFormat, ARRAYSIZE(szFormat), L" (%lu)");
}
@@ -428,7 +428,7 @@ BOOL GetEnumeratedFileName(__out_ecount(cchMax) PWSTR pszUniqueName, UINT cchMax
{
pszRest++;
cchStem = (int)(pszRest - pszTemplate);
cchStem = static_cast<int>(pszRest - pszTemplate);
while (*pszRest && *pszRest >= L'0' && *pszRest <= L'9')
{
@@ -581,7 +581,7 @@ HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p
wc.lpfnWndProc = DefWindowProc;
wc.cbWndExtra = sizeof(void*);
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1);
wc.lpszClassName = wndClassName;
RegisterClass(&wc);
@@ -590,10 +590,10 @@ HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p
0, wndClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInst, nullptr);
if (hwnd)
{
SetWindowLongPtr(hwnd, 0, (LONG_PTR)p);
SetWindowLongPtr(hwnd, 0, reinterpret_cast<LONG_PTR>(p));
if (pfnWndProc)
{
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)pfnWndProc);
SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(pfnWndProc));
}
}

View File

@@ -123,12 +123,12 @@ void MRUListHandler::ParseJson()
unsigned int oldSize{ size };
if (json::has(jsonObject, c_maxMRUSize, json::JsonValueType::Number))
{
oldSize = (unsigned int)jsonObject.GetNamedNumber(c_maxMRUSize);
oldSize = static_cast<unsigned int>(jsonObject.GetNamedNumber(c_maxMRUSize));
}
unsigned int oldPushIdx{ 0 };
if (json::has(jsonObject, c_insertionIdx, json::JsonValueType::Number))
{
oldPushIdx = (unsigned int)jsonObject.GetNamedNumber(c_insertionIdx);
oldPushIdx = static_cast<unsigned int>(jsonObject.GetNamedNumber(c_insertionIdx));
if (oldPushIdx < 0 || oldPushIdx >= oldSize)
{
oldPushIdx = 0;
@@ -156,7 +156,7 @@ void MRUListHandler::ParseJson()
if (size > oldSize)
{
std::reverse(std::begin(temp), std::end(temp));
pushIdx = (unsigned int)temp.size();
pushIdx = static_cast<unsigned int>(temp.size());
temp.resize(size);
}
else

View File

@@ -526,7 +526,7 @@ LRESULT CALLBACK CPowerRenameManager::s_msgWndProc(_In_ HWND hwnd, _In_ UINT uMs
{
LRESULT lRes = 0;
CPowerRenameManager* pThis = (CPowerRenameManager*)GetWindowLongPtr(hwnd, 0);
CPowerRenameManager* pThis = reinterpret_cast<CPowerRenameManager*>(GetWindowLongPtr(hwnd, 0));
if (pThis != nullptr)
{
lRes = pThis->_WndProc(hwnd, uMsg, wParam, lParam);

View File

@@ -125,7 +125,7 @@ void CSettings::ParseJson()
}
if (json::has(jsonSettings, c_maxMRUSize, json::JsonValueType::Number))
{
settings.maxMRUSize = (unsigned int)jsonSettings.GetNamedNumber(c_maxMRUSize);
settings.maxMRUSize = static_cast<unsigned int>(jsonSettings.GetNamedNumber(c_maxMRUSize));
}
if (json::has(jsonSettings, c_searchText, json::JsonValueType::String))
{