Index: ui/events/devices/x11/touch_factory_x11.cc |
diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc |
index 3d0423569ee11abbda85db1c368ef4f8ca324006..2327644fde1a2343255b011280b4848d21c730df 100644 |
--- a/ui/events/devices/x11/touch_factory_x11.cc |
+++ b/ui/events/devices/x11/touch_factory_x11.cc |
@@ -63,8 +63,8 @@ void TouchFactory::SetTouchDeviceListFromCommandLine() { |
if (!touch_devices.empty()) { |
std::vector<std::string> devs; |
- std::vector<unsigned int> device_ids; |
- unsigned int devid; |
+ std::vector<int> device_ids; |
+ int devid; |
base::SplitString(touch_devices, ',', &devs); |
for (std::vector<std::string>::iterator iter = devs.begin(); |
iter != devs.end(); ++iter) { |
@@ -216,28 +216,31 @@ void TouchFactory::SetupXI2ForXWindow(Window window) { |
XFlush(display); |
} |
-void TouchFactory::SetTouchDeviceList( |
- const std::vector<unsigned int>& devices) { |
+void TouchFactory::SetTouchDeviceList(const std::vector<int>& devices) { |
touch_device_lookup_.reset(); |
touch_device_list_.clear(); |
- for (std::vector<unsigned int>::const_iterator iter = devices.begin(); |
+ for (std::vector<int>::const_iterator iter = devices.begin(); |
iter != devices.end(); ++iter) { |
- DCHECK(*iter < touch_device_lookup_.size()); |
+ DCHECK((*iter >= 0) && |
+ (static_cast<size_t>(*iter) < touch_device_lookup_.size())); |
touch_device_lookup_[*iter] = true; |
touch_device_list_[*iter] = false; |
} |
} |
-bool TouchFactory::IsTouchDevice(unsigned deviceid) const { |
- return deviceid < touch_device_lookup_.size() ? |
- touch_device_lookup_[deviceid] : false; |
+bool TouchFactory::IsTouchDevice(int deviceid) const { |
+ return deviceid >= 0 && |
+ static_cast<size_t>(deviceid) < touch_device_lookup_.size() |
+ ? touch_device_lookup_[deviceid] |
+ : false; |
} |
-bool TouchFactory::IsMultiTouchDevice(unsigned int deviceid) const { |
- return (deviceid < touch_device_lookup_.size() && |
- touch_device_lookup_[deviceid]) ? |
- touch_device_list_.find(deviceid)->second : |
- false; |
+bool TouchFactory::IsMultiTouchDevice(int deviceid) const { |
+ return (deviceid > 0 && |
Daniel Erat
2015/04/09 16:41:21
should this be >= instead of >? if the difference
kpschoedel
2015/04/09 17:27:51
Done.
|
+ static_cast<size_t>(deviceid) < touch_device_lookup_.size() && |
+ touch_device_lookup_[deviceid]) |
+ ? touch_device_list_.find(deviceid)->second |
+ : false; |
} |
bool TouchFactory::QuerySlotForTrackingID(uint32 tracking_id, int* slot) { |
@@ -269,12 +272,13 @@ void TouchFactory::ResetForTest() { |
} |
void TouchFactory::SetTouchDeviceForTest( |
- const std::vector<unsigned int>& devices) { |
+ const std::vector<int>& devices) { |
touch_device_lookup_.reset(); |
touch_device_list_.clear(); |
- for (std::vector<unsigned int>::const_iterator iter = devices.begin(); |
+ for (std::vector<int>::const_iterator iter = devices.begin(); |
iter != devices.end(); ++iter) { |
- DCHECK(*iter < touch_device_lookup_.size()); |
+ DCHECK((*iter >= 0) && |
+ (static_cast<size_t>(*iter) < touch_device_lookup_.size())); |
touch_device_lookup_[*iter] = true; |
touch_device_list_[*iter] = true; |
} |
@@ -282,9 +286,9 @@ void TouchFactory::SetTouchDeviceForTest( |
} |
void TouchFactory::SetPointerDeviceForTest( |
- const std::vector<unsigned int>& devices) { |
+ const std::vector<int>& devices) { |
pointer_device_lookup_.reset(); |
- for (std::vector<unsigned int>::const_iterator iter = devices.begin(); |
+ for (std::vector<int>::const_iterator iter = devices.begin(); |
iter != devices.end(); ++iter) { |
pointer_device_lookup_[*iter] = true; |
} |