[Analyzers][CPP]Changes to fix warning 26493 on src/runner (#23672)

* Changes to fix warning 26493 on src/runner

* formating
This commit is contained in:
sosssego 2023-02-08 11:17:33 +00:00 committed by GitHub
parent 49b2823056
commit 9168f871af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 25 deletions

View File

@ -75,7 +75,7 @@ bool create_auto_start_task_for_this_user(bool runElevated)
NULL,
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.
@ -286,7 +286,7 @@ bool delete_auto_start_task_for_this_user()
NULL,
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.
@ -351,7 +351,7 @@ bool is_auto_start_task_active_for_this_user()
NULL,
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.

View File

@ -66,13 +66,13 @@ void run_interval()
left_to_wait = max(0, wait_time - timeutil::diff::in_seconds(timeutil::now(), time.value()));
}
Sleep((DWORD)left_to_wait * 1000);
Sleep(static_cast<DWORD>(left_to_wait * 1000));
send();
update_last_send_time(timeutil::now());
while (true)
{
Sleep((DWORD)wait_time * 1000);
Sleep(static_cast<DWORD>(wait_time * 1000));
send();
update_last_send_time(timeutil::now());
}

View File

@ -242,7 +242,7 @@ void dispatch_received_json(const std::wstring& json_to_parse)
void dispatch_received_json_callback(PVOID data)
{
std::wstring* msg = (std::wstring*)data;
std::wstring* msg = static_cast<std::wstring*>(data);
dispatch_received_json(*msg);
delete msg;
}
@ -345,7 +345,7 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op
auto val = get_last_error_message(GetLastError());
Logger::warn(L"UuidCreate can not create guid. {}", val.has_value() ? val.value() : L"");
}
else if (UuidToString(&temp_uuid, (RPC_WSTR*)&uuid_chars) != RPC_S_OK)
else if (UuidToString(&temp_uuid, reinterpret_cast<RPC_WSTR*>(&uuid_chars)) != RPC_S_OK)
{
auto val = get_last_error_message(GetLastError());
Logger::warn(L"UuidToString can not convert to string. {}", val.has_value() ? val.value() : L"");
@ -355,7 +355,7 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op
{
powertoys_pipe_name += std::wstring(uuid_chars);
settings_pipe_name += std::wstring(uuid_chars);
RpcStringFree((RPC_WSTR*)&uuid_chars);
RpcStringFree(reinterpret_cast<RPC_WSTR*>(&uuid_chars));
uuid_chars = nullptr;
}

View File

@ -53,7 +53,7 @@ bool dispatch_run_on_main_ui_thread(main_loop_callback_function _callback, PVOID
wnd_msg->_callback = _callback;
wnd_msg->data = data;
PostMessage(tray_icon_hwnd, wm_run_on_main_ui_thread, 0, (LPARAM)wnd_msg);
PostMessage(tray_icon_hwnd, wm_run_on_main_ui_thread, 0, reinterpret_cast<LPARAM>(wnd_msg));
return true;
}
@ -116,7 +116,6 @@ void handle_tray_command(HWND window, const WPARAM command_id, LPARAM lparam)
RunNonElevatedEx(L"https://aka.ms/PowerToysOverview", L"", L"");
break;
}
}
}
@ -242,7 +241,7 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
{
if (lparam != NULL)
{
struct run_on_main_ui_thread_msg* msg = (struct run_on_main_ui_thread_msg*)lparam;
struct run_on_main_ui_thread_msg* msg = reinterpret_cast<struct run_on_main_ui_thread_msg*>(lparam);
msg->_callback(msg->data);
delete msg;
lparam = NULL;

View File

@ -7,7 +7,7 @@
#include <sstream>
#include <csignal>
static IMAGEHLP_SYMBOL64* p_symbol = (IMAGEHLP_SYMBOL64*)malloc(sizeof(IMAGEHLP_SYMBOL64) + MAX_PATH * sizeof(WCHAR));
static IMAGEHLP_SYMBOL64* p_symbol = static_cast<IMAGEHLP_SYMBOL64*>(malloc(sizeof(IMAGEHLP_SYMBOL64) + MAX_PATH * sizeof(WCHAR)));
static IMAGEHLP_LINE64 line;
static bool processing_exception = false;
static WCHAR module_path[MAX_PATH];
@ -126,7 +126,7 @@ void log_stack_trace(std::wstring& generalErrorDescription)
auto module_base = SymGetModuleBase64(process, stack.AddrPC.Offset);
if (module_base)
{
GetModuleFileName((HINSTANCE)module_base, module_path, MAX_PATH);
GetModuleFileName(reinterpret_cast<HINSTANCE>(module_base), module_path, MAX_PATH);
}
ss << module_path << "!"
<< p_symbol->Name