diff options
author | scottmg <scottmg@chromium.org> | 2015-04-30 19:50:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 02:50:58 +0000 |
commit | 359cb535d023f8c83f7b6a796bc43a30f4594ad7 (patch) | |
tree | b4b0575570ec553d085f9d35b8c190289eb7eeab | |
parent | 9d2ba75cedbc180aa019b25c05ff39c5df6ca04b (diff) | |
download | chromium_src-359cb535d023f8c83f7b6a796bc43a30f4594ad7.zip chromium_src-359cb535d023f8c83f7b6a796bc43a30f4594ad7.tar.gz chromium_src-359cb535d023f8c83f7b6a796bc43a30f4594ad7.tar.bz2 |
vs2015: fix narrowing warnings in sandbox/win/
d:\src\cr2\src\sandbox\win\src\broker_services.cc(282): warning C4311: 'reinterpret_cast': pointer truncation from 'LPOVERLAPPED' to 'DWORD'
d:\src\cr2\src\sandbox\win\src\broker_services.cc(282): warning C4302: 'reinterpret_cast': truncation from 'LPOVERLAPPED' to 'DWORD'
d:\src\cr2\src\sandbox\win\src\broker_services.cc(312): warning C4311: 'reinterpret_cast': pointer truncation from 'LPOVERLAPPED' to 'DWORD'
d:\src\cr2\src\sandbox\win\src\broker_services.cc(312): warning C4302: 'reinterpret_cast': truncation from 'LPOVERLAPPED' to 'DWORD'
d:\src\cr2\src\sandbox\win\src\broker_services.cc(546): warning C4312: 'reinterpret_cast': conversion from 'DWORD' to 'LPOVERLAPPED' of greater size
d:\src\cr2\src\sandbox\win\src\eat_resolver.cc(51): warning C4302: 'reinterpret_cast': truncation from 'void *' to 'DWORD'
d:\src\cr2\src\sandbox\win\src\eat_resolver.cc(52): warning C4302: 'reinterpret_cast': truncation from 'const void *' to 'DWORD'
R=cpu@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1119783002
Cr-Commit-Position: refs/heads/master@{#327868}
-rw-r--r-- | sandbox/win/src/broker_services.cc | 12 | ||||
-rw-r--r-- | sandbox/win/src/eat_resolver.cc | 8 |
2 files changed, 9 insertions, 11 deletions
diff --git a/sandbox/win/src/broker_services.cc b/sandbox/win/src/broker_services.cc index 01c7cdd..149218fa 100644 --- a/sandbox/win/src/broker_services.cc +++ b/sandbox/win/src/broker_services.cc @@ -279,7 +279,8 @@ DWORD WINAPI BrokerServicesBase::TargetEventsThread(PVOID param) { case JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: { { AutoLock lock(&broker->lock_); - broker->child_process_ids_.erase(reinterpret_cast<DWORD>(ovl)); + broker->child_process_ids_.erase( + static_cast<DWORD>(reinterpret_cast<uintptr_t>(ovl))); } --target_counter; if (0 == target_counter) @@ -308,8 +309,8 @@ DWORD WINAPI BrokerServicesBase::TargetEventsThread(PVOID param) { } else if (THREAD_CTRL_REMOVE_PEER == key) { // Remove a process from our list of peers. AutoLock lock(&broker->lock_); - PeerTrackerMap::iterator it = - broker->peer_map_.find(reinterpret_cast<DWORD>(ovl)); + PeerTrackerMap::iterator it = broker->peer_map_.find( + static_cast<DWORD>(reinterpret_cast<uintptr_t>(ovl))); DeregisterPeerTracker(it->second); broker->peer_map_.erase(it); } else if (THREAD_CTRL_QUIT == key) { @@ -542,8 +543,9 @@ bool BrokerServicesBase::IsActiveTarget(DWORD process_id) { VOID CALLBACK BrokerServicesBase::RemovePeer(PVOID parameter, BOOLEAN timeout) { PeerTracker* peer = reinterpret_cast<PeerTracker*>(parameter); // Don't check the return code because we this may fail (safely) at shutdown. - ::PostQueuedCompletionStatus(peer->job_port, 0, THREAD_CTRL_REMOVE_PEER, - reinterpret_cast<LPOVERLAPPED>(peer->id)); + ::PostQueuedCompletionStatus( + peer->job_port, 0, THREAD_CTRL_REMOVE_PEER, + reinterpret_cast<LPOVERLAPPED>(static_cast<uintptr_t>(peer->id))); } ResultCode BrokerServicesBase::AddTargetPeer(HANDLE peer_process) { diff --git a/sandbox/win/src/eat_resolver.cc b/sandbox/win/src/eat_resolver.cc index 328ee00..1675ce8 100644 --- a/sandbox/win/src/eat_resolver.cc +++ b/sandbox/win/src/eat_resolver.cc @@ -45,12 +45,8 @@ NTSTATUS EatResolverThunk::Setup(const void* target_module, return ret; // Perform the patch. -#pragma warning(push) -#pragma warning(disable: 4311) - // These casts generate warnings because they are 32 bit specific. - *eat_entry_ = reinterpret_cast<DWORD>(thunk_storage) - - reinterpret_cast<DWORD>(target_module); -#pragma warning(pop) + *eat_entry_ = static_cast<DWORD>(reinterpret_cast<uintptr_t>(thunk_storage)) - + static_cast<DWORD>(reinterpret_cast<uintptr_t>(target_module)); if (NULL != storage_used) *storage_used = GetThunkSize(); |