Commit a73abb20 authored by Will Harris's avatar Will Harris Committed by Commit Bot

Fix -Wshorten-64-to-32 warnings in ui/base.

../../ui/base/test/ui_controls_internal_win.cc(204,9):  warning: implicit conversion loses integer precision: 'WPARAM' (aka 'unsigned long long') to 'UINT' (aka 'unsigned int') [-Wshorten-64-to-32]
        w_param, reinterpret_cast<MOUSEHOOKSTRUCT*>(l_param));
        ^~~~~~~
../../ui/base/test/ui_controls_internal_win.cc(405,25):  warning: implicit conversion loses integer precision: 'std::vector<tagINPUT, std::allocator<tagINPUT> >::size_type' (aka 'unsigned long long') to 'UINT' (aka 'unsigned int') [-Wshorten-64-to-32]
  if (::SendInput(input.size(), input.data(), sizeof(INPUT)) != input.size())
      ~~          ~~~~~~^~~~~~
../../ui/base/test/ui_controls_internal_win.cc(520,25):  warning: implicit conversion loses integer precision: 'std::vector<tagINPUT, std::allocator<tagINPUT> >::size_type' (aka 'unsigned long long') to 'UINT' (aka 'unsigned int') [-Wshorten-64-to-32]
  if (::SendInput(input.size(), input.data(), sizeof(INPUT)) != input.size())
      ~~          ~~~~~~^~~~~~

BUG=879657

Change-Id: Iea866217701ef4b9f67b63a58a6ab6a35a88b1a8
Reviewed-on: https://chromium-review.googlesource.com/1217848
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590471}
parent c4a5b3a4
...@@ -201,7 +201,8 @@ LRESULT CALLBACK InputDispatcher::MouseHook(int n_code, ...@@ -201,7 +201,8 @@ LRESULT CALLBACK InputDispatcher::MouseHook(int n_code,
if (n_code == HC_ACTION) { if (n_code == HC_ACTION) {
DCHECK(current_dispatcher_); DCHECK(current_dispatcher_);
current_dispatcher_->DispatchedMessage( current_dispatcher_->DispatchedMessage(
w_param, reinterpret_cast<MOUSEHOOKSTRUCT*>(l_param)); static_cast<UINT>(w_param),
reinterpret_cast<MOUSEHOOKSTRUCT*>(l_param));
} }
return CallNextHookEx(next_hook, n_code, w_param, l_param); return CallNextHookEx(next_hook, n_code, w_param, l_param);
} }
...@@ -402,9 +403,14 @@ bool SendKeyPressImpl(HWND window, ...@@ -402,9 +403,14 @@ bool SendKeyPressImpl(HWND window,
AppendKeyboardInput(key, true, &input); AppendKeyboardInput(key, true, &input);
AppendAcceleratorInputs(control, shift, alt, true, &input); AppendAcceleratorInputs(control, shift, alt, true, &input);
if (::SendInput(input.size(), input.data(), sizeof(INPUT)) != input.size()) if (input.size() > std::numeric_limits<UINT>::max())
return false; return false;
if (::SendInput(static_cast<UINT>(input.size()), input.data(),
sizeof(INPUT)) != input.size()) {
return false;
}
if (dispatcher) if (dispatcher)
dispatcher->AddRef(); dispatcher->AddRef();
...@@ -517,9 +523,14 @@ bool SendMouseEventsImpl(MouseButton type, ...@@ -517,9 +523,14 @@ bool SendMouseEventsImpl(MouseButton type,
accelerator_state & kAlt, true, &input); accelerator_state & kAlt, true, &input);
} }
if (::SendInput(input.size(), input.data(), sizeof(INPUT)) != input.size()) if (input.size() > std::numeric_limits<UINT>::max())
return false; return false;
if (::SendInput(static_cast<UINT>(input.size()), input.data(),
sizeof(INPUT)) != input.size()) {
return false;
}
if (dispatcher) if (dispatcher)
dispatcher->AddRef(); dispatcher->AddRef();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment