Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Unified Diff: device/hid/hid_service_mac.cc

Issue 656583003: Fix type truncation warnings in HID code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_report_descriptor_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service_mac.cc
diff --git a/device/hid/hid_service_mac.cc b/device/hid/hid_service_mac.cc
index 4723668f4a8f59f88d00d717c0f9fd6a4caaaa7b..6e091a851e7da88fb94950558f82520755e3591e 100644
--- a/device/hid/hid_service_mac.cc
+++ b/device/hid/hid_service_mac.cc
@@ -106,8 +106,11 @@ void GetCollectionInfos(IOHIDDeviceRef device,
HidCollectionInfo collection_info;
HidUsageAndPage::Page page = static_cast<HidUsageAndPage::Page>(
IOHIDElementGetUsagePage(collection));
- uint16_t usage = IOHIDElementGetUsage(collection);
- collection_info.usage = HidUsageAndPage(usage, page);
+ uint32_t usage = IOHIDElementGetUsage(collection);
+ if (usage > std::numeric_limits<uint16_t>::max())
+ continue;
+ collection_info.usage =
+ HidUsageAndPage(static_cast<uint16_t>(usage), page);
// Explore children recursively and retrieve their report IDs
GetReportIds(collection, &collection_info.report_ids);
if (collection_info.report_ids.size() > 0) {
« no previous file with comments | « device/hid/hid_report_descriptor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698