mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: use auto to avoid repeating type (#26254)
This commit is contained in:
@@ -54,8 +54,7 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
|
||||
base::JSON_REPLACE_INVALID_CHARACTERS);
|
||||
if (!parsed_message || !parsed_message->is_dict())
|
||||
return;
|
||||
base::DictionaryValue* dict =
|
||||
static_cast<base::DictionaryValue*>(parsed_message.get());
|
||||
auto* dict = static_cast<base::DictionaryValue*>(parsed_message.get());
|
||||
int id;
|
||||
if (!dict->GetInteger("id", &id)) {
|
||||
std::string method;
|
||||
|
||||
@@ -77,7 +77,7 @@ gin::WrapperInfo DownloadItem::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
DownloadItem* DownloadItem::FromDownloadItem(
|
||||
download::DownloadItem* download_item) {
|
||||
// ^- say that 7 times fast in a row
|
||||
UserDataLink* data = static_cast<UserDataLink*>(
|
||||
auto* data = static_cast<UserDataLink*>(
|
||||
download_item->GetUserData(kElectronApiDownloadItemKey));
|
||||
return data ? data->download_item.get() : nullptr;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ LRESULT CALLBACK PowerMonitor::WndProcStatic(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam) {
|
||||
PowerMonitor* msg_wnd =
|
||||
auto* msg_wnd =
|
||||
reinterpret_cast<PowerMonitor*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||
if (msg_wnd)
|
||||
return msg_wnd->WndProc(hwnd, message, wparam, lparam);
|
||||
|
||||
@@ -934,7 +934,7 @@ bool Session::RemoveWordFromSpellCheckerDictionary(const std::string& word) {
|
||||
|
||||
// static
|
||||
Session* Session::FromBrowserContext(content::BrowserContext* context) {
|
||||
UserDataLink* data =
|
||||
auto* data =
|
||||
static_cast<UserDataLink*>(context->GetUserData(kElectronApiSessionKey));
|
||||
return data ? data->session : nullptr;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ LRESULT CALLBACK SystemPreferences::WndProcStatic(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam) {
|
||||
SystemPreferences* msg_wnd = reinterpret_cast<SystemPreferences*>(
|
||||
auto* msg_wnd = reinterpret_cast<SystemPreferences*>(
|
||||
GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||
if (msg_wnd)
|
||||
return msg_wnd->WndProc(hwnd, message, wparam, lparam);
|
||||
|
||||
@@ -3074,7 +3074,7 @@ gin::Handle<WebContents> WebContents::CreateAndTake(
|
||||
WebContents* WebContents::From(content::WebContents* web_contents) {
|
||||
if (!web_contents)
|
||||
return nullptr;
|
||||
UserDataLink* data = static_cast<UserDataLink*>(
|
||||
auto* data = static_cast<UserDataLink*>(
|
||||
web_contents->GetUserData(kElectronApiWebContentsKey));
|
||||
return data ? data->web_contents.get() : nullptr;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ ProcessIntegrityLevel ProcessMetric::GetIntegrityLevel() const {
|
||||
}
|
||||
|
||||
auto token_label_bytes = std::make_unique<char[]>(token_info_length);
|
||||
TOKEN_MANDATORY_LABEL* token_label =
|
||||
auto* token_label =
|
||||
reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_label_bytes.get());
|
||||
if (!::GetTokenInformation(token, TokenIntegrityLevel, token_label,
|
||||
token_info_length, &token_info_length)) {
|
||||
|
||||
Reference in New Issue
Block a user