[Analyzers][CPP] Turn on warning 26493 (#23990)

and change the remaining files
This commit is contained in:
sosssego 2023-02-13 16:37:26 +00:00 committed by GitHub
parent 6e4a2898ab
commit f82babb76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -80,7 +80,7 @@
<Rule Id="C26490" Action="Hidden" />
<Rule Id="C26491" Action="Hidden" />
<Rule Id="C26492" Action="Error" />
<Rule Id="C26493" Action="Hidden" />
<Rule Id="C26493" Action="Error" />
<Rule Id="C26494" Action="Hidden" />
<Rule Id="C26495" Action="Error" />
<Rule Id="C26496" Action="Hidden" />

View File

@ -264,7 +264,7 @@ UINT __stdcall CreateScheduledTaskCA(MSIHANDLE hInstall)
nullptr,
CLSCTX_INPROC_SERVER,
IID_ITaskService,
(void**)&pService);
reinterpret_cast<void**>(&pService));
ExitOnFailure(hr, "Failed to create an instance of ITaskService: %x", hr);
// Connect to the task service.
@ -490,7 +490,7 @@ UINT __stdcall RemoveScheduledTasksCA(MSIHANDLE hInstall)
nullptr,
CLSCTX_INPROC_SERVER,
IID_ITaskService,
(void**)&pService);
reinterpret_cast<void**>(&pService));
ExitOnFailure(hr, "Failed to create an instance of ITaskService: %x", hr);
// Connect to the task service.
@ -809,7 +809,7 @@ UINT __stdcall CertifyVirtualCameraDriverCA(MSIHANDLE hInstall)
ExitOnFailure(hr, "Certificate file size not valid", hr);
}
pFileContent = (char*)malloc(size);
pFileContent = static_cast<char*>(malloc(size));
DWORD sizeread;
if (!ReadFile(hfile, pFileContent, size, &sizeread, nullptr))
@ -820,7 +820,7 @@ UINT __stdcall CertifyVirtualCameraDriverCA(MSIHANDLE hInstall)
if (!CertAddEncodedCertificateToStore(hCertStore,
X509_ASN_ENCODING,
(const BYTE*)pFileContent,
reinterpret_cast<const BYTE*>(pFileContent),
size,
CERT_STORE_ADD_ALWAYS,
nullptr))

View File

@ -49,7 +49,7 @@ inline std::wstring get_process_path(DWORD pid) noexcept
{
name.resize(MAX_PATH);
DWORD name_length = static_cast<DWORD>(name.length());
if (QueryFullProcessImageNameW(process, 0, (LPWSTR)name.data(), &name_length) == 0)
if (QueryFullProcessImageNameW(process, 0, static_cast<LPWSTR>(name.data()), &name_length) == 0)
{
name_length = 0;
}
@ -410,7 +410,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LPCWSTR text = L"Please select the target window (using a mouse or Alt+Tab), \r\nand press Ctrl+Alt+S to capture its styles. \r\nYou can find the output file \"window_styles.txt\" on your desktop.";
RECT rc{0,50,600,200};
DrawText(hdc, text, (int)wcslen(text), &rc, DT_CENTER | DT_WORDBREAK);
DrawText(hdc, text, static_cast<int>(wcslen(text)), &rc, DT_CENTER | DT_WORDBREAK);
EndPaint(hWnd, &ps);
}