Skip to content

Commit

Permalink
[Analyzers][CPP] Turn on warning 26493 (microsoft#23990)
Browse files Browse the repository at this point in the history
and change the remaining files
  • Loading branch information
sosssego authored Feb 13, 2023
1 parent 6e4a289 commit f82babb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CppRuleSet.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
8 changes: 4 additions & 4 deletions installer/PowerToysSetupCustomActions/CustomAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tools/StylesReportTool/StylesReportTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f82babb

Please sign in to comment.