Chromium Code Reviews

Unified Diff: ppapi/shared_impl/ppb_gamepad_shared.cc

Issue 280713004: Update Gamepad API to match the latest specification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Apply comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « ppapi/shared_impl/ppb_gamepad_shared.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/ppb_gamepad_shared.cc
diff --git a/ppapi/shared_impl/ppb_gamepad_shared.cc b/ppapi/shared_impl/ppb_gamepad_shared.cc
index c45494a00c1c2dd07b4bf9778350ddf583825c7b..c913401481718d967d1b964cd1c0bee5aa64156c 100644
--- a/ppapi/shared_impl/ppb_gamepad_shared.cc
+++ b/ppapi/shared_impl/ppb_gamepad_shared.cc
@@ -18,16 +18,14 @@ void ConvertWebKitGamepadData(const WebKitGamepads& webkit_data,
if (webkit_pad.connected) {
COMPILE_ASSERT(sizeof(output_pad.id) == sizeof(webkit_pad.id),
id_size_does_not_match);
- COMPILE_ASSERT(sizeof(output_pad.axes) == sizeof(webkit_pad.axes),
- axes_size_does_not_match);
memcpy(output_pad.id, webkit_pad.id, sizeof(output_pad.id));
output_pad.timestamp = webkit_pad.timestamp;
output_pad.axes_length = webkit_pad.axes_length;
- memcpy(output_pad.axes, webkit_pad.axes, sizeof(output_pad.axes));
+ for (unsigned j = 0; j < webkit_pad.axes_length; ++j)
+ output_pad.axes[j] = static_cast<float>(webkit_pad.axes[j]);
output_pad.buttons_length = webkit_pad.buttons_length;
-
for (unsigned j = 0; j < webkit_pad.buttons_length; ++j)
- output_pad.buttons[j] = webkit_pad.buttons[j].value;
+ output_pad.buttons[j] = static_cast<float>(webkit_pad.buttons[j].value);
}
}
}
« no previous file with comments | « ppapi/shared_impl/ppb_gamepad_shared.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine